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 XIV (The Sun King)

Well carrying on with my quest to clean up the Paws S3 code I decided while I am waiting for my last batch of changes to be reviewed I decided to review some of the 'TODO' tests.

TODO passed: 6364, 6370, 7896, 10045, 10052, 10137

First a 'TODO' test is a stubbed in test that will most likely fail and if it does it will not effect the final Pass/Fail of test case. It is basically one of these

The first one I am going to play with is 's3-get-bucket-location.response.test.yml which looks like this

--- todo: 'S3 is not stable' call: GetBucketLocation service: S3 tests: - expected: EU op: eq path: LocationConstraint

So the first thing I did was chop off that 'todo' line;

--- --todo: 'S3 is not stable' call: GetBucketLocation service: S3 …

and then check the content in the '3-get-bucket-location.response';

--- content: | <?xml version="1.0" encoding="UTF-8"?> <LocationConstraint xmlns="http://s3.amazonaws.com/doc/2006-03-01/">EU</LocationConstraint> headers: [] status: 200

Data Science and Perl

Our company goes into many other companies and helps them build new Perl systems or fix old ones. Needless to say, we see how many companies work and a typical example is one of our clients I'll call "AlphaCorp." They use lots and lots of Perl. Their primary web site is almost entirely Perl. So when I went in to help them with their A/B testing (amongst other things), I was surprised that they also used a lot of Python. It turns out they had a specific need that Python fills and Perl does not: data science.

Because they hired so many Python developers to work in their data science area, they had more and more Python creeping into non-data science areas. Their Python devs didn't do much Perl and vice versa. Thus, while AlphaCorp said they'd rather not split themselves over multiple programming languages, they really had no choice. And that's a problem for Perl's future.

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.

London Perl Workshop: Gold Sponsor cPanel

It's Wednesday today, which must mean it is time to think about the weekend :-) If you are planning to come to the London Perl Workshop on Saturday, you might like to know that we'll be serving tea and coffee at registration from 9:15, with the first talk starting at 9:50. There will also be a mid-morning and mid-afternoon break with tea, coffee and some delicious snacks and all of this is only possible due to the support of our sponsors. Today we're saying thank you to cPanel - we are grateful to have them as a gold sponsor of LPW2019.

First released in 1997, cPanel & WHM is the leading web hosting control panel globally, and is preferred by most hosting service providers. Its users in an ever-growing user base prefer its familiar, feature-full, and simple interface. This interface can be used to build, manage and update a company's their entire online presence, from websites to email addresses.

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

Paws the VII (B4 and After)

Well I left off in my last post with having 2 of the 3 tests I created failed;

ok 10210 - Got _status eq 200 from result ok 10211 - Call S3->RestoreObject from t/10_responses/s3-restore-object.3.response not ok 10212 - Got request_id eq 195AF4042CD6DF80 from result

# Failed test 'Got request_id eq 195AF4042CD6DF80 from result'
# at t/10_responses.t line 136.
# got: 'AC65B3BF8AC3AA34'
# expected: '195AF4042CD6DF80'
not ok 10213 - Got message eq Object restore is already in progress from result

# Failed test 'Got message eq Object restore is already in progress from result'
# at t/10_responses.t line 136.
# got: 'Conflict'
# expected: 'Object restore is already in progress'
ok 10214 - Got code eq 409 from result

10213 was easy to fix I just had to change the test value in the test file 's3-restore-object.3.response.test.yml'

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?

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).

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";

Paws XIII (The Unlucky one)

I left off in my last post with all my bits and bods to get the proper structure in my generated perl class from the Json data. Now I have to get the 'status' out of the response and then into my class.

By now I know where to start to look to in the code to apply my changes. I started in Paws::Net::RestXMLResponse' class at its 'process' sub which looks at the response 'status' and takes either the error path (>=300) or the happy path (<300). We are interested in the happy path and that takes us to the 'response_to_object' sub.

First I can see that I have the 'status' very soon in the sub;

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.

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', '.';

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.

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

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)

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.

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.

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.