Slides: A Website for Yancy

I gave a talk this month to Chicago Perl Mongers about the Mojolicious web framework, the Yancy CMS, the PODViewer plugin, and the Mojolicious export command. The talk introduces a simple Mojolicious::Lite application, and adding Yancy to edit the website's content inside the app. Then I explain how to make layout templates, and how to export a dynamic website as static HTML files.

This talk comes from my series of blog posts for the 2018 Mojolicious Advent Calendar: A Website For Yancy, A View To A POD, and You Only Export Twice.

Slides for the talk are available on my website

bless is good parts of Perl language

Recently I feel bless is good parts of Perl language strongly.

Exploring Type::Tiny Part 6: Some Interesting Type Libraries

Type::Tiny is probably best known as a way of having Moose-like type constraints in Moo, but it can be used for so much more. This is the sixth in a series of posts showing other things you can use Type::Tiny for. This article along with the earlier ones in the series can be found on my blog and in the Cool Uses for Perl section of PerlMonks.

While Types::Standard provides all the type constraints Moose users will be familiar with (and a few more) there are other type libraries you can use instead of or as well as Types::Standard.

Improving Perl debugger variable output

TL;DR: Drop my .perldb file in your home directory for a much nicer debugger experience.

The kindest thing I can say about the built-in Perl debugger is that it doesn't drink even though it's old enough to. Using it is painful but there are many things you can do to make it nicer. Heck, I even had syntax highlighting working once.

One of my major pet peeves with the debugger has been how it dumps variable data. Have you ever used it and typed "x $dbic_object" or "r" to return from a method and gotten hundreds of lines of near useless output spewing across the screen? To make matters worse, it takes a long time to dump all of that, making the slow debugger even slower than normal. It's very frustrating. Here's how to fix it.

When running the debugger, Perl loads a script named perl5db.pl and internally, when it needs to dump some variables to the terminal, it runs some code which looks like this (edited for clarity):

AWS Lambdas, Furl & LWP

At re:Invent 2018 AWS announced custom Lambda runtimes. This makes it possible to create Perl based Lambdas. Although theoretically it was possible to create a Perl Lambda prior to this announcement by invoking a shell from Python for example, the new custom runtimes make it possible to use almost any language to create Lambdas.

I've been developing a Perl based custom runtime framework so that creating a Perl Lambda is pretty much as simple as:

Sparrow moves to Perl6

sparrow logo


Hi!

For those whom it may concerns Sparrow announces move to Perl6. I've have started the reddit thread to explain what and why.

Thank you

Alexey

RPerl at FOSDEM

Exciting news!

Team RPerl will be in Brussels, Belgium two weeks from now for FOSDEM 2019, the largest open source computer conference in Europe (and possibly the world). We will be present the whole weekend, helping out at the Perl booth and promoting the RPerl compiler.

Also, RPerl founder Will Braswell is scheduled as one of the main track FOSDEM speakers, on Sunday February 3rd at 2pm. His topic will be Perl 11, a philosophy that promotes Perl projects aiming to re-unify Perl 5 and Perl 6. RPerl is one such project, and there are several others as well.

You can already read more about Perl 11 in Will's interview for FOSDEM:
https://fosdem.org/2019/interviews/william-braswell/

We are looking forward to be there, meeting new people, and seeing familiar faces again!

this_perl_goes_to_11.jpg

Untrusted Numeric Input

David Farrell's Perl.com article Validating untrusted input: numbers got me thinking, specifically about the role of \d in sanitizing input. I am not going to talk here about looks_like_number(), because the referenced article covers it.

The thing is, on any Perl recent enough to be Unicode-aware, \d matches digits, whether or not they are ASCII. This may be a problem if you are sanitizing data for numeric conversion, because typically conversion routines expect ASCII digits. There seem to me to be at least two ways to deal with this: restrict your regexp patterns to ASCII, or have the conversion routine deal with the full range of unicode digits.

Restrict Patterns to ASCII

If you truly want ASCII digits for your system, there are a number of ways to restrict a regular expression pattern to ASCII.

Use two-level validation, a.k.a. brute force

By this I simply mean explicitly validating anything that matched \d by also matching it against [:ascii:] in a second regular expression.

Use [0-9] instead of \d

Perl Blogs

What is the status of a replacement for this blogging platform? I imagine the community as a whole is reluctant to blog in a central place because of the difficulty just logging in to this particular site.

Is there an alternative site where Perl bloggers post?

(Mis) Using Perl 6 Grammars : Decompressing Zelda 3 GFX

(Mis) Using Perl 6 Grammars : Decompressing Zelda 3 GFX

Grammars combined with actions allows to parse strings and produce something from it. It's not far fetched to say that any compressed data follow a structure that is likely 'parsed' by the corresponding decompression algorithm.

So why not using Perl 6 grammar for this kind of work? Especially a compression I am familiar with.

A look into Nintendo compression

Nintendo used the same base compression format for their SNES games with some variant depending on the game. It's pretty straight forward and it's easy on the ~2Mhz of the SNES CPU.

It goes like that:

RPerl at the Austin Perl Mongers Christmas Party

The last event of 2018 for Team RPerl was the Austin.pm Christmas Party. Our beloved President (AKA "Prez"), Will the Chill, gathered all of us for pizza and Perl projects.

Throughout the evening, we discussed the possibilities for us to develop the use of Perl, promote Perl jobs and Perl projects in the Austin area.

Our main ideas include:
- Hosting Hackathons for Perl projects
- Inviting a guest speaker once a year
- Teaching free Perl classes

Among our members present that evening was Jim Choate, one of the three original Austin.pm founders, along with some of the younger generation of Perl enthusiasts. The party was about the past and future of Austin Perl Mongers, in every way.

And it wouldn't be a Christmas party without a few presents, Perl presents of course! (Thanks to Wendy & Liz for furnishing some of the Perl gifts at past YAPC/TPC conferences.)

Austinpm_Christmas_2018.jpg

Rakudo.js update - hunting down failing roast tests

Currently I'm working to getting rakudo.js to pass (our choosen subset of tests) in Chrome rather then on node.js.
For that I'm using the karma test runner (which should also allow testing all the other browsers easily).

The way the process works is that the Perl 6 test files get compiled to JavaScript and bundled by the parcel with everything they needs to run. The bundling includes the setting, runtime and even the whole Rakudo compiler (tests use EVAL a lot).
As as side node it turns out that for debugging purposes node bundled-everything.js emulates running in the browser very closely.

Git Repo in Shared Hosting #3 - Git::Hooks for a Secure and Clean Repo

http://www.koivunalho.org/blogs/exercises-in-integration-and-delivery/private-repository-part-3.html

Perl Dependency Checking

I'm working on a few projects right now, most notably one that helps me create a CPAN distribution so that I can create a Perl Lambda in the AWS environment. This has led me to some yak shaving exercises, most notably investigating how to check for Perl dependencies.

Without getting too far into the weeds on Perl Lambdas (that's another blog post in the writing), suffice it to say I need to vendor Perl modules and deploy them in the Lambda environment. I briefly looked at carton and that may solve the problem neatly, but my early dive indicated to me that another path might be a more direct shot on goal and produce a cleaner Lambda deployment methodology.

Back to the issue at hand...specifically this blog is going to discuss Perl dependency checking using these tools:

scandeps.pl
Devel::Modlist
/usr/lib/rpm/perl.req

What's going on here?

What do you think the following lines print?

use feature 'say';
sub fmt { sprintf( @_[0, 1] ) }
my $num = 1_234_567_890.12_345_678_9;
say sprintf( '%.6f', $num );
say fmt( '%.6f', $num );

I think the two say lines should both print out the same value, 1234567890.123457. The first line behaves as expected, but the second does not. Does anybody have any idea on why?

Playing around with the code, I’ve figured out how to fix the issue, but I’m curious as to thoughts and explanations from the community.

p6env - Perl6 environment manager

Last year, I created yet another Perl6 environment manager, p6env. Speaking of Perl6 environment managers, I think everyone imagine rakudobrew. Yes, it is awesome.

Here are pros and cons of p6env:

  • Pros
    • p6env is one of the env family (rbenv, plenv, pyenv, etc.). So if you’re already familiar with them, you can use p6env even without any explanation.
    • You can easily write plugins for p6env. See, for example, https://github.com/skaji/p6env-update.
    • It can install rakudo-star distributions by default.
  • Cons
    • It does not support Windows.

Since I created p6env, I have been using it and like it. I hope you try it.

How to install p6env

Here, we assume you use bash as your default shell. If you use different shells, please read README at github instead.

RPerl in Paris - Part II

Hello everyone, and Happy New Year!

Previously, on "RPerl Around The World", the team was in Paris for a meeting with the Paris Perl Mongers, and then left for the London Perl Workshop.

We are now back in Paris for another meeting at the FPH building (Fondation pour le Progrès de l'Homme). Every Thursday, the FPH hosts a Linux technical meeting, providing a place for programmers to work on their various projects. Thanks to Emmanuel Seyman, we got to meet two of the Linux programmers, Stéphane Gigandet and Pierre Slamich. They work on a collaborative open source Perl project called Open Food Facts.

Open Food Facts is a food products database. It is a non-profit project meant to give as much information as possible to consumers regarding the food products they buy. The project was launched in 2012 by Stéphane Gigandet. You can learn all about it here: https://world.openfoodfacts.org/

This Paris meeting was an opportunity for us to learn about what Open Food Facts does, and for them to learn about RPerl and its possible use with their database platform.

openfoodfacts_logo.png

See you next year at 36c3!

Visitors of the 35th Chaos Communication Congress had a great time between Christmas and new year's eve and you're invited to be part of it next year at the 36th congress. As everybody seems to be pleased with the venue it will probably be from December 27th to 30th again in Leipzig, Germany.

Watch the recordings of this year's talks at media.ccc.de.

We were half a dozen Perl folks just saying hello at the assembly or making our space their home over all four days. Also there were many visitors who shared their past experiences with Perl (many good ones) or were eager to learn about Perl5 or Perl6.

IMG_20181230_103926650_HDR.jpg

In the picture you can see:

  • two tired but welcoming Perl hackers:-)
  • Camelia toys, education material and stickers for visitors
  • indispensable utilities for data travelers like a towel
  • in the background: light installations like the one from our friendly neighbors from Ruby-town

Is there anything wrong with this benchmark?

Class::Method::Modifiers versus $self->SUPER.

The exec summary is:

$ dumbbench perl test1.pl 
cmd: Ran 21 iterations (1 outliers).
cmd: Rounded run time per iteration: 2.0408e-02 +/- 3.6e-05 (0.2%)
$ dumbbench perl test2.pl 
cmd: Ran 22 iterations (2 outliers).
cmd: Rounded run time per iteration: 1.5050e-02 +/- 6.9e-05 (0.5%)

So Class::Method::Modifiers seems 30% faster. I'm guessing that this is the result of not having the subroutine overhead call on every invocation. Am I right? How does this work?

Top 15 Achievements in the year 2018

1) German Perl Workshop 2018

For the first time ever, I attended any Perl Workshop other than London Perl Workshop. I submitted 2 talks for the event and they both were accepted. I attended 2 days of the 3-days event and met so many great personality in one place. I made many friends for life. It would be unfair to name them here. They know who I am talking about.

2) Perl Weekly Newsletter

I joined the elite panel of co-editors of The Perl Weekly newsletter. I am proud to edit 17 editions in the year 2018.

3) Completed 1 year of daily uploads to CPAN.

Although I have done it earlier and went on to go over 1000+ days non-stop, still crossing 1 year mark was a big achievement after re-starting from zero due to the break in continuity, I blame on my holiday trip to India.

4) Perl.com

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.