This week in PSC (114) | 2023-08-31

This week, we talked about:

  • the recent quietness of the perl5-porters list
  • PPC 0013 and the use of a lexical feature (join_with_concat) to enable concat magic
  • inclusion of stringify (OP_STRINGIFY) and numify functions in the builtin namespace
  • turning the UNIVERSAL::import deprecation warning into a regular warning so as not to imply a removal timescale

TPRC Toronto Part 2

Well end of day two here and had a nice walk and a nice chat with one of the local city counselors who was out glad handing I asked her when the Gardiner Express Way will be fixed up. She said by Christmas ;)

That was a Local joke now onto what I got up to today.

Ovid despite Air Frances best efforts actually did make in to the conference late the night before so he was able to give his Keynote on OO in the Perl Core, Seems we will be getting something called Corinna Soon we will have Field, Class, Role and Method to play with and if you are brave you can get the latest version of perl and play with a few parts of it. The key sticky part is Typing, Seems there is another project out there called Oshum to handle all those nasty typing problems. Well to quote the main character Sweden's best know literature

'We shall see, what we shall see'

Perl Weekly Challenge #224 - Passing Notes

Hi everybody! Just doing one challenge again this week. Time limitations hold me back once again.

This week we're looking for the letters of a target word in a source word, and we're not allowed to use the same letter twice. Spoiler alert because it's only Wednesday and you still have the rest of the week to submit solutions if desired.

The easiest way to do this is with a dictionary hash initialized like so:

foreach (split //, $source) {$chars{$_}++}

Many people use map() to do this, but I'm not a big fan of map in many cases because I feel it makes code less readable.

This gives us the number of occurrences of each letter in the original word.

Then we iterate through the target word and look for (and remove) the letters in the dictionary:

Perl Weekly Challenge 262: Count Equal Divisible

These are some answers to the Week 262, 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 March 31, 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: Count Equal Divisible

You are given an array of integers, @ints and an integer $k.

Write a script to return the number of pairs (i, j) where

a) 0 <= i < j < size of @ints

b) ints[i] == ints[j]

c) i x j is divisible by k

Example 1

This week in PSC (113) | 2023-08-24

The three of us met today, and we:

  • updated the status of stalled PPCs (after discussion with the proposers)
  • assigned a number (0023) to the map my $x { } PPC
  • discussed the evaluation order issue related to PPC 0021 (optional chaining)
  • decided that future rejected PPCs should have a section that details why they were rejected
  • discussed the tooling around the publication of dual-life modules on CPAN

Cloud Provider Price Performance Comparison: Spot VMs

In my recent Cloud Comparison, I mentioned that I'd look at Spot VM pricing in an update. This is the update - 6 out of the 10 providers tested offer Spot/Preemptible instance pricing.

At SpareRoom we make some good use of Spot VMs. E.g. our perl test suite gets to run on fast VM types at very low cost: currently we are using c3-highcpu-22 instances which normally come at $0.95/hour each. The spot pricing for them is more than 10x lower, at just $0.086/h. At these prices, if our test suite needed it (it's already fast), we'd be able to launch c3-highcpu-176 (176 vCPUs) at well under $1/h!

Celebrate Perl 5.38 with Limited Edition merch!

2.png

To celebrate the upcoming release of Perl 5.38 we are excited to offer Limited Edition* merchandise.

The design was a true team effort by the marketing committee and is inspired by the traditional Perl camel logo. We had a lot of fun throwing around ideas, then throwing them in to AI to see what it's randomness would come back with. We then passed the ideas to our artist for the final result.

Check them out on the official Perl store where proceeds go to The Perl and Raku Foundation which then directly fund grants etc.

* TBD how limited.

Perl Weekly Challenge #222 - Checking Against My List of Members

Hi everybody! Just doing the first weekly challenge task again this week. This week we're sorting a list of numbers and then checking whether the number matches the same position in the unsorted list. It's a very simple challenge and easily written in about 4 actual lines of clean code.

Here's the code:

#!/usr/bin/perl
use strict;
use v5.24;
my @sorted = sort @ARGV;
my $matches;
for (my $i = 0; $i <= $#ARGV; $i++) {$matches++ if $ARGV[$i] == $sorted[$i]}
say $matches // 0;

This week in PSC (112) | 2023-08-17

This week, for its first meeting, the new PSC:

  • discussed the nature of typing systems for Perl and what properties we find desirable vs not
  • worked out a release schedule for the next few months of devel releases
  • reviewed the PPC Tracker document. A few are now done, the rest need remainder nudge emails to their respective proposers

Perl Weekly Challenge 222: Matching Members and Last Member

These are some answers to the Week 222 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 June 25, 2023 at 23:59). This blog post offers some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 1: Matching Members

You are given a list of positive integers, @ints.

Write a script to find the total matching members after sorting the list increasing order.

Example 1

Profiling Perl under Apache

At SpareRoom we still use Apache/mod_perl and, despite Devel::NYTProf::Apache's warnings about it not being maintained, it is still the best way for profiling Perl.

All you need to do really, for a mod_perl app, is to include this in your Apache config:

PerlPassEnv NYTPROF # Not needed for default settings.
PerlModule Devel::NYTProf::Apache

You should also allow a single worker/child, and make sure it terminates cleanly before processing the output (nytprofhtml).

Since I want my dev/test environments to normally run with multiple workers and no profiler attached, I have a bash alias that exits apache and restarts it set-up for profiling. I thought I'd share an example of that, as I find it very useful.

First, a basic example pulled from what I used on our older CentOS/RedHat VM:

“Let Maintainers Be Maintainers”

Graydon Hoare:

[…] Corporate-employed FOSS maintainers working at a firm with these [very common] “growth and novelty” incentives [… are] in a position where their job performance is very likely to be evaluated in terms of visible growth and novelty (it might be dressed up in more abstract terms like “real-world impact” or “visibility” but it still means the same thing) even though that is exactly the wrong thing for the health of the project they’re maintaining.

I’m excerpting the gist of his article here but actually I suggest reading all of it. It’s not very long but gives flesh to this skeleton argument.

It doesn’t help that what he is talking about isn’t limited to employed maintainers; profit is not the only growth incentive structure that can lead to this novelty mindset, so this can exist entirely outside commercial context.

This week in PSC (111) | 2023-08-11

Today was PSC 111 — what happened to 110 you ask? Well, it was a bit of a non-meeting a few weeks ago. Nothing to say about it, sorry!

This week, we:

  • Said hello to Graham and goodbye to Rik
  • We did a bunch of handover, making sure we set up a new Zoom meeting and calendar, and talking about our usual order of business

In more normal business, we:

  • talked about the future of use vX, especially related to builtin:: stuff — do we want “use v5.40” to import “builtin::refaddr” for example
  • talked about what we’re going to do with the UNIVERSAL::import changes so we can move it forward toward someday making it fatal but without breaking half of CPAN at once

Well Back in the Saddle again.

Finally have a chance to go to a North American Perl event, so after nearly 4 years since my last Perl event, thanks Covid 19 I managed to make my way down from the Ivory Tower in Ottawa to the 'Big Smoke', 'Hogtown', Queen City, TO or as most of the rest of the world knows it Toronto.

So there are about 100 us us Perl types here today, with most participants coming from across the US and Canada but there are a few that came over 'The Big Pond'

So far The talks have been very good, I had a and interesting Talk on Test2 by Chad Granum something I will have to look into as my old test suite is becoming a little flimsy and is a patchwork of kludges,

Perl Weekly Challenge 262: Max Positive Negative

These are some answers to the Week 262, 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 March 31, 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: Max Positive Negative

You are given an array of integers, @ints.

Write a script to return the maximum number of either positive or negative integers in the given array.

Example 1

Input: @ints = (-3, 1, 2, -1, 3, -2, 4)
Output: 4

Count of positive integers: 4
Count of negative integers: 3
Maximum of count of positive and negative integers: 4

Example 2

TWC 220: Squared Shoulders

In which we move beyond Perfect Permutation.

Perl Weekly Challenge #220 - I've Seen These Characters 'Round These Parts

Hi everybody, just a quick one this week. Again it's been a very busy week, so I wrote this one quick to print the sorted list of all common characters in all the words provided. That's the simple explanation of this week's challenge.

Here's the code:

my @results;
my $first_word = shift;
for my $letter (split(//, $first_word)) {
    push(@results, lc($letter)) if (grep {$_ =~ /$letter/i} @ARGV) == @ARGV;
}
@results = sort @results;
say $_ foreach @results;

This week in PSC (109) | 2023-06-09

Today’s PSC call was another pretty short one.

  • We agreed on the change HTTP::Tiny, our last blocker, and hope to have RC1 tomorrow.
  • There are a few minor notes on the RC0 status on p5p, which need addressing. Nothing major.
  • We discussed the things we need to do to arrange the next PSC election, scheduled for post-v5.38.0.
  • We discussed libperl.t, which fails on newest macOS+Xcode even in stable. It’s fixed in blead, and we should fix maint-5.36, too

Perl Weekly Challenge 261: Multiply by Two

These are some answers to the Week 261, Task 2, 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 (on March 24, 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: Multiply by Two

You are given an array of integers, @ints and an integer $start.

Write a script to do the following:

a) Look for $start in the array @ints, if found multiply the number by 2

b) If not found stop the process otherwise repeat

In the end return the final value.

Example 1

MooseX::Extended versus the debugger

I've released MooseX::Extended 0.35 and it resolves a long-standing bug. If you tried to use multi subs, it would trigger this bug in Syntax::Keyword::MultiSub. To fix that, you had to manually patch the latter module:

--- old/lib/Syntax/Keyword/MultiSub.xs  2021-12-16 10:59:30 +0000
+++ new/lib/Syntax/Keyword/MultiSub.xs  2022-08-12 10:23:06 +0000
@@ -129,6 +129,7 @@
 redo:
     switch(o->op_type) {
       case OP_NEXTSTATE:
+      case OP_DBSTATE:
         o = o->op_next;
         goto redo;

Not good. However, Syntax::Keyword::MultiSub 0.03 has been released with that patch included, so that's a relief.

However, I was still struggling with switching WebService::OpenSky to MooseX::Extended but under the debugger, we have a serious problem.

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.