This week in PSC (157) | 2024-08-23

Just Aristotle and Philippe this time (Graham chipped in on IRC):

  • we discussed the apostrophe situation: we will watch 5.41.3 break CPAN, and then evaluate the actual fallout. We like the idea of guarding this with a feature (which might need to be split in two, for the string interpolation case)
  • we had a long discussion about backwards compatibility and use VERSION. Should "did you use VERSION?" become the new "did you use strict and warnings?"

[P5P posting of this summary]

Second Batch of LPW 2024 Talks Accepted

Yep, that's right - the second half dozen talks have been accepted for this year's London Perl and Raku Workshop. This puts our schedule at approximately 80% full, so if you are thinking about talking at the workshop then submit your proposal now!

The CFP will be closed at the end of September to give speakers sufficient time to finish their presentations and to allow the schedule to be created. We encourage all attendees to mark talks they are interested in as that will inform some of the schedule choices.

If you aren't thinking about talking then have a think about what you've been doing in the Perl and/or Raku space the last five years, or even just the general IT and development space. Perhaps there's something interesting you can talk about? If you don't feel it's a full fat talk then submit a lightning talk instead.

The London Perl and Raku Workshop will take place on 26th Oct 2024. Thanks to this year's sponsors, without whom LPW would not happen:

If you would like to sponsor LPW then please have a look at the options here: https://act.yapc.eu/lpw2024/sponsoring.html

Caching & Memoization with state variables

Chapter 3 of Higher Order Perl describes various approaches to memoization of an expensive function: private cache and the Memoize module. The book was written in 2005 (Perl was at version 5.8 back then) , so it does not include another way for function caching that is now available : caching through state variables (introduced in Perl 5.10). The Fibonacci example considered in HOP also requires the ability to initialize state hash variables (available since Perl 5.28). The code below contrasts the implementation with a state variable v.s. the memoize module:

Perl Weekly Challenge 285: Making Change

These are some answers to the Week 285, Task 2, of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a few days from now (on September 8, 2024, at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 2: Making Change

Compute the number of ways to make change for given amount in cents. By using the coins e.g. Penny, Nickel, Dime, Quarter and Half-dollar, in how many distinct ways can the total value equal to the given amount? Order of coin selection does not matter.

A penny (P) is equal to 1 cent.
A nickel (N) is equal to 5 cents.
A dime (D) is equal to 10 cents.
A quarter (Q) is equal to 25 cents.
A half-dollar (HD) is equal to 50 cents.

This week in PSC (156) | 2024-08-15

Just Graham and Aristotle this time.

  • Discussed some patches to include in a perl 5.38 or 5.40 point release.
  • We will be watching the fallout from the removal of apostrophe as package separator.
  • Discussed what could be done for lexical method calls.

[P5P posting of this summary]

Equalise an Array

The Weekly Challenge 270/2

In the week 270, the second task was really interesting and difficult. Here’s a slightly reformulated version:

We’re given an array of positive integers @ints and two additional integers, $x and $y. We can apply any sequence of the following two operations: 1. Increment one element of @ints. 2. Increment two elements of @ints. The cost of each application of operation 1 is $x, the cost of operation 2 is $y. What’s the minimal cost of a sequence of operations that makes all the elements of @ints equal?

Why do I say it was difficult? I compared all the Perl and Raku solutions I could find in the GitHub repository and none of them gave the same results as mine. It took me several days to find an algorithm that would answer the tricky inputs I generated with a pen and paper, and one more day to optimise it to find the solutions in a reasonable time.

Perl Toolchain Summit 2024 in Lisbon

Last year at the Perl Toolchain Summit (PTS) in Lyon, I left three draft pull requests: one about the class declaration introduced in Perl 5.37, one about the PAUSE on docker, and one about multifactor authentication. I wanted to brush them up and ask Andreas König to merge some, but which should I prioritize this year?

# Perl Weekly Challenge 270: Special Positions

These are some answers to the Week 270, Task 1, of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a few days from now (on May 26, 2024 at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 1: Special Positions

You are given a m x n binary matrix.

Write a script to return the number of special positions in the given binary matrix.

A position (i, j) is called special if $matrix[i][j] == 1 and all other elements in the row i and column j are 0.

Example 1

This week in PSC (154) | 2024-08-01

This week, the whole PSC was in attendance.

We merged HTTP-Tiny#6, and then discussed a number of topics:

  • some improvements on the process for releasing blead-upstream dual-life modules are needed
  • the instructions for releasing a new Perl are difficult to follow and partly redundant, the process takes longer than it should, and more of it could be automated
  • the pumpkin permission list has grown over time, and probably needs to be trimmed
  • more talk about Markdown documentation
  • thoughts on how to strike a better balance with the verbosity/brevity of meeting minutes

First Batch of LPW 2024 Talks Accepted

Yep, that's right - the first dozen talks have been accepted for this year's London Perl and Raku Workshop. This puts our schedule at approximately 50% full, so if you are thinking about talking at the workshop then submit your proposal now!

If you aren't thinking about talking then have a think about what you've been doing in the Perl and/or Raku space the last five years, or even just the general IT and development space. Perhaps there's something interesting you can talk about? If you don't feel it's a full fat talk then submit a lightning talk instead.

The London Perl and Raku Workshop will take place on 26th Oct 2024. Thanks to this year's sponsors, without whom LPW would not happen:

If you would like to sponsor LPW then please have a look at the options here: https://act.yapc.eu/lpw2024/sponsoring.html

MariaDB 10 and SQL::Translator::Producer

Following up on my previous post (MariaDB 10 and Perl DBIx::Class::Schema::Loader), I wanted to try the 'deploy' feature to create database tables from Schema/Result classes.

I was surprised that I could not create a table in the database when a timestamp field had a default of current_time(). The problem was that the generated CREATE TABLE entry placed quotes around 'current_timestamp()' causing an error and rejected entry.

As mentioned in a previous post, I had created file SQL/Translator/Producer/MariDB.pm as part of the effort to get MariaDB 10 clients to work correctly with DBIx::Class::Schema::Loader. Initially it was a clone of the MySQL.pm file with name substitutions. To correct the current_timestamp problem I added a search/replace in the existing create_field subroutine in the MariaDB.pm file to remove the quotes.

Perl Weekly Challenge 269: Distribute Elements

These are some answers to the Week 269, Task 2, of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a few days from now (on May 19, 2024 at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 2: Distribute Elements

You are given an array of distinct integers, @ints.

Write a script to distribute the elements as described below:

1) Put the 1st element of the given array to a new array @arr1. 2) Put the 2nd element of the given array to a new array @arr2.

Once you have one element in each arrays, @arr1 and @arr2, then follow the rule below:

If the last element of the array @arr1 is greater than the last element of the array @arr2 then add the first element of the given array to @arr1 otherwise to the array @arr2.

When done distribution, return the concatenated arrays. @arr1 and @arr2.

This week in PSC (153) | 2024-07-25

After over a month without a PSC meeting, this was the first meeting of the new, shiny PSC. Today, we:

  • welcomed Aristotle, and said goodbye to Paul
  • discussed the current projects in flight, the PPC process and the onboarding tasks (preparing for next year already!)
  • talked about POD, docstrings, and the Perl release process

Parallel Perl/C applications without tears using OpenMP: Controlling the OpenMP environment

Brett Estrade, did it again with yet another excellent talk at TPRC 2024 about the use of OpenMP for parallelizing Perl/C code. This is an area that is extremely interesting as OpenMP is a rather straightforward way to parallelize code using simple compiler pragmas in Inline::C sections of code. Furthermore, as I discussed at TPRC2024, the combination of the Many Core Engine (MCE) and OpenMP allow the Perl user to endow a specific piece of code with both process and thread level parallelism, bleeding the hardware for performance without losing the benefits of Perl for high level coding.

Since this an area that may not be familiar to many users, I decided to start blogging about Perl/C parallel application programming at Killing It With Perl . The first post in this series is about a rudimentary control of the OpenMP environment , e.g. setting up the number and scheduling of the threads and you can read all about it here.

Making a Super Cal if Rage Will Stick Ex Paella Down Us

Something I am not good at

The paella must be possibly the worst national dish ever created, I thought to myself as I looked at the charred remains in my pan. It is as if the mind of some ancient Spanish conquistador, returned from his conquests abroad feeling hungry and unfulfilled, dreamt of bringing byriani to Spain, but in the midst of pillaging had forgotten to take culinary notes.

"How difficult can it be, Jose?" the weary warrior muses,
"Yeah, yeah, its just rice and meat, innit", says his Catalan colleague coming from the Spanish equivalent of Birmingham.
"We could use something flavourless, amorphous and chewy, like mussels, instead of meat",
"Whoaaah, nice,",
"And langoustines...",
"langa-what?",
"I know, right? Just throw them all in, don't bother shelling them",
"Raphael has some tomatoes he doesn't need for pelting passing pedestrians",
"Ahh...the flavours", fanning the flames as the smell of their concoction cooking brings back fond memories of far-away burning villages.

Perl Weekly Challenge 285: No Connection

These are some answers to the Week 285, Task 1, of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a few days from now (on September 8, 2024, at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 1: No Connection

You are given a list of routes, @routes.

Write a script to find the destination with no further outgoing connection.

Example 1

Input: @routes = (["B","C"], ["D","B"], ["C","A"])
Output: "A"

"D" -> "B" -> "C" -> "A".
"B" -> "C" -> "A".
"C" -> "A".
"A".

This week in PSC (147) | 2024-05-09

Just Graham and Paul

  • Reviewed the release-blockers label. Only two left, one is a documentation fix (PR22055)
  • Reviewed another documentation PR that should go in for 5.40 (PR22200)

Aside from that, things are looking good for making a 5.40 release at the usual schedule in May.

MariaDB 10 and Perl DBIx::Class::Schema::Loader

Fixing DBIx::Class::Schema::Loader For Use With MariaDB 10 Client Software

I recently set up a virtual Server Running Rocky Linux 9 as a client from which to query a remote MariaDB database. I used perlbrew to install Perl 5.38.2. I installed client related RPMs for MariaDB 10.5, I installed DBIx::Class as a relational mapper that can create Perl Schema Result Classes for each table in the database. If you are new to DBIx::Class, you can review its purpose and features in DBIx::Class::Manual::Intro. The Result Classes used by Perl to query the database are stored on the client server in a schema directory. They are created with the DBIx::Class::Schema::Loader module.

Perl Toolchain Summit 2024 - Lisbon

This year I was invited to the PTS conference in Lisbon as part of the CPAN Security group. Together we have been working on ways to improve the security of the Perl ecosystem. This was a great chance for members of the CPANSec group to meet in person, get to know each other better and discuss some of the items we have been working on lately. Welcome to Nicolas our newest member.

Perl Weekly Challenge 284: Relative Sort

These are some answers to the Week 284, Task 2, of the Perl Weekly Challenge organized by Mohammad S. Anwar.

Spoiler Alert: This weekly challenge deadline is due in a few days from now (on September 1, 2024, at 23:59). This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 2: Relative Sort

You are given two list of integers, @list1 and @list2. The elements in the @list2 are distinct and also in the @list1.

Write a script to sort the elements in the @list1 such that the relative order of items in @list1 is same as in the @list2. Elements that is missing in @list2 should be placed at the end of @list1 in ascending order.

Example 1

Input: @list1 = (2, 3, 9, 3, 1, 4, 6, 7, 2, 8, 5)
       @list2 = (2, 1, 4, 3, 5, 6)
Ouput: (2, 2, 1, 4, 3, 3, 5, 6, 7, 8, 9)

Example 2

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.