London Perl Workshop: Gold Sponsor Perl Careers

Following a full day of two talk tracks we're happy to say there will be not one, but two after event opportunities to chat with your fellow LPW attendees. The first will be drinks at the event until 19:15, featuring (among other things) craft beer brewed right here in London!

As with everything else, this wouldn't be possible without our sponsors and so we'd like to thank Perl Careers, a long time supporter of LPW for their gold sponsorship.

Perl Careers and it’s buddy CareersJS are a technical focused recruitment consultancy, run by a CPAN & npm contributor with a recruitment background, rather than by a non-technical person. I can understand the skills you're looking to hire for, make sense of your GitHub profile, and offer specific Perl-related career and salary advice. I am very picky about only recruiting for companies I'd want to work at, and placing candidates who I'd want to work with. I'd love to talk to you if you think you might be either.

Paws XII (High Noon Dog)

In my last post I was just getting the last parts of my new 'Satus' attribute in place having only one more part to create and that is a new 'trait' in '/lib/Paws/API.pm'

I was thinking af starting by coping the present package;


package Paws::API::Attribute::Trait::NameInRequest;
  use Moose::Role;
  use Moose::Util;
  Moose::Util::meta_attribute_alias('NameInRequest');
  has request_name => (is => 'ro', isa => 'Str');

and just changing the 'Request' for 'Response'. However looking at the role I see it is also adding a 'request_name' attribute, which I do not need, this trait is used very specially in the code the name of AWS call.

Perl Weekly Challenge 029: Brace expansion and calling a C function

Brace expansion

Write a script to demonstrate brace expansion. For example, the script would take the command line argument Perl {Daily,Weekly,Monthly,Yearly} Challenge and should expand it and print like below:
Perl Daily Challenge
Perl Weekly Challenge
Perl Monthly Challenge
Perl Yearly Challenge

You’ve probably heard about the glob function. It can expand wildcards like * or ?, so you e.g. can easily check what files correspond to p*.p?. But glob can do one more thing for us: brace expansion.

Perl Weekly Challenge 29: Brace Expansion and Calling C Code

These are some answers to the Week 29 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Challenge # 1: Brace Expansion

Write a script to demonstrate brace expansion. For example, script would take command line argument Perl {Daily,Weekly,Monthly,Yearly} Challenge and should expand it and print like below:

Perl Daily Challenge
Perl Weekly Challenge
Perl Monthly Challenge
Perl Yearly Challenge

The specification is not very detailed, and we will not attempt to provide a full-fledged templating system, as this already exists. So we will limit our implementation to the following: an initial sentence fragment, followed by a single list of options between curly brackets, followed by a final sentence fragment.

Brace Expansion In Perl 5

London Perl Workshop: Gold Sponsor CV-Library

The London Perl Workshop is this Saturday and if you haven't signed up yet, there is still time! We have just published the talk schedule and it is going to be an informative and fun day.

We'd like to thank our sponsors who make it possible for the event to be free to attend, and repeat sponsors such as CV-Library are awesome as they mean we can make the event even better, year on year.

Founded in 2000 and written in Perl since the beginning, CV-Library is the UK's leading independent job board with over 4.3 million unique visitors a month.

CV-Library is proud to be a long time sponsor of LPW and supporter of the Perl community, hosting London.pm technical meetings and contributing code back to CPAN (check our out CPAN and GitHub accounts).

Paws XI - III (back we go)

I finally had a response to my question from this post about adding a new attribute '_status' to the auto-generated classes that Paws creates;

I'd try to avoid leaking HTTP details to the user by default. It's true that for this API call the HTTP Status is relevant to the caller, so exposing it seems legit. I'd try to limit the scope of exposing the HTTP return status by adding an attribute role like https://github.com/pplu/aws-sdk-perl/blob/master/lib/Paws/API.pm#L1 that signal the response to object routines to copy the HTTP Status over to an attribute.

Ok now to translate that to something that the non-Paw dev can understand.

Don't do that! It is not a good idea to expose too much of the response from AWS. However, this is a legitimate use case so an 'attribute role' to expose the status.

Larry has approved renaming Perl 6 to raku

Via this comment, Larry has said:

I am in favor of this change, because it reflects an ancient wisdom:

"No one sews a patch of unshrunk cloth on an old garment, for the patch will pull away from the garment, making the tear worse. Neither do people pour new wine into old wineskins. If they do, the skins will burst; the wine will run out and the wineskins will be ruined. No, they pour new wine into new wineskins, and both are preserved."

Unsurprisingly, it's a Biblical quote.

But what does this mean?

SPVM Example - sum even numbers with precompiling.

I released SPVM 0.0441 today.

Sum even numbers with precompiling

SPVM is Static Perl Virtual Machine. I write an example to sum even numbers with precompiling.

Using precompiling, the source code is output to C source code and it is compiled to machine code. This performance is same as C language in add operation! You are surprised.

use strict;
use warnings;

use FindBin;
use lib "$FindBin::Bin/lib";

use SPVM 'Even';

my $nums = [1, 3, 6, 8, 14];

my $even_sum = Even->even_sum($nums);

print "$even_sum\n";

Whither Stratopan?

Anyone have information on the current and future status of Stratopan?

Still marked a "Beta", the latest perl version is stuck on 5.27.2, the blog.stratopan and cpan.stratopan http sites error, and the https version redirect back to www.

Paws X (Well not XXX)

I had my response from my question up in github.

If I am remembering correctly we are throwing an exception because at some point in time AWS has returned invalid XML on non-200 responses (the test suite tries to covers more cases). The error message was too cryptic when invalid XML came in, so we started to throw a Paws::Exception that at least gives you an indication of what went on.

Hmm ok so the test case might be valid though I do not see how that is a problem for Paws if AWS is returning invalid XML.

Taking a peek about at what else does a 'throw' vs a 'new' Paws::Exception I found that all of the classes in 'lib/Paws/Net' that have a 'unserialize_response' sub use 'throw' vs 'new' except for one 'Paws::Net::RestXMLResponse'

Perl Weekly Challenge 28: File Type and Digital Clock

These are some answers to the Week 28 of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a couple of days from now (October 6, 2019). This blog post offers some solutions to this challenge, please don't read on if you intend to complete the challenge on your own.

Challenge # 1: File Type

Write a script to check the file content without explicitly reading the content. It should accept file name with path as command line argument and print “The file content is binary.” or else “The file content is ascii.” accordingly.

Perl Weekly Challenge 028: File Content and Digital Clock

File Content

Write a script to check the file content without explicitly reading the content. It should accept file name with path as command line argument and print “The file content is binary.” or else “The file content is ascii.” accordingly.

Frankly, I had no idea how to solve this. I had to google the solution, and I was quite surprised Perl had the operators designed for exactly this purpose. During my approximately 20 years of Perl programming, I’ve never needed the -T and -B operators—probably because all my scripts and programs expect either a text or a binary file as the input, and it’s upon the user to provide it in the expected format.

#!/usr/bin/perl
use warnings;
use strict;
use feature qw{ say };

say 'The file content is ', (-T shift) ? 'ascii' : 'binary', '.';

309 ways to do $A++ in Perl

Here is a list of 309 code examples how to increment variable in Perl.

I think that is it very funny, creative and awful at the same time.

As far as I can see, not all code examples are working and not every one is interesting, but some of the solutions are truly magical.

Here is one example created by Maddingue:

#!/usr/bin/perl

eval((map{s/^./\$/,s/ //g;$_}(split"$/",<<'')[-1])[0]);
     A
    A A        +       +
   A   A       +       +
  AAAAAAA   +++++++ +++++++
 A       A     +       +
A         A    +       +;

print $A;

Here is the full list: https://squareperl.com/en/lots-of-ways-to-increment-variable

Paws The IX (Not Quite X)

I am getting close to finishing off my first Paws patch.

I left off with this test failing

not ok 27 - got exception # Failed test 'got exception' # at t/11_client_exceptions.t line 104. # expecting: Paws::Exception # found: Moose::Exception::ValidationFailedForTypeConstraint (Attribute (host_id) does not pass the type constraint because: Validation failed for 'Str' with value undef at /wwwveh/lib/x86_64-linux-thread-multi/Moose/Meta/Class.pm line 275 # Moose::Meta::Class::new_object at (eval 429) line 28 # Throwable::Error::new at /home/scolesj/aws-sdk-perl/lib/Paws/Net/RestXMLResponse.pm line 60 # Paws::Net::RestXMLResponse::error_to_exception at /home/scolesj/aws-sdk-perl/lib/Paws/Net/RestXMLResponse.pm line 25 # Paws::Net::RestXMLResponse::process at /home/scolesj/aws-sdk-perl/lib/Paws/Net/FurlCaller.pm line 48 # Paws::Net::FurlCaller::caller_to_response at /home/scolesj/aws-sdk-perl/lib/Paws/Net/MockCaller.pm line 116 # Paws::Net::MockCaller::caller_to_response at /home/scolesj/aws-sdk-perl/lib

...

WIP Rakudo.js Final Grant Update

THIS IS A WIP REPORT - SOME RELEASE ARE BEING MADE ATM


We have a Dart Pad inspired REPL called 6Pad that allows you to play with Rakudo.js without installing it

Rakudo.js has been released on NPM as rakudo

You can get a prebuilt rakudo.js from npm with a single command


npm install rakudo

I have decided not to upload the rakudo.js tarballs to CPAN (while easily doable if anybody actually want to get it from there it seems nobody would benefit from that as it seems getting it from npm will be just more convenient for everyone).

# We pass our chosen subset of roast tests in headless Chrome using puppeteer

We have a repo with a test runner that bundles up the tests using the parcel bundler and passes them to Chrome

Skipping DateTime::Format::Mail in the Pull Request Club

I was assigned DateTime::Format::Mail for September in the Pull Request Club. There was one open issue in its GitHub repository, so I hoped solving it would be my pull request for the month.

The reporter complained the module fails to parse the following e-mail header:

Date: Wed, 10 Jul 2019 11:20:02 +0200 (CEST)

Monthly Report - September

What did I do last month? Let me guess, the short answer would be "I was managing Perl Weekly Challenge". Although it sounds so simple, it is tough task, I must admit. Having said that, I really enjoy it. I get to interact with so many great people and learn from their experience. Above all, when I receive "Thank You" message, that takes away all the pain. I simply love the positive vibes I get from each and every member of the community.

I noticed a trend in "Perl Weekly Challenge", members now trying different languages as well. Python is one such where we have had more than one solutions. If you want to know what others are doing, please do check out the blogs. Also please do follow us @PerlWChallenge, so that you don't miss out any announcements. On top of that, members discuss task as well.

Paws The VIII (The Henry Factor)

Ok today I am going to look a the impact my changes from the last few post have had on the systems as a whole. So far I have tinkered with a few things

  1. Got my RestoreObject to work
  2. Modified the Botocore S3 json file to add in some documentation
  3. I added code to get the 'resopnse' status back by modifying both the code generation templates and the Paws/lib code
  4. Expanded on the test suite
  5. I fiddled with the S3 json file to see if I can get correct error to come up. I did roll this back as Paws does not use these
  6. Created a new test and then modified the paws lib code to get what I think is the correct response back from Paws when there is an error returned by the server
  7. Started to work on the tests I broke with my changes

So today I am going to see what I else I have broken since I have started.

I started to write "Perl Philosophy" lately

I started to write "Perl Philosophy" lately.

Perl Philosophy

This site is intended to convey Perl philosophy to Perl users.

It also allows Perl users to talk about Perl philosophy.

Perl has long been hurt by dirty words.

Let's tell the value of Perl to a new generation.

Rakudo.js Final Grant Update

We have a Dart Pad inspired REPL called 6Pad that allows you to play with Rakudo.js without installing it.
We have a step by step tutorial how to get your code running in Rakudo.js

You can see an example that uses a canvas to draw a spaceship at https://perl6.github.io/6pad/#5a889cc9d6385853af2ff6a3fa165662

6pad has been used in the Perl 6 advent calendar demonstrating that it's usable by community members not directly working on rakudo.js

Rakudo.js has been released on NPM as rakudo
The Rakudo.js backend has been fully merged into the master branches of rakudo and NQP

Look at the Rakudo NPM page for information on how to use it.
The NPM package release process is fairly complex. But a repo yarn workspace helps set everything up.

For deploying Perl 6 in the browser we have a Parcel plugin parcel-plugin-nqp.
The plugin will be upgraded to Parcel 2 once that has a non-alpha relase (or maybe even sooner).

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.