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).
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.
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:
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.
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'
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).
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.
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
Write a script to find the intersection of two straight lines. The coordinates of the two lines should be provided as command line parameter.
I vaguely remember we did the general form of the equation of a straight line at secondary school. The formula itself is pretty simple:
Ax + By + C = 0
Now, clearly, if we have two straight lines A1, B1, C1 and A2, B2, C2, their intersection are the x and y such that A1x + B1y + C = A2x + B2y + C2. From the general formula we know that
x = (-B1y - C1) / A1
It takes a bit of pen and paper work to find out that
Write a script to find the intersection of two straight lines. The co-ordinates of the two lines should be provided as command line parameter. For example:
The two ends of Line 1 are represented as co-ordinates (a,b) and (c,d).
The two ends of Line 2 are represented as co-ordinates (p,q) and (r,s).
The script should print the co-ordinates of point of intersection of the above two lines.
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
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
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
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.
The London Perl Workshop is a free event and we’re very grateful to our sponsors for making this possible. We would like to thank the following four awesome companies for their support of LPW2019 as our Silver Sponsors! Sign up for free to LPW2019 here.
Adestra
Here at Adestra we empower our clients to maximize marketing ROI through email-driven technology. Our flexible account structure, obsession with customer success, and award-winning service have gained the trust of global and growing brands alike. We’re proud to say we treat our people well: from excellent opportunities for career development to a positive, collaborative culture and great company perks, our global offices are a fantastic place to work at any stage of your career. As our client base continues to grow, we’re looking for talented individuals who share our values to come and grow their careers with us. With opportunities in the UK, Australia, and North America, now is an exciting time to join Adestra and become part of our global success.
Hacktoberfest 2019 is going to be the first event since the launch of the Perl Weekly Challenge. Dave Cross recently suggested doing Perl Weekly Challenge in the month of October would be enough to earn specially designed T-shirt from Digital Ocean.
I must confess, it didn't cross my mind. Thanks Dave Cross for the suggestions. Taking the cue from Dave Cross, I decided to blog about and share few tips.
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'
Create a script that accepts two strings, let’s call them “stones” and “jewels”. It should print the count of “letters” from the string “stones” found in the string “jewels”. For example, if your stones is “chancellor” and “jewels” is “chocolate”, then the script should print 8. To keep it simple, only A-Z, a-z characters are acceptable. Also, make the comparison case sensitive.
The most important thing is to realise that we only want to consider unique characters in the “stones”. My initial idea was for each character of the “stones” to count how many times it appears in the “jewels”. Remember that the global matching operator m//g returns the number of matches in list context.
Let’s call the subroutine with two names parameters, stones and jewels, each of them containing a string.
We’re kicking off our trailers for LPW 2019 with two talks that will improve the code you write!
Dave Cross will be talking about Measuring the Quality of your Perl Code. As Dave says, we'd all like to write "better" code, but how do you know what "better" means, and how do you know how well your current code scores on whatever scale you choose? His talk on the same topic was standing room only at TPC in Riga this year, so be sure to come along to learn about possible measures for the quality of your code and ways to incorporate these into your development process.
A spell of hacking around with Unicode got me wondering which version
of Unicode shipped with which version of Perl. Here's what I came
up with:
Perl version
Unicode version
5.7.3
3.1.1
5.8.0
3.2.0
5.8.1
4.0.0
5.8.4
4.0.1
5.8.7
4.1.0
5.8.9
5.1.0
5.9.4
4.1.0
5.9.5
5.0.0
5.10.1
5.1.0
5.11.3
5.2.0
5.13.7
6.0.0
5.15.8
6.1.0
5.17.1
6.2.0
5.19.5
6.3.0
5.21.1
7.0.0
5.23.0
8.0.0
5.25.3
9.0.0
5.27.2
10.0.0
5.29.2
11.0.0
5.29.9
12.0.0
5.29.10
12.1.0
This table is in order by Perl version (obviously), and lists every
time the Unicode version changed as Perl version increased. Unicode
version does not increase monotonically with Perl version because
Unicode 5.1.0 was retrofitted to Perl 5.8.9, which was actually released
after 5.10.0.
The Unicode version numbers come from file
lib/unicore/version under the top-level directory in each
distribution, where it has been since Perl 5.7.3.