Smart Match in CPAN

blogs.perl.org

Published by Tom Wyant on Thursday 30 June 2022 04:15

There is nothing like looking, if you want to find something. -- The Hobbit, iv, "Over Hill and Under Hill"

Recently on the p5p mailing list the topic of removing smart match re-surfaced. There was a fairly vigorous discussion about the effect this would have on CPAN. So I thought I would look into how many uses there actually were.

Fortunately there are Perl Critic policies for this: Jan Holčapek's Perl::Critic::Policy::ControlStructures::ProhibitSwitchStatements and Perl::Critic::Policy::Operators::ProhibitSmartmatch. All I had to do was run them against my mini-CPAN.

My results:

  • Total distributions: 40704
  • Distributions with violations: 842
  • Files with violations: 1568

A look at the file names involved says that about two-thirds of the violations are in the published modules themselves, and the rest are in support code (directories t/, inc/, and the like).

It is possible that the results of Perl::Critic::Policy::ControlStructures::ProhibitSwitchStatements contain false positives simply because someone implemented subroutines named given() or when() unrelated to smart matching.

It is hard for me to see how there could be false positives from Perl::Critic::Policy::Operators::ProhibitSmartmatch, though I have learned long since that reality exceeds my ability to imagine it.

Given the nature of Perl, false negatives may have to be detected on a case-by-case basis. I do know that when smart match was briefly removed in a development release a few years back only one module that I use broke, and I had an alternative for it.

The mini-CPAN repository used for analysis was most recently updated 2022-06-24 08:10Z. The configuration file is

remote: https://www.cpan.org/
local: <censored>
exact_mirror: 0
skip_perl: 1
dirmode: 0755
path_filters: /Mail-DeliveryStatus-BounceParser-\d

I have unpublished modules in this repository, but they were excluded from the analysis. Also excluded were a few other modules that I have had trouble running Perl Critic against in the past:

CMORRIS/Parse-Extract-Net-MAC48-0.01.tar.gz
DOLMEN/Number-Phone-FR-0.0917215.tar.gz
GSLONDON/Parse-Nibbler-1.10.tar.gz

A list of the distributions containing violations is at https://trwyant.github.io/misc/smart-match-in-cpan/distros-with-violations.txt.

An ugly JSON file containing the results of the critique is at https://trwyant.github.io/misc/smart-match-in-cpan/smart-match.json. By "ugly" I mean non-pretty, non-canonical. This file encodes a hash whose top-level keys are:

  • asof - The ISO time the analysis was run;
  • critique - A hash reference containing the results of the critique (see below);
  • policy - An array reference containing the fully-qualified names of the policies used to critique the code.

The critique is a set of nested hashes keyed by author name, distribution name, and file name relative to the base directory of the distribution. The value for each file is a reference to an array containing the the violations for that file: line number, column number, policy violated, violation description, and violation explanation. For brevity's sake files without violations are omitted from the output.

cpanfile – Teil 1

Perl-Academy.de

Published on Wednesday 29 June 2022 10:00

Ein *cpanfile* ist eine Datei, die Abhängigkeiten von Anwendungen und Modulen beschreibt. Diese Dateien sind in der Perl-Welt nichts neues (sie gibt es seit über 8 Jahren) und sie sind eine sehr gute Möglichkeit, die Installation von Abhängigkeiten zu vereinfachen.

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

Spoiler Alert: This weekly challenge deadline is due in a few of days from now (on July 3, 2022 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: Abundant Numbers

Write a script to generate first 20 Abundant Odd Numbers.

According to wikipedia,

A number n for which the sum of divisors σ(n) > 2n, or, equivalently, the sum of proper divisors (or aliquot sum) s(n) > n.

For example, 945 is the first Abundant Odd Number.

Sum of divisors:
1 + 3 + 5 + 7 + 9 + 15 + 21 + 27 + 35 + 45 + 63 + 105 + 135 + 189 + 315 = 975

Reading that the first odd abundant number is 975, I was a bit afraid that we would have to dig into very large numbers to find the first 20 ones, but this turned out not to be the case.

Abundant Numbers in Raku

The is-abundant subroutine lists all the proper divisors of the input parameter and checks whether their sum is larger than the input integer. Then, we just loop over each odd integer (using the 1, 3 ... Inf lazy sequence operator) and display it if it in abundant. And we stop when we reach 20 of them.

sub is-abundant (Int $n where * > 0) {
    my @divisors = grep {$n %% $_}, 1..$n/2;
    return @divisors.sum > $n ?? True !! False;
}
my $count = 0;
for 1, 3 ... Inf -> $n {
    if is-abundant $n {
        say $n;
        last if ++$count >= 20;
    }
}

This program displays the following output:

$ raku ./abundant.raku
945
1575
2205
2835
3465
4095
4725
5355
5775
5985
6435
6615
6825
7245
7425
7875
8085
8415
8505
8925

Abundant Numbers in Perl

This is essentially a port to Perl of the above Raku program. The only significant differences is that we implement our own sum subroutine and iterate manually over odd integers.

use strict;
use warnings;
use feature "say";

sub sum {
    my $sum = 0;
    $sum += $_ for @_;
    return $sum;
}
sub is_abundant {
    my $n = shift;
    my @divisors = grep {$n % $_ == 0} 1..$n/2;
    return sum(@divisors) > $n ? 1 : 0;
}
my $n = 1;
my $count = 0;
while ($count < 20) {
    if (is_abundant $n) {
        say $n;
        $count++;
    }
    $n += 2;
}

This program displays the following output:

$ perl  ./abundant.pl
945
1575
2205
2835
3465
4095
4725
5355
5775
5985
6435
6615
6825
7245
7425
7875
8085
8415
8505
8925

Task 2: First-class Function

Create sub compose($f, $g) which takes in two parameters $f and $g as subroutine refs and returns subroutine ref i.e. compose($f, $g)->($x) = $f->($g->($x))

e.g.

$f = (one or more parameters function)
$g = (one or more parameters function)

$h = compose($f, $g)
$f->($g->($x,$y, ..)) == $h->($x, $y, ..) for any $x, $y, ...

There are some problems with this task specification. First, it doesn’t say what we should do, but more or less how it should (probably) be done in Perl. I usually do my first implementation of a challenge task in Raku, and it would make little sense to implement the provided pseudo-code in Raku.

The second problem is that, when composing functions, you can’t have just any random number of parameters. The arity (number of parameters) of the second function must usually match the number of values returned by the first one. I’ll deal primarily with examples of functions taking one parameter, but will also show an example with variadic functions.

First-Class Function in Raku

Raku has the infix:<∘> (ring) or infix:<o> function composition operator, which combines two functions, so that the left function is called with the return value of the right function.

We could use this operator directly, but since we are asked to write a compose subroutine, we’ll carry out the extra step of creating such a subroutine.

sub f($n) { $n / 2 + 1}
sub g($n) { $n * 2 }
sub compose (&h1, &h2) {
    &h1 ∘ &h2; # h1 will be called with the return value of h2
    # could also be written: &h1 o &h2;
}
my &composed = compose(&f, &g);
say composed 2;

This script displays the following output:

$ raku ./first-class.raku
3

Our compose subroutine will also work with variadic input functions (taking a variable number of arguments). For example, here, we use a triple subroutine multiplying by 3 the items of a list of integers and a concat subroutine concatenating the resulting integers into a string (with a _ separator):

sub concat { join "_", @_}
sub triple { map {$_ * 3}, @_ }
sub compose (&h1, &h2) {
    &h1 ∘ &h2; # h1 will be called with the return value of h2
}
my &composed = compose(&concat, &triple);
say composed <2 4 6 8>;

This generates the following output:

$ ./raku first-class_2.raku
6_12_18_24

First-Class Function in Perl

Here, the compose subroutine is a function factory that takes two subroutine references as input parameters and returns an anonymous subroutine reference combining the two input subroutines.

use strict;
use warnings;
use feature "say";

sub f { shift() / 2 + 1}
sub g { shift() * 2 }


sub compose {
    my ($f, $g) = @_;
    sub {
        $f -> ($g -> (@_))
    };
}
my $composed = compose( \&f, \&g);
say $composed->(2);

This script displays the following output:

$ perl ./first-class.pl
3

Our compose subroutine will also work with variadic input functions (taking a variable number of arguments). For example, here, we use a triple subroutine multiplying by 3 the items of a list of integers and a concat subroutine concatenating the resulting integers into a string (with a _ separator):

use strict;
use warnings;
use feature "say";

sub concat { join "_", @_}
sub triple { map $_ * 3, @_ }

sub compose {
    my ($f, $g) = @_;
    sub {
        $f -> ($g -> (@_))
    };
}
my $composed = compose(\&concat, \&triple);
say $composed->(qw/2 4 6 8/);

This script displays the following output:

$ perl  first-class_2.pl
6_12_18_24

Wrapping up

The next week Perl Weekly Challenge will start soon. If you want to participate in this challenge, please check https://perlweeklychallenge.org/ and make sure you answer the challenge before 23:59 BST (British summer time) on July 10, 2022. And, please, also spread the word about the Perl Weekly Challenge if you can.

How to Write Tests using Github Actions

dev.to #perl

Published by Yuki Kimoto on Tuesday 28 June 2022 06:25

I explain how to write tests using Github Actions. This tests are run on Windows, Linux/Ubuntu(64bit, 32bit), Mac, and support Perl 5.8. Dependent CPAN modules can be used.

This article is originally How to Write Tests using Github Actions - Perl ABC

Examples of Tests using Github Actions

See examples at first.

Examples

Downloading cpanm

Download cpanm into your home direcotry of your product and add excutable permission to it.

curl -L http://cpanmin.us > cpanm
chmod +x cpanm

Github Actions Definitions

These are Github Actions.

Linux - Ubuntu - 64bit*Ubuntrulinux-ubuntu-latest.yml*

name: linux-ubuntu-latest

on:
  push:
    branches:
      - '*'
    tags-ignore:
      - '*'
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - run: perl -V
      - run: perl -MConfig -MData::Dumper -e 'local $Data::Dumper::Sortkeys = 1;warn Dumper \%Config;'
      - run: perl cpanm -L ~/mylib -n SPVM
      - run: echo "PERL5LIB=$HOME/mylib/lib/perl5/"$(perl -MConfig -e 'print $Config{archname}') >> $GITHUB_ENV
      - run: perl Makefile.PL
      - run: make
      - run: make disttest

Linux - Ubuntu - 32bit

linux-ubuntu-latest-32bit.yml

name: linux-ubuntu-latest-32bit

on:
  push:
    branches:
      - '*'
    tags-ignore:
      - '*'
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: i386/ubuntu:latest
    steps:
      - run: |
          apt update
          apt install -y libperl-dev build-essential
      - uses: actions/checkout@v1
      - run: perl -V
      - run: perl -MConfig -MData::Dumper -e 'local $Data::Dumper::Sortkeys = 1;warn Dumper \%Config;'
      - run: perl cpanm -L ~/mylib -n SPVM
      - run: echo "PERL5LIB=$HOME/mylib/lib/perl5/"$(perl -MConfig -e 'print $Config{archname}') >> $GITHUB_ENV
      - run: perl Makefile.PL
      - run: make
      - run: make disttest

Linux - Ubuntu - 64bit - Perl 5.8

linux-ubuntu-latest-perl-5.8.9.yml

name: linux-ubuntu-latest-perl-5.8.9

on:
  push:
    branches:
      - '*'
    tags-ignore:
      - '*'
  pull_request:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: shogo82148/actions-setup-perl@v1
        with:
          perl-version: '5.8.9'
      - run: perl -V
      - run: perl -MConfig -MData::Dumper -e 'local $Data::Dumper::Sortkeys = 1;warn Dumper \%Config;'
      - run: perl cpanm ExtUtils::CBuilder
      - run: perl cpanm -L ~/mylib -n SPVM
      - run: echo "PERL5LIB=$HOME/mylib/lib/perl5/"$(perl -MConfig -e 'print $Config{archname}') >> $GITHUB_ENV
      - run: perl Makefile.PL
      - run: make
      - run: make disttest

Mac

macos-latest.yml

name: macos-latest

on:
  push:
    branches:
      - '*'
    tags-ignore:
      - '*'
  pull_request:

jobs:
  build:
    runs-on: macos-latest
    steps:
      - uses: actions/checkout@v1
      - run: brew install perl
      - run: perl -V
      - run: perl -MConfig -MData::Dumper -e 'local $Data::Dumper::Sortkeys = 1;warn Dumper \%Config;'
      - run: perl cpanm -L ~/mylib -n SPVM
      - run: echo "PERL5LIB=$HOME/mylib/lib/perl5/"$(perl -MConfig -e 'print $Config{archname}') >> $GITHUB_ENV
      - run: perl Makefile.PL
      - run: make
      - run: make disttest

Windows Server 2019

windows-2019.yml

name: windows-2019

on:
  push:
    branches:
      - '*'
    tags-ignore:
      - '*'
  pull_request:

jobs:
  perl:
    runs-on: windows-2019
    steps:
      - uses: actions/checkout@master
      - run: perl -V
      - run: perl -MConfig -MData::Dumper -e 'local $Data::Dumper::Sortkeys = 1;warn Dumper \%Config;'
      - run: perl cpanm -n SPVM
      - run: perl Makefile.PL
      - run: gmake
      - run: gmake disttest

#570 - CPAN Weekly

Perl Weekly

Published on Monday 27 June 2022 10:00

Hi there

I noticed a fresh air and renewed energy among Perl Hackers ever since the latest release of Perl v5.36. I can only imagine what would be the reaction when Corinna becomes part of core Perl. It would definitely help Perl regain its glory, in my humble opinion.

As some of you are aware that I have been doing daily Perl feature series for sometimes now, I have seen so much interest in the new/improved features brought in Perl v5.36. All credit goes to the hard work and dedication of the team responsible for the release. I have got all the daily feature posts saved in the GitHub repository for anyone to checkout. I am pleasantly surprised to see the repository quicky getting to the Top 3 popular repostories on my GotHub dashboard.

Do you remember CPAN Weekly?

It was created and managed by Neil Bowers. I still remember the public announcement. I really enjoyed the weekly email. I still have it saved in my email inbox. It is priceless treasure that I don't want to loose. So I decided to drop a line on my twitter handle, asking shouldn't it get a reboot?

I got plenty of support for the reboot. Even Neil Bowers responded with a warning, "resist the temptation of do it myself, instead encourage others to take it on". Who knows my workload better than me. I knew if I wanted to do this just by myself then it would be hard to justify the legacy started by original creator, Neil Bowers. I was lucky to find a helping hand in no time. She is also member of Team PWC. I have seen her growth ever since she joined the team. I am lucky to have her in the team. She responded with 2 emails so far detailing her thought process. It is still in early discussion stage, I will share more details when we have initial draft ready. We are not in a rush, to be honest. The more help I get the better it is going to be.

One more thing, I would like to talk about recently concluded, The Perl and Raku Conference in Houston. I really wanted to attend in person and meet everyone. I missed the live streaming of the talks. Never mind, we now have all the talks recorded. Please go and pick your favourite one from the YouTube Playlist. I would like to mention couple, I have seen so far from the list that I loved it and they are Taming the Unicode Beast and Corinna Status, 2022. When I have spare time, I will definitely go through each one by one.

I am not sure about others but I miss event reports by the attendees of Perl conference. I remember, in good old days, we would get plenty of such event reports. It used to give nice perspective from the attendee point of view. I wish and hope, we get some this time around. Talking about Perl conference, I am sad that London Perl Workshop is not happening this year too. I am hoping the year 2023 can be the lucky year for LPW.

Please do enjoy the rest of the newsletter.

Dancer2: Logging

Perl Maven

Published by Gabor Szabo on Monday 27 June 2022 07:40

Part of the Dancer2 video course available both to Pro subscribers and attendees of the Perl Dancer course on Leanpub.

(cccxcviii) 12 great CPAN modules released last week

Niceperl

Published by Unknown on Sunday 26 June 2022 00:39

Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12.

  1. Alien::Build - Build external dependencies for use in CPAN
    • Version: 2.50 on 2022-06-23
    • Votes: 21
    • Previous version: 2.48 was 3 months, 10 days before
  2. Encode - character encodings in Perl
    • Version: 3.18 on 2022-06-25
    • Votes: 56
    • Previous version: 3.17 was 2 months, 18 days before
  3. FFI::Platypus - Write Perl bindings to non-Perl libraries with FFI. No XS required.
    • Version: 1.58 on 2022-06-19
    • Votes: 56
    • Previous version: 1.57 was 8 days before
  4. Imager - Perl extension for Generating 24 bit Images
    • Version: 1.018 on 2022-06-19
    • Votes: 61
    • Previous version: 1.017 was 5 days before
  5. Compress::Zlib - IO Interface to compressed data files/buffers
    • Version: 2.201 on 2022-06-25
    • Votes: 15
    • Previous version: 2.106 was 2 months, 13 days before
  6. JSON - JSON (JavaScript Object Notation) encoder/decoder
    • Version: 4.07 on 2022-06-24
    • Votes: 96
    • Previous version: 4.06 was 1 month, 2 days before
  7. JSON::PP - JSON::XS compatible pure-Perl module.
    • Version: 4.10 on 2022-06-24
    • Votes: 15
    • Previous version: 4.09 was 1 month, 2 days before
  8. Minion - Job queue
    • Version: 10.25 on 2022-06-24
    • Votes: 89
    • Previous version: 10.24 was 1 month, 26 days before
  9. Module::CoreList - what modules shipped with versions of perl
    • Version: 5.20220620 on 2022-06-20
    • Votes: 38
    • Previous version: 5.20220527 was 23 days before
  10. SPVM - SPVM Language
    • Version: 0.9612 on 2022-06-23
    • Votes: 27
    • Previous version: 0.9608 was 8 days before
  11. Teng - very simple DBI wrapper/ORMapper
    • Version: 0.33 on 2022-06-21
    • Votes: 25
    • Previous version: 0.32 was 2 years, 2 months, 27 days before
  12. Zydeco - Jazz up your Perl
    • Version: 0.615 on 2022-06-20
    • Votes: 16
    • Previous version: 0.613 was 1 year, 5 months, 11 days before

(dxii) metacpan weekly report - perl

Niceperl

Published by Unknown on Sunday 26 June 2022 00:35

This is the weekly favourites list of CPAN distributions. Votes count: 49

Week's winners (+3): perl 

Build date: 2022/06/25 22:32:43 GMT


Clicked for first time:


Increasing its reputation:

(dxl) stackoverflow perl report

Niceperl

Published by Unknown on Sunday 26 June 2022 00:31

Annotated Perl::Critic Policy Index

blogs.perl.org

Published by Tom Wyant on Friday 24 June 2022 23:23

In the wake of my postings on the file access tests (-r and friends) I wondered if there was a Perl::Critic policy to find them. So I constructed an annotated index of Perl Critic policies. Because of its size I stuck it on GitHub rather than in-line to this blog post.

This index assumes that any CPAN module whose name begins with Perl::Critic::Policy:: is a Perl Critic Policy. The index entry for each module contains the name of the module itself (linked to Meta::CPAN), the name of the distribution which contains it, and the abstract for the module if it contains anything other than a repeat of the module name. I suppose the module description could have been added, but I hoped the abstract would be sufficient.

This operation gave me 341 policies. I did not find the policy I wanted among them. In fact, only Kevin Ryde's Perl::Critic::Policy::ValuesAndExpressions::ProhibitFiletest_f came close.

For those who want context, the relevant blog posts are:

Perl lightning talk: ”Don’t Fear map and grep”

dev.to #perl

Published by Mark Gardner on Friday 24 June 2022 21:25

This week’s Perl and Raku Conference 2022 in Houston was packed with great presentations, and I humbly added to them with a five-ish minute lightning talk on two of Perl’s more misunderstood functions: map and grep.

(Sorry about the ”um”s and ”ah”s…)

Don’t Fear map & grep: List processing for fun and profit

Many beginning Perl programmers don’t understand the map and grep functions and avoid them. But they’re the key to many solutions under the heading of “list pr…

favicon slideshare.net

I’ve written much about list processing in Perl, and this talk was based on the following blog posts:

Overall I loved attending the conference, and it really invigorated my participation in the Perl community. Stay tuned as I resume regular posting!

Cover image: "shopping list" by Ex-Smith is licensed under CC BY-SA 2.0.

Perl Weekly Challenge 170: Primorial Numbers and Kronecker Product

blogs.perl.org

Published by laurent_r on Friday 24 June 2022 02:07

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

Spoiler Alert: This weekly challenge deadline is due in a few of days from now (on June 26, 2022 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: Primorial Numbers

Write a script to generate first 10 Primorial Numbers.

Primorial numbers are those formed by multiplying successive prime numbers.

For example,

P(0) = 1    (1)
P(1) = 2    (1x2)
P(2) = 6    (1x2×3)
P(3) = 30   (1x2×3×5)
P(4) = 210  (1x2×3×5×7)

If we use the strict definition provided in the task specification, the list of primorial numbers should start with 2, since 0 and 1 are not considered to be prime. However, definitions of primorial numbers often start with 1. I’ll stick with the definition provided in the task, but it would be very easy to add 1 at the beginning of the list if we wished to do so.

Primorial Numbers in Raku

Using the [] reduction meta-operator together with the * multiplication operator, as well as the is-prime built-in routine, make the task very easy in Raku, so that we can express it as a Raku one-liner:

say [\*] (1..Inf).grep({.is-prime})[0..9];

We start with an infinite list of prime numbers and then find the partial sums of the first ten prime numbers with the [\*] meta-operator.

This script displays the following output:

$ raku ./primorials.raku
(2 6 30 210 2310 30030 510510 9699690 223092870 6469693230)

Primorial Numbers in Perl

This is essentially the same idea as above except that we have to implement our own is_prime subroutine as well as our loop to compute the partial sums.

use strict;
use warnings;
use feature "say";


sub is_prime {
   my $n = shift;
   return 1 if $n == 2;
   return 0 if $n % 2 == 0;
   return 0 if $n == 1;

   my $p = 3;
   my $sqrt = sqrt $n;
   while ($p <= $sqrt) {
       return 0 if $n % $p == 0;
       $p += 2;
   }
   return 1;
}

my ($i, $count, $product) = (1, 0, 1);
my @result;
while (1) {
    $i++;
    next unless is_prime $i;
    $count++;
    $product = $product * $i;
    push @result, $product;
    last if $count >= 10;
}
say "@result";

This program displays the following output:

$ perl ./primorials.pl
2 6 30 210 2310 30030 510510 9699690 223092870 6469693230

Task 2: Kronecker Product

You are given 2 matrices.

Write a script to implement Kronecker Product on the given 2 matrices.

For more information, please refer wikipedia page.

For example:

A = [ 1 2 ]
    [ 3 4 ]

B = [ 5 6 ]
    [ 7 8 ]

A x B = [ 1 x [ 5 6 ]   2 x [ 5 6 ] ]
        [     [ 7 8 ]       [ 7 8 ] ]
        [ 3 x [ 5 6 ]   4 x [ 5 6 ] ]
        [     [ 7 8 ]       [ 7 8 ] ]

      = [ 1x5 1x6 2x5 2x6 ]
        [ 1x7 1x8 2x7 2x8 ]
        [ 3x5 3x6 4x5 4x6 ]
        [ 3x7 3x8 4x7 4x8 ]

      = [  5  6 10 12 ]
        [  7  8 14 16 ]
        [ 15 18 20 24 ]
        [ 21 24 28 32 ]

Kronecker Product in Raku

First, before we get to the real task, we implement a print_matrix subroutine to pretty print a matrix in a human-friendly format. This type of auxiliary subroutine is often very useful when dealing with aggregate or composite data structures. This is useful not only to display the result at the end (as in the code below), but also as a development tool to check that the input is correct and also for debugging purpose (this use does not appear in the program below, but I employed it at development time).

In most programming languages, the Kronecker Product task would require four nested loops (loop over the rows of the first matrix, loop over the rows of the second matrix, and loop over the individual items of each of the rows). With Raku, the X cross product operator makes it possible to avoid an explicit coding of the two last (inner) loops, so that we can simply iterate over the rows of each matrix and take the cross product of these rows.

Note that we use three test cases: a simple case with two 2 x 2 square matrices, another one with one 3 x 2 and one 2 x 3 matrices, and finally one with one 2 x 3 and one 3 x 2 matrices.

sub print_matrix (@m) {
    for @m -> @row {
        .fmt(" %3d ").print for @row;
        say "";
    }
}
sub kroneck_prod (@a, @b) {
    my @result;
    for @a -> @row_a {
        for @b -> @row_b  {
            push @result, [@row_a  X* @row_b];
        }
    }
    print_matrix @result;
}

say "test 1:";
my @a = (1, 2; 3, 4);
my @b = [5, 6; 7, 8];
kroneck_prod @a, @b;
say "\ntest 2:";
my @c = (1, 2, 3; 2, 3, 4);
my @d = (5, 6; 7, 8; 9, 10);
kroneck_prod @c, @d;
say "\nTest 3:";
kroneck_prod @d, @c;

This program displays the following output for the 3 test cases:

$ raku ./kronecker_prod.raku
test 1:
   5    6   10   12
   7    8   14   16
  15   18   20   24
  21   24   28   32

test 2:
   5    6   10   12   15   18
   7    8   14   16   21   24
   9   10   18   20   27   30
  10   12   15   18   20   24
  14   16   21   24   28   32
  18   20   27   30   36   40

Test 3:
   5   10   15    6   12   18
  10   15   20   12   18   24
   7   14   21    8   16   24
  14   21   28   16   24   32
   9   18   27   10   20   30
  18   27   36   20   30   40

Kronecker Product in Perl

This is essentially a port to Perl of the Raku program above, except that, since Perl doesn’t have the X cross product operator, we implement our own cross_prod subroutine to handle matrices’ rows. I tend to think that separating the handling of the matrices from the handling of the individual rows (and thus avoiding four explicitly nested loops) makes the code slightly easier to understand.

Note that we use again three test cases: a simple case with two 2 x 2 square matrices, another one with one 3 x 2 and one 2 x 3 matrices, and finally one with one 2 x 3 and one 3 x 2 matrices.

use strict;
use warnings;
use feature "say";

sub print_matrix {
    for my $row (@_) {
        print map sprintf(" %3d ", $_), @$row;
        say "";
    }
}
sub cross_prod {
    my @c = @{$_[0]};
    my @d = @{$_[1]};
    my @cross_res;
    for my $i (@c) {
        push @cross_res, $i * $_ for @d;
    }
    return [ @cross_res ]
}  
sub kroneck_prod {
    my @a = @{$_[0]};
    my @b = @{$_[1]};
    my @result;
    for my $row_a (@a) {
        for my $row_b (@b) {
            push @result, cross_prod $row_a, $row_b;
        }
    }
    print_matrix @result;
}
say "Test 1:";
my @a = ([1, 2], [3, 4]);
my @b = ([5, 6], [7, 8]);
kroneck_prod \@a, \@b;
say "\nTest 2:";
my @c = ([1, 2, 3], [2, 3, 4]);
my @d = ([5, 6], [7, 8], [9, 10]);
kroneck_prod \@c, \@d;
say "\nTest 3:";
kroneck_prod \@d, \@c;

This program displays the following output for the 3 test cases:

$ perl ./kronecker_prod.pl
Test 1:
   5    6   10   12
   7    8   14   16
  15   18   20   24
  21   24   28   32

Test 2:
   5    6   10   12   15   18
   7    8   14   16   21   24
   9   10   18   20   27   30
  10   12   15   18   20   24
  14   16   21   24   28   32
  18   20   27   30   36   40

Test 3:
   5   10   15    6   12   18
  10   15   20   12   18   24
   7   14   21    8   16   24
  14   21   28   16   24   32
   9   18   27   10   20   30
  18   27   36   20   30   40

Wrapping up

The next week Perl Weekly Challenge will start soon. If you want to participate in this challenge, please check https://perlweeklychallenge.org/ and make sure you answer the challenge before 23:59 BST (British summer time) on July 3, 2022. And, please, also spread the word about the Perl Weekly Challenge if you can.

Reconsidering the licensing of Perl code

blogs.perl.org

Published by Dean on Wednesday 08 June 2022 07:19

The current state: The Perl interpreter and most of CPAN are provided under the Artistic 1.0 license and the GPL1.0 license. The Artistic 1.0 license was written by Larry Wall and due to its problems Perl is simultaneously licensed under the GPL 1.0 License.

It is the de-facto standard to license software published to CPAN under the same terms as the Perl interpreter.

The Artistic 2.0 license supersedes the Artistic 1.0 license and is designed to overcome its problems. Raku uses this license as it was specifically created for Perl 6. Mojolicious also uses this license.

The Artistic licenses are not widely used outside the Perl & Raku sphere.

What is the "best" license? (Discussion)

The major philosophical axis in (free) Open Source licenses is Copyleft versus Permissive

"Copyleft" licenses require source code to be made available with compiled software that is distributed. "Permissive" licenses don't have that requirement.

For scripting languages this distinction is almost irrelevant unless the code is actually compiled (perlcc for example) or bundled up somehow in firmware or something.

However if someone is running the software and not distributing it (i.e. running a website) then there is almost no difference.

Since Perl's main usage is in websites, system administration, etc. there is very little practical difference between Permissive and Copyleft.

Note: Other licenses like the AGPL exist which require source to be provided by websites etc. Software is also sometimes made available as open source on commercial terms (example Radiator from open.com.au)

Why is the author releasing your code as open source?

As an individual author, is the code released for purely altruistic reasons or as a type of portfolio? Perhaps there is an implied business model that organizations using the software will create commercial opportunities to support it? I think it's unlikely though that an individual author will single handedly write software that goes much beyond this. No doubt there are exceptions but likely they are outliers.

For groups of individual authors which tend to organize into "projects", at one end there are the pure hobbyists (think software that controls model railroads) and the other end is employees of various companies being paid (or not!) to contribute to software these companies use.

Commercial entities (businesses) may release code hoping that through usage there will be opportunities commercial support, training, or hosting opportunities will arise. A "freemium" model is also quite common.

Who is the target audience? What's your business model?

Is the author's intention lean more towards hobbyists to use the software or for businesses to do so?

If for businesses, what function does the software perform for the business? I think this heavily informs license choice.

In all cases let's assume that the author wants people and maybe businesses to find the software useful and to use it, that more users are preferred over less, and that there isn't a desire to make using the software any harder than possible.

My thoughts

Taking an open source software as is then attempting to sell it would require establishing marketing and distribution, then convincing consumers they should pay for something they can get for free. This would be a significant investment which wouldn't provide any investment for future versions. Even for "shrink wrapped"/"one then done" software like games, I suspect the effort would simply send more users to the free version over the long term. To me a Copyleft license makes more sense in this context, however I am not convinced as many open source games are available and this doesn't seem to have happened.

The "freemium" business model is a similar idea to this, where companies attempt to convince users to pay money for features deliberately excluded from the free version.

As a historical example, consider the Wine and TransGaming saga. TransGaming created a proprietary version of Wine (which was at the time under the X11 license) called Cedega. Wine re-licensed to LGPL to attempt to force contribution. Cedega has long since been discontinued, and the authors of Wine themselves now have their own proprietary Wine version called CrossOver office which blends the LGPL with proprietary bits with support (basically the Freemium model). Based on this real world example, I am not convinced that Copyleft helps encourage contributions as intended.

A contrary example is BusyBox which is licensed under the GPL license. Actively prosecuting license violations has resulted in a string of settlements and code dumps. Projects such as OpenWRT and SamyGO exist because of these code drops. At the same time, these legal actions have resulted in companies taking open source license compliance more seriously. The Toybox project aims to provide a BSD licensed replacement for BusyBox and is used in Android.

It's worth noting that GitHub reports the MIT license as the most popular (circa 2015). The Node.js and Lua interpreters use this license.

License Compliance

Litigation has resulted in companies taking license compliance more seriously, including open source licenses. Companies and similar organizations should have a well written policy for which licenses are permitted to use and how license compliance is tracked. Likely the most common licenses have been reviewed by lawyers and the burdens each places on the organization considered, representing a considerable investment by the organization.

The AGPL license places a heavy burden on the organization as code must be published even if no software is distributed. This license is very commonly prohibited.

GPL licenses have the burden of providing source code with products and keeping track of the code that creates each release.

On the other hand, permissive licenses do not require source code to be distributed with products or websites merely attribution (in most cases)

The blending of these licenses in an organizations code base necessitates systems that track and ensure compliance. Which is even more important in companies that ship products and run websites.

If and how these licenses can work together is also a question legal must answer.

Likely the organization has used a consultant who already understands the licenses and how courts have enforced them, rather than reviewing the licenses in house. The policy may be based on a template to cost effectively provide "cookie cutter" policy documents.

Less common or bespoke licenses are almost certainly not included and would need to be reviewed. An activity that specialist lawyers will gladly do, charging in 6 minute increments. So, unless the software is enormously helpful to the organization, the legal department will likely take the cheapest route and simply decline to allow the license.

My Conclusion

For my CPAN modules, I want business to use that software and want to make use of a common license and place as little burden as possible on the business to comply with it. I plan to re-license them, with old releases remaining under the "Perl" license.

Given the common use cases of Perl and its scripted nature, I recommend re-licensing code to the ISC or MIT license.

[edit: some typos and punctuation fixed]

#569 - Fundraising for Perl

Perl Weekly

Published on Monday 20 June 2022 10:00

Hi,

4 weeks ago I asked you to support the Perl Weekly. It got very little response. Then 2 weeks ago I wrote how disappointed I am. Wow, the abuse I received for that. Both on Reddit an in private emails.

The funny thing is that the people who got upset that I asked for people to show their support are mostly the ones who never did anything for Perl.

However, the really imporant thing is that within 24 hours some 20 additional people started to support Mohammad and today we are already at 50 supporters! I was very impressed. Thank you!

Thank you!

In any case, think about this as a fund-raiser for Perl. For many years I hardly saw any fund-raising effort by TPF. This week, to my great surprise they put out a prospectus calling for support. I hope they have the communication channels to spread the information about it and will do the legwork that is need to get the support of the community.

For some strange reason they still mix Perl and Raku. Frankly I think it would be much better to both Perl and Raku if they stopped this mix and the two names/languages/dialects, whatever you call them, went separate ways.

Anyway, if you are interested to financially support the Perl activists, you now have a choice: TPF, directly Mohammand S. Anwar, other Perl-related creators.

Enjoy your week!

Dancer2: Show errors during development

Perl Maven

Published by Gabor Szabo on Monday 20 June 2022 08:50

Part of the Dancer2 video course available both to Pro subscribers and attendees of the Perl Dancer course on Leanpub.

Brilliantly Discover Achilles' Imperfection

RabbitFarm Perl

Published on Sunday 19 June 2022 12:39

The examples used here are from the weekly challenge problem statement and demonstrate the working solution.

Part 1

Write a script to generate the first 20 Brilliant Numbers.

Solution


use strict;
use warnings;
sub prime_factor{
    my $x = shift(@_); 
    my @factors;    
    for(my $y = 2; $y <= $x; $y++){
        next if $x % $y;
        $x /= $y;
        push @factors, $y;
        redo;
    }
    return @factors;  
}

sub is_brilliant{
    my($n) = @_;
    my @factors = prime_factor($n); 
    return @factors == 2 && length($factors[0]) == length($factors[1]);
}

sub n_brilliants{
    my($n) = @_;
    my @brilliants;
    my $i = 0;
    {
       push @brilliants, $i if is_brilliant($i);
       $i++;
       redo if @brilliants < $n;
    }
    return @brilliants;
}

MAIN:{
    print join(", ", n_brilliants(20)) . "\n";
}

Sample Run


$ perl perl/ch-1.pl
4, 6, 9, 10, 14, 15, 21, 25, 35, 49, 121, 143, 169, 187, 209, 221, 247, 253, 289, 299

Notes

The solution here incorporated a lot of elements from previous weekly challenges. That is to say it is quite familiar, I continue to be a fan of redo!

Part 2

Write a script to generate the first 20 Achilles Numbers.

Solution


use strict;
use warnings;
use POSIX;
use boolean;

sub prime_factor{
    my $x = shift(@_); 
    my @factors;    
    for (my $y = 2; $y <= $x; $y++){
        next if $x % $y;
        $x /= $y;
        push @factors, $y;
        redo;
    }
    return @factors;  
}

sub is_achilles{
    my($n) = @_;
    my @factors = prime_factor($n); 
    for my $factor (@factors){
        return false if $n % ($factor * $factor) != 0;
    }
    for(my $i = 2; $i <= sqrt($n); $i++) {
        my $d = log($n) / log($i) . "";
        return false if ceil($d) == floor($d);  
    }
    return true;
}

sub n_achilles{
    my($n) = @_;
    my @achilles;
    my $i = 1;
    {
       $i++;
       push @achilles, $i if is_achilles($i);
       redo if @achilles < $n;
    }
    return @achilles;
}

MAIN:{
    print join(", ", n_achilles(20)) . "\n";
}

Sample Run


$ perl perl/ch-2.pl
72, 108, 200, 288, 392, 432, 500, 648, 675, 800, 864, 968, 972, 1125, 1152, 1323, 1352, 1372, 1568, 1800

Notes

This problem revealed something interesting with how, apparently, certain functions will handle integer and floating point values. The issue arises when we are computing logarithms. We can see the issue in isolation in a one liner.

perl -MPOSIX -e '$d = log(9) / log(3); print ceil($d) . "\t" . floor($d) . "\t$d\n"'

which prints 3 2 2. Notice that log(9) / log(3) is exactly 2 but, ok, floating point issues maybe it is 2.0000000001 and ceil will give 3. But why does this work?

perl -MPOSIX -e '$d = sqrt(9); print ceil($d) . "\t" . floor($d) . "\t$d\n"'

which gives 3 3 3. I am not sure what sqrt is doing differently? I guess how it stores the result internally? By the way, I am doing this to check is the result is an integer. That is if ceil($x) == floor($x), but that isn't working here as expected but I have used that trick in the past. I guess only with sqrt in the past though so never encountered this.

The trick to work around this, in the solution to the challenge is like this:

perl -MPOSIX -e '$d = log(9) / log(3) . ""; print ceil($d) . "\t" . floor($d) . "\t$d\n"'

this does what I want and gives 2 2 2. I guess that drops the infinitesimally small decimal part when concatenating and converting to a string which stays gone when used numerically?

Of course, there are other ways to do this. For example abs($x - int(x)) < 1e-7 will ensure that, within a minuscule rounding error, $x is an integer.

References

Challenge 169

(cccxcvii) 11 great CPAN modules released last week

Niceperl

Published by Unknown on Saturday 18 June 2022 18:01

Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12.

  1. Cpanel::JSON::XS - cPanel fork of JSON::XS, fast and correct serializing
    • Version: 4.30 on 2022-06-16
    • Votes: 40
    • Previous version: 4.29 was 20 days before
  2. FFI::Platypus - Write Perl bindings to non-Perl libraries with FFI. No XS required.
    • Version: 1.57 on 2022-06-16
    • Votes: 56
    • Previous version: 1.56 was 7 months, 19 days before
  3. HTTP::Message - HTTP style message (base class)
    • Version: 6.37 on 2022-06-14
    • Votes: 61
    • Previous version: 6.36 was 5 months, 9 days before
  4. Imager - Perl extension for Generating 24 bit Images
    • Version: 1.017 on 2022-06-14
    • Votes: 61
    • Previous version: 1.015 was 1 month, 7 days before
  5. lib::relative - Add paths relative to the current file to @INC
    • Version: 1.001 on 2022-06-15
    • Votes: 12
    • Previous version: 1.000 was 3 years, 2 months, 28 days before
  6. LWP - The World-Wide Web library for Perl
    • Version: 6.67 on 2022-06-14
    • Votes: 156
    • Previous version: 6.66 was 27 days before
  7. Perl::Tidy - indent and reformat perl scripts
    • Version: 20220613 on 2022-06-13
    • Votes: 125
    • Previous version: 20220217 was 3 months, 26 days before
  8. Software::License - packages that provide templated software licenses
    • Version: 0.104002 on 2022-06-14
    • Votes: 12
    • Previous version: 0.104001 was 10 months, 12 days before
  9. SPVM - SPVM Language
    • Version: 0.9608 on 2022-06-15
    • Votes: 27
    • Previous version: 0.9605 was 8 days before
  10. Text::Table::Tiny - generate simple text tables from 2D arrays
    • Version: 1.03 on 2022-06-17
    • Votes: 13
    • Previous version: 1.02 was 1 year, 9 months, 4 days before
  11. WWW::Mechanize - Handy web browsing in a Perl object
    • Version: 2.09 on 2022-06-14
    • Votes: 92
    • Previous version: 2.08 was 15 days before

(dxi) metacpan weekly report - Test2::Suite

Niceperl

Published by Unknown on Saturday 18 June 2022 17:58

This is the weekly favourites list of CPAN distributions. Votes count: 46

Week's winner (+3): Test2::Suite

Build date: 2022/06/18 15:57:23 GMT


Clicked for first time:


Increasing its reputation:

Could you or someone you know be willing to invest a few days per month, offering skills and experience that would be useful to The Perl Foundation or Raku Foundation? Have you considered nominating yourself, or them, to join the Board?

Potential Board members ideally will: * want to get things done and add value * be active in the open source community * demonstrate professional and positive characteristics

It would be great if you have experience on other FOSS boards, or not for profit, start-up, or management experience. Experience with fundraising would also be useful.

Nominees don't have to be actively working with the Perl or Raku languages. They may be a lapsed Perl or enthusiast, who continues to support and love Perl or Raku, but who has left the Perl or Raku environment.

The Board aims to represent the communities that it serves - we currently lack diversity in many ways, so please consider yourself, or encourage nominations for those who do not feel represented at the Foundation.

Currently, our board of directors has five members and we have an annual nomination and election process for new members. Bringing new people to the board regularly, with some community input, allows the organization to grow and increase our effectiveness.

What's expected of Board Members?

Board members are asked to serve a two-year term, after which they will be asked if they want to continue serving. They are expected to attend a monthly board meeting, as well as the monthly community representatives meeting, usually held on the third Friday of the month, one after the other.

What’s the process for joining the Board?

1. Nomination A new member should be nominated by one or more Board members, and must be seconded. If you would like to be nominated, please get in touch via email (board@perlfoundation.org) with the following information: * Bio * If you purport to represent a community (a language, a major project, etc.), that community should validate your application * Your reasons for wishing to become a member of the Board. * What goals you would like to see pursue over the next 12-24 months? This information will be posted publicly.

2. Eligibility The nominee must be an active volunteer with the foundation for at least 180 days.

3. Public hearing A public post will be made to ask for input from the community. The post will have the nominee’s bio and reasons for nomination, as detailed above.

4. Voting The final vote will be made by the existing Board Members after gathering feedback from the public.

Any questions and further information

If you have any questions please get in touch with us at board@perlfoundation.org.

Calling All Grant Gurus!

Perl Foundation News

Published by Amber Deuel on Friday 17 June 2022 14:59


We are in need of a volunteer to take over the Grants Committee Chair responsibilities ASAP. What does the Grants Committee Chair do?

Grants Committee Chair Job Duties

  • Open a grants call every two months (January, March, May, July, September, November) to invite community members to apply for funding.
  • Facilitate discussion of grants between the public,The Perl Foundation/Raku Foundation, and Grants Committee members.
  • Tally and report voting outcome at the end of each grant call.
  • Work with the foundation to ensure funding is available for approved grants.
  • Make sure each approved grant has a grant manager assigned, else serve as grant manager.
  • Serve as a liaison between the foundation and grantees
  • Assist grant managers in removing roadblocks for grant managers and recipients
  • Help grant managers keep grantees on time and on task.
  • Other duties and reporting as needed by the foundation.

Okay, but what are the benefits?

Helping Others Nonprofits depend on volunteers. Not only will you be helping the foundation, you will also be helping the developers that apply for aid. Our grants fund a variety of projects that benefit the open-source community.

*Networking with Other Programmers * The service you perform while volunteering with the foundation allows you to meet new people that you may not have met otherwise. This community gives you a place to bond with peers over the important work you are doing. This can lead to new friendships and even job opportunities since you are constantly meeting, interacting, and networking with new people.

Learn New Things Volunteerism also gives you the chance to learn new things. Most likely, you’ll be working in a new capacity that is unfamiliar to you. This will allow you to gain new skills and gather new ideas.

Contact Us

If you're interested in this role, please email us at board@perlfoundation.org.

Could you support future development of Perl and Raku?

Perl Foundation News

Published by Nic Evans on Wednesday 15 June 2022 05:17

Billions of people around the world rely on Perl and Raku in some way without even realising it. A [new prospectus](ra-rel-mnt/simplecas/fetch_content/64c0601be328555858adc21a58e221c977fe55ae/Perl Raku Prospectus_Final_Interactive_v2.pdf) from The Perl Foundation highlights how you can contribute to its ongoing development, either financially, or through volunteering time.

By doing so you can: * Ensure Perl and Raku are sustainably maintained and developed * Gain valuable education opportunities for your teams at conferences * Engage in important networking opportunities and build your corporate visibility * Recruit new and invaluable Perl or Raku developers to your team * Associate your brand with support for Perl and Raku

Please share the prospectus with colleagues and employers

Take a look at [the prospectus](ra-rel-mnt/simplecas/fetch_content/64c0601be328555858adc21a58e221c977fe55ae/Perl Raku Prospectus_Final_Interactive_v2.pdf) today and share it with your colleagues and employers too.

[](ra-rel-mnt/simplecas/fetch_content/87ad918718351eef9604c5487e49a4c94760d91b/Perl Raku Prospectus_Final_Interactive.pdf)

It's all about the numbers

dev.to #perl

Published by Simon Green on Monday 13 June 2022 13:22

Weekly Challenge 169

Challenge, My solution

After a long break, I'm back. Without further ado, let's go through the two challenges this week.

Task 1: Brilliant Numbers

Task

Write a script to generate first 20 Brilliant Numbers.

Brilliant numbers are numbers with two prime factors of the same length.

The number should have exactly two prime factors, i.e. it’s the product of two primes of the same length.

My solution

This is one of those tasks where given we are dealing with such small numbers, it is easier to just brute force things. In the main function, I have the value l for the length of the primes. I then call call the get_bril_nums function to get all brilliant numbers.

It does this in three steps:

  1. Get all primes of l length.
  2. Multiple each of the primes
  3. Sort the results numerically

I keep doing this until there are at least 20 numbers calculated (as we know this is when l == 2). I then print the first 20 numbers.

Example

$ ./ch-1.py 
4, 6, 9, 10, 14, 15, 21, 25, 35, 49, 121, 143, 169, 187, 209, 221, 247, 253, 289, 299

Task 2: Achilles Numbers

Task

Write a script to generate first 20 Achilles Numbers.

My solution

This task is more challenging than the first one, and highlighted that at the time of writing, Mohammad's description isn't quite correct. I've tweeted him, so hopefully it will be fixed.

For this task, I keep calling the is_achilles_number with an incrementing counter until we have found twenty numbers. This function does the following

  1. Get the unique prime factors into the factors dict (hash in Perl), where the key is the prime number and the value is the power.
  2. Set the powers set (array in Perl) to the power values. At this point we no longer care about the prime factor.
  3. If there is only one value (it's a power of a single number) or any of the powers is 1, return False (undef in Perl).
  4. If the greatest common divisor of the powers is not 1, return False (undef).
  5. Return True.

Example

$ ./ch-2.py 
72, 108, 200, 288, 392, 432, 500, 648, 675, 800, 864, 968, 972, 1125, 1152, 1323, 1352, 1372, 1568, 1800

#568 - Perl v5.36 - the beginning of new era

Perl Weekly

Published on Monday 13 June 2022 10:00

Hi there,

A big round of applause to the entire team behind the ground breaking release of Perl v5.36. I have been following the features of the latest release very closely. I am confident it would be a solid foundation for Corinna and v7.

Have you had chance to play with Perl v5.36?

If not then please do checkout my blog post, where I shared my first hand experience playing with Perl v5.36.

Have you ever thought of contributing to your favourite language, Perl?

A little over a decade, I submitted a small patch via email. Those days, the process was not as smooth as it is today. Unfortunately I never received any acknowledgment. Ever since Perl, found the new home in GitHub, it is so easy to submit the patches. I submitted a small change to the core Perl. To my surprise, in 2 days, it got accepted and merged. It has given me confidence to submit more.

Why don't you also give it a try?

Last but not least, I would like to thank each and everyone for all the support via Patreon, I received in the last few weeks. I am overwhelmed, to be honest.

Enjoy the rest of the newsletter.

Take the Long Way Home

RabbitFarm Perl

Published on Sunday 12 June 2022 23:34

The examples used here are from the weekly challenge problem statement and demonstrate the working solution.

Part 1

Calculate the first 13 Perrin Primes.

Solution


use strict;
use warnings;
use boolean;
use Math::Primality qw/is_prime/;

sub n_perrin_prime_r{
    my($n, $perrins, $perrin_primes) = @_;
    return $perrin_primes if keys %{$perrin_primes} == $n;
    my $perrin = $perrins->[@{$perrins} - 3] + $perrins->[@{$perrins} - 2];
    push @{$perrins}, $perrin;
    $perrin_primes->{$perrin} = -1 if is_prime($perrin);
    n_perrin_prime_r($n, $perrins, $perrin_primes);
}

sub perrin_primes{
    return n_perrin_prime_r(13, [3, 0, 2], {});
}

MAIN:{
    print join(", ", sort {$a <=> $b} keys %{perrin_primes()}) . "\n";
}

Sample Run


$ perl perl/ch-1.pl
2, 3, 5, 7, 17, 29, 277, 367, 853, 14197, 43721, 1442968193, 792606555396977

Notes

The solution here incorporated a lot of elements from previous weekly challenges. That is to say it is quite familiar, we recursively generate the sequence which is stored as hash keys and, once completed, sort and print the results. The hash keys are a convenient, although perhaps slightly bulky, way of handling the repeated 5 term at the beginning. The terms strictly increase thereafter.

Part 2

You are given an integer greater than 1. Write a script to find the home prime of the given number.

Solution


use strict;
use warnings;
use bigint;
use Math::Primality qw/is_prime/;

sub prime_factor{
    my $x = shift(@_); 
    my @factors;    
    for (my $y = 2; $y <= $x; $y++){
        next if $x % $y;
        $x /= $y;
        push @factors, $y;
        redo;
    }
    return @factors;  
}

sub home_prime{
    my($n) = @_;
    return $n if is_prime($n);
    my $s = $n;
    {
        $s = join("", prime_factor($s));
        redo if !is_prime($s);
    }
    return $s;
}

MAIN:{
    print home_prime(10) . "\n";
    print home_prime(16) . "\n";
}

Sample Run


$ perl perl/ch-2.pl
773
31636373

Notes

So you think eight is low

Calculating HP(8) should be an easy go

Take the long way home

Take the long way home

The second part of this week's challenge was a lot of fun as it presented some unexpected behavior. Here we are asked to compute the Home Prime of any given number. The process for doing so is, given N to take the prime factors for N and concatenate them together. If the result is prime then we are done, that is the Home Prime of N, typically written HP(N). This is an easy process to repeat, and in many cases the computation is a very quick one. However, in some cases, the size of the interim numbers on the path to HP(N) grow extremely large and the computation bogs down, whence take the long way home! As an example, the computation of HP(8) is still running after 24 hours on my M1 Mac Mini.

References

Challenge 168

Home Prime

Take the Long Way Home

CPAN: ftp.cpan.org depreciation

The Perl NOC

Published by Unknown on Saturday 11 June 2022 14:25

As a followup to the CPAN Mirror List changes from last year, we're announcing that FTP service on ftp.cpan.org and ftp.perl.org is being deprecated. This means that any CPAN clients configured to use them will fail to fetch modules.

For the past several years, CPAN clients have defaulted to www.cpan.org to fetch modules, so this should only affect users using very old CPAN clients (usually associated with old versions of Perl) who did not explicitly set a mirror.

We're not setting a firm timeline on this depreciation, but there are only a small number of compatible FTP mirrors remaining, and the number is shrinking over time.  At some point, there will no longer be any remaining FTP mirrors, and the service will be terminated.  Because these mirrors are run by independent volunteers, we don't have a good way of measuring actual traffic.

If you think you might be using a CPAN client configured to use ftp.cpan.org or ftp.perl.org, please check, and reconfigure to use the globally available www.cpan.org instead.

If you're using CPAN.pm, you can configure www.cpan.org as the mirror with these commands:

o conf urllist https://www.cpan.org/ 

o conf commit

(If your perl doesn't have Net::SSLEay installed to support TLS, you can just use http://www.cpan.org/) 

Grant Update: Optree Optimisations for Performance Gains

Perl Foundation News

Published by alh on Thursday 09 June 2022 07:03

Work has started, though a roadblock has come up:

https://www.nntp.perl.org/group/perl.perl5.porters/2022/06/msg263847.html

Paul has a few ideas to work around it.

As some preliminary work, he wants to clean up op.c a bit and split the peephole optimiser out into its own file, per this thread:

https://www.nntp.perl.org/group/perl.perl5.porters/2021/12/msg262118.html

There is now an MR for that here:

https://github.com/Perl/perl5/pull/19835

Cheers,

-- Matthew Horsfall (alh)

The way to read Perl core source codes

dev.to #perl

Published by Yuki Kimoto on Thursday 09 June 2022 05:25

I explain the way to read Perl core source codes. Perl 5.36.0 is used in this description.

This is originally The way to read Perl core source codes | Perl ABC

Where is main function?

main function is the entry point of perl command.

It is written in perlmain.c, but Perl has no C source code that name is perlmain.c.

perlmain.c is generated by Makefile.SH using ExtUtils::Miniperl.

Where is processing perl command line arguments?

Processing perl command line arguments are started from perl_parse function.

perl_parse is defined in perl.c.

Go forward to parse_body function.

parse_body is defined in perl.c

You can see the processing logic of command line arguments.

Where is tokenizer?

Next is the tokenizer. The parts of Perl syntax are converted to tokens.

Tokenizing is started from lex_start function.

lex_start is defined in toke.c.

Where is parser?

Next is the parser. The parser converts tokens to AST(abstruct syntax tree).

Parsing is started from yyparse function.

yyparse is defined in perly.c.

perly.c is generated from perly.y using bison.

Where is Perl data structure?

The type of the scalar value SV and its functions are defined in sv.h and sv.c.

The type of the array AV and its functions are defined in av.h and av.c.

The type of the hash HV and its functions are defined in hv.h and hv.c.

Where does Perl run?

After AST is optimized, Perl run from perl_run function.

perl_run is defined in perl.c.

Go forward to run_body function.

run_body is defined in perl.c.

Go forward to CALLRUNOPS.

CALLRUNOPS is defined as PL_runops in perl.h

Furthermore, macros are defined as follows.

perl.h:#define CALLRUNOPS  PL_runops
embedvar.h:#define PL_runops            (vTHX->Irunops)
intrpvar.h:PERLVARI(I, runops,  runops_proc_t, RUNOPS_DEFAULT)
perl.h:# define RUNOPS_DEFAULT Perl_runops_standard

Go forward to Perl_runops_standard function.

Perl_runops_standard is defined in run.c.

The member op_ppaddr of OP structure is called.

op_ppaddr is a function pointer to perlform an operation.

Where are operators defined?

Operators are defined in the following sources.

Einführung in Dist::Zilla

Perl-Academy.de

Published on Wednesday 08 June 2022 10:00

Eine Perl-Distribution besteht neben dem eigentlichen Code auch aus Dateien und Code, um die Distribution über CPAN zur Verfügung zu stellen. Das manuelle Erstellen dieser Dateien hält vom Entwickeln ab und wird schnell lästig. `Dist::Zilla` automatisiert diese Vorgänge. In diesem Artikel gebe ich einen Überblick über den Zweck von `Dist::Zilla` und zeige einen Einstieg in dessen Verwendung.

Robo-Promoting Perl

dev.to #perl

Published by Dave Cross on Tuesday 07 June 2022 19:56

Last I was fascinated by Simon Willison's article A Datasette tutorial written by GPT-3. Datasette is a project I've been following for a while now. It's tool for exploring data stored in SQLite databases. GPT-3 was new to me, but it seems it's an AI for writing articles from simple text prompts. I had a quick look at the web page for it, but couldn't find any obvious way to actually try it out, so I filed it away to investigate further at some point in the future.

But today, I saw another article by Simon called How to play with the GPT-3 language model which gave basic instructions on getting going on the system. And within a couple of minutes I was ready to go.

I seeded the text input with the phrase "Write an article about why Perl is popular" and pressed the submit button. Here's the text I got back:

Perl is a high-level, general-purpose, interpreted, dynamic programming language. Perl was originally developed by Larry Wall in 1987 as a general-purpose Unix scripting language to make report processing easier. Since then, it has undergone many changes and revisions and become widely popular among programmers. Perl is often used for system administration, web development, network programming, and GUI development.

Perl's popularity can be attributed to its many features, which make it both powerful and easy to use. Perl's syntax is very concise and easy to read, making it a great choice for beginners. Perl also has excellent support for text processing, which is one of its most commonly used applications. Additionally, Perl's extensive library of modules makes it easy to add new functionality to Perl programs.

Perl is also very portable, meaning it can run on a wide variety of platforms. Perl is available for many operating systems, including Windows, Linux, and Mac OS. This portability makes it a great choice for developing cross-platform applications.

Overall, Perl's popularity is due to its many features that make it a powerful and easy-to-use programming language. Perl's text processing capabilities, portability, and large module library make it a great choice

And that looks pretty good to me. It simply and effectively ticks all the boxes on my "why I use Perl" list.

Of course, I'm not seriously suggesting that we use AI to write a marketing campaign for Perl. But I do think it's an easy way to get a start on promotional material that you can then clean up yourself.

What do you think? Can you think of a way to use this software?

#567 - What is in Perl v5.36

Perl Weekly

Published on Monday 06 June 2022 10:00

Hi there,

Two weeks ago I asked you to show your support of the newsletter by supporting Manwar via Patreon. 2 people added their support. Let me thank the two of you and to all the others who were already supporting him or me!

However, I also have to say I am utterly disappointed. There are 4,700 subscribers and only 25 who would support Manwar?

There is a recurring discussion on why Perl is disappearing. This is part of it. Very few people contribute to the Perl ecosystem.

I get it, not everyone feels up to the task of maintaining a CPAN module or writing an article. Not everyone has the time for these. That's fine. In that case giving 5-10 USD a month to someone who does a huge amount of work would be a very easy way to show your support and help the Perl ecosystem.

Or have you already totally given up on Perl?

Enjoy your week

A new and shiny version of Perl, 5.36 has been released last week. It contains a lot of very nice improvements and new features. As I'm also currently starting a fresh project, I decided it's a good time to build a new docker (in fact podman) base image to use for some new apps / scripts etc.

Spoiler: Here's my (current) final Dockerfile! Or read on for the long story...

There are of course official Perl Docker images available, in two variants: There is perl:5.36.0 and perl:5.36.0-slim. The first one is nearly 900MB big, while slim is slimmer with 144MB. I don't like big images, so I first tried slim, but it is so slim because it's rather unusable.

The curse of Net::SSLeay

Net::SSLeay allows you to use openssl in your web clients, and as most APIs run on https, it is an absolute required module for all of my projects (a lot of which are web API clients). It is not that easy to install, because it needs some openssl header files to compile. And those are missing in perl:5.36.0-slim (to keep it slim..)

But let's give it a try and build an image based on a very simple Dockerfile

~/perl/perl-docker$ docker build -t perl_5_36-slim -f Dockerfile.5.36-slim .
Step 1/1 : FROM perl:5.36-slim
 ---> 0d52cf67797d
Successfully built 0d52cf67797d
Successfully tagged perl_5_36-slim:latest

Take a look at the size:

docker images --filter=reference='perl_5_36-slim' --format "{{.Repository}} {{.Size}} {{.ID}}"
perl_5_36-slim 144MB 0d52cf67797d

144MB, ok, nice. Now let's check Net::SSLeay:

docker run perl_5_36-slim  perl -MNet::SSLeay -E 'say Net::SSLeay->VERSION'
Can't locate Net/SSLeay.pm in @INC

Can we install it?

docker run --rm -ti perl_5_36-slim /bin/bash
root@8e4ec3733b01:/# cpanm Net::SSLeay
--> Working on Net::SSLeay
Fetching https://www.cpan.org/authors/id/C/CH/CHRISN/Net-SSLeay-1.92.tar.gz ... OK
Configuring Net-SSLeay-1.92 ... N/A
! Configure failed for Net-SSLeay-1.92. See /root/.cpanm/work/1654449406.7/build.log for details.

No, why not?

root@8e4ec3733b01:/# cat  /root/.cpanm/work/1654449406.7/build.log
******************************************************************************
* COULD NOT FIND LIBSSL HEADERS                                              *
*                                                                            *
* The libssl header files are required to build Net-SSLeay, but they are     *
* missing from /usr. They would typically reside in /usr/include/openssl.    *
*                                                                            *
* If you are using the version of OpenSSL/LibreSSL packaged by your Linux    *
* distribution, you may need to install the corresponding "development"      *
* package via your package manager (e.g. libssl-dev for OpenSSL on Debian    *
* and Ubuntu, or openssl-devel for OpenSSL on Red Hat Enterprise Linux and   *
* Fedora).                                                                   *
******************************************************************************

But just installing libssl-dev is not enough, because we need a whole build environment, and all of that stuff takes so much disk space (and installation time) that we might just as well got with the non-slim version:

~/perl/perl-docker$ docker build -t perl_5_36-fat -f Dockerfile.5.36-fat .
Step 1/1 : FROM perl:5.36
 ---> 9a373d352e6f
Successfully built 9a373d352e6f
Successfully tagged perl_5_36-fat:latest

Take a look at the size:

docker images --filter=reference='perl_5_36-fat' --format "{{.Repository}} {{.Size}} {{.ID}}"
perl_5_36-fat 891MB 9a373d352e6f

891MB - fat indeed. But let's check Net::SSLeay anyway:

docker run perl_5_36-fat  perl -MNet::SSLeay -E 'say Net::SSLeay->VERSION'
Can't locate Net/SSLeay.pm in @INC

Can we install it?

docker run --rm -ti perl_5_36-fat /bin/bash
root@8e4ec3733b01:/# cpanm -n Net::SSLeay
--> Working on Net::SSLeay
Fetching https://www.cpan.org/authors/id/C/CH/CHRISN/Net-SSLeay-1.92.tar.gz ... OK
Configuring Net-SSLeay-1.92 ... OK
Building Net-SSLeay-1.92 ... OK
Successfully installed Net-SSLeay-1.92
1 distribution installed

Yes! And it works (after also installing IO::Socket::SSL)

root@92ef4d4f5cab:/# perl -MHTTP::Tiny -E 'say HTTP::Tiny->new->get("https://domm.plix.at:")->{status}'
200

Now I could build some custom images based on perl:5.36. Or ..

Build your own

I want:

  • a small-ish base image,
  • which should include a bunch of CPAN modules I'll use in all projects (this list will grow..)
  • I prefer cpm to cpanm
  • Perl should be installed to /opt so I can later easily copy the whole installation (in multi stage builds derived from the base image)

We used alpine in a few projects, it seems to work, so I'm sticking with it:

FROM alpine

Then I install a bunch of things we need, most notably zlib and openssl (and their -dev packages)

RUN apk update && apk upgrade && apk add --no-cache \
    curl tar make gcc build-base wget gnupg vim tree bash \
    zlib zlib-dev openssl openssl-dev

The next few lines are lifted from https://github.com/scottw/alpine-perl/blob/master/Dockerfile, with a few adaptions (most relevant -Dprefix='/opt/perl'). I removed the checksum test (and might add it again, now that I got the basic setup working); and I don't run the test suite (I don't have that many idle cycles to burn)

RUN mkdir -p /usr/src/perl

WORKDIR /usr/src/perl

RUN curl -SLO https://www.cpan.org/src/5.0/perl-5.36.0.tar.gz \
    && tar --strip-components=1 -xaf perl-5.36.0.tar.gz -C /usr/src/perl \
    && rm perl-5.36.0.tar.gz \
    && ./Configure -des \
        -Duse64bitall \
        -Dcccdlflags='-fPIC' \
        -Dcccdlflags='-fPIC' \
        -Dccdlflags='-rdynamic' \
        -Dlocincpth=' ' \
        -Duselargefiles \
        -Dusethreads \
        -Duseshrplib \
        -Dd_semctl_semun \
        -Dusenm \
        -Dprefix='/opt/perl' \
    && make -j$(nproc) \
    && make install \
    && rm -fr /usr/src/perl

Now I change the working directory to /opt/perl and add it to the PATH.

WORKDIR /opt/perl
ENV PATH="/opt/perl/bin:${PATH}"
RUN cd /opt/perl

And finally I download a copy cpm into /tmp/cmp and use it to properly install App::cpm, IO::Socket::SSL (which will pull in Net::SSLeay), and other stuff I'm bound to need

RUN curl -o /tmp/cpm -sL --compressed https://git.io/cpm \
    && chmod 755 /tmp/cpm \
    && /tmp/cpm install -g App::cpm IO::Socket::SSL Cpanel::JSON::XS \
    && rm -fr /root/.perl-cpm

So, let's run it:

docker build -t perl_5_36-custom -f Dockerfile.perl5.36-app-base .
Step 1/9 : FROM alpine
 ---> e66264b98777
Step 2/9 : RUN apk update && apk upgrade && apk add --no-cache curl tar make gcc build-base wget gnupg vim t...
 ---> ed8080081bc4
Step 3/9 : RUN mkdir -p /usr/src/perl
 ---> 7bab08167507
Step 4/9 : WORKDIR /usr/src/perl
 ---> f9ccbaa25578
Step 5/9 : RUN curl -SLO https://www.cpan.org/src/5.0/perl-5.36.0.tar.gz     && tar --strip-components=1 -xa...
 ---> ccb8e8a97ad8
Step 6/9 : WORKDIR /opt/perl
 ---> 94356542d4ed
Step 7/9 : ENV PATH="/opt/perl/bin:${PATH}"
 ---> f3c1c9451e40
Step 8/9 : RUN cd /opt/perl
 ---> bc651d01629c
Step 9/9 : RUN curl -o /tmp/cpm -sL --compressed https://git.io/cpm     && chmod 755 /tmp/cpm     && /tmp/cp...
 ---> f6d98e961143
Successfully built f6d98e961143
Successfully tagged perl_5_36-custom:latest

How big is it?

~/perl/perl-docker$ docker images --filter=reference='perl_5_36-custom' --format "{{.Repository}} {{.Size}} {{.ID}}"
perl_5_36-custom 300MB f6d98e961143

300MB, not that bad (and could probably be improved later). Do we have Net::SSLeay?

docker run perl_5_36-custom  perl -MNet::SSLeay -E 'say Net::SSLeay->VERSION'
1.92

Nice, Net::SSLeay is installed! But does it work?

docker run perl_5_36-custom perl -MHTTP::Tiny -E 'say HTTP::Tiny->new->get("https://domm.plix.at:")->{status}'
200

Yes!!

Now the next steps are to build a Dockerfile for an actual app that's based on this image.

You can find the whole Dockerfile here.

And if you have any suggestions or questions, drop me a line!

Circular Primes and Getting Complex

RabbitFarm Perl

Published on Sunday 05 June 2022 10:46

The examples used here are from the weekly challenge problem statement and demonstrate the working solution.

Part 1

Write a script to find out first 10 circular primes having at least 3 digits (base 10).

Solution


use strict;
use warnings;
use boolean;
use Math::Primality qw/is_prime/;

sub is_circular_prime{
    my($x, $circular) = @_;
    my @digits = split(//, $x);
    my @rotations;
    for my $i (0 .. @digits - 1){
        @digits = (@digits[1 .. @digits - 1], $digits[0]);
        my $candidate = join("", @digits) + 0;
        push @rotations, $candidate;
        return false if !is_prime($candidate);
    }
    map{$circular->{$_} = -1} @rotations;
    return true;
}

sub first_n_circular_primes{
    my($n) = @_;
    my $i = 100;
    my %circular;
    my @circular_primes;
    {
        if(!$circular{$i} && is_circular_prime($i, \%circular)){
            push @circular_primes, $i; 
        }
        $i++;
        redo if @circular_primes < $n;
    }
    return @circular_primes;
}

sub first_10_circular_primes{
    return first_n_circular_primes(10);
}

MAIN:{
    print join(", ", first_10_circular_primes()) . "\n";
}

Sample Run


$ perl perl/ch-1.pl
113, 197, 199, 337, 1193, 3779, 11939, 19937, 193939, 199933

Notes

There is a bit of a trick here where we need to disallow repeated use of previous cycles. For example, 199 and 919 and considered to be the same circular prime (we count the first occurrence only) since 919 is a rotation of 199.

I don't ordinarily use a lot of references, especially hash references, in my Perl code but here it seems appropriate. It makes sense to break the rotating and primality checking to it's own function but we also need to track all the unique rotations. Wishing to avoid a global variable, which in this case wouldn't be all that bad anyway, having a single hash owned by the caller and updated by the primality checking function makes the most sense to me. The code is arguably cleaner then if we had multiple return values, to include the rotations. Another option, which would have avoided the use of a reference and multiple return values would have been to have is_circular_prime return either undef or an array containing the rotations. This would have added a little extra bookkeeping code to first_n_circular_primes in order to maintain the master list of all seen rotations so I considered it, simply as a matter of style, to be just a little less elegant than the use of the reference.

Part 2

Implement a subroutine gamma() using the Lanczos approximation method.

Solution


use strict;
use warnings;
use POSIX;
use Math::Complex;

use constant EPSILON => 1e-07;

sub lanczos{
    my($z) = @_;
    my @p = (676.5203681218851, -1259.1392167224028, 771.32342877765313, -176.61502916214059, 12.507343278686905, -0.13857109526572012, 9.9843695780195716e-6, 1.5056327351493116e-7);
    my $y;
    $z = new Math::Complex($z);
    if(Re($z) < 0.5){
        $y = M_PI / (sin(M_PI * $z) * lanczos(1 - $z));
    }
    else{
        $z -= 1;
        my $x = 0.99999999999980993;
        for my $i (0 .. @p - 1){
            $x += ($p[$i] / ($z + $i + 1));
        }
        my $t = $z + @p - 0.5;
        $y = sqrt(2 * M_PI) * $t ** ($z + 0.5) * exp(-1 * $t) * $x;
    }
    return Re($y) if abs(Im($y)) <= EPSILON;
    return $y;
}

sub gamma{
    return lanczos(@_);
}

MAIN:{
    printf("%.2f\n",gamma(3));
    printf("%.2f\n",gamma(5));
    printf("%.2f\n",gamma(7));
}

Sample Run


$ perl perl/ch-2.pl
2.00
24.00
720.00

Notes

The code here is based on a Python sample code that accompanies the Wikipedia article and there really isn't much room for additional stylistic flourishes. Well, maybe that for loop could have been a map. For this sort of numeric algorithm there really isn't much variation in what is otherwise a fairly raw computation.

The interesting thing here is that it is by all appearances a faithful representation of the Lanczos Approximation and yet the answers seem to siffer from a slight floating point accuracy issue. That is the expected answers vary from what is computed here by a small decimal part, apparently anyway. Perl is generally quite good at these sorts of things so getting to the bottom of this may require a bit more investigation! I wonder if it has to do with how Math::Complex handles the real part of the number?

References

Challenge 167

Lanczos Approximation

Dancer2: Solution: 1 - Counter

Perl Maven

Published by Gabor Szabo on Sunday 05 June 2022 10:30

Part of the Dancer2 video course available both to Pro subscribers and attendees of the Perl Dancer course on Leanpub.

List of new CPAN distributions – May 2022

Perlancar

Published by perlancar on Saturday 04 June 2022 02:52

dist author first_version latest_version abstract
Acme-PERLANCAR-Test-Misc PERLANCAR 0.001 0.002 Test various things
Addr-MyIP STEVEB 0.05 0.05 Get your public facing IPv4 or IPv6 address
Algorithm-QuadTree-XS BRTASTIC 0.01 0.02 XS backend for Algorithm::QuadTree
Alien-DjVuLibre SKIM 0.01 0.04 Find or download and install DjVuLibre
Alien-LZ4 ZMUGHAL 0.01 0.01 Find or build LZ4
Alien-OpenCV ZMUGHAL 0.001 0.001 Find or build OpenCV computer vision library
Alien-zlib ZMUGHAL 0.01 0.01 Find or build zlib
Alien-zstd ZMUGHAL 0.01 0.01 Find or build zstd
AnyEvent-Sway JOHNMERTZ 0.18 0.18 communicate with the Sway window manager
App-Cheats TIMKA 0.02 0.05 Cheatsheet
App-Gimei YOUPONG v0.0.1 v0.1.0 CLI for Data::Gimei
App-MARC-Count SKIM 0.01 0.02 Base class and script for creating of some MARC field value unique count.
App-MARC-Filter SKIM 0.01 0.02 Base class and script for filter MARC records.
App-MARC-List SKIM 0.01 0.02 Base class and script for creating of some MARC field value unique list.
App-Pod TIMKA 0.02 0.03 The great new App::Pod!
App-pod TIMKA 0.01 0.01 The great new App::pod!
App-winmaildat2tar UTASHIRO 0.99 0.9902 Convert winmail.dat (TNEF data) to tentative archive
Array-Sample-SimpleRandom PERLANCAR 0.001 0.001 Sample elements randomly (with or without replacement)
Array-Sample-WeightedRandom PERLANCAR 0.001 0.001 Sample elements randomly, with weights (with or without replacement)
Authen-Pluggable EBRUNI 0.01 0.01 A Perl module to authenticate users via pluggable modules
Author-Daemon DAEMON 0.001 0.001 daemon's helpful creations
Bencher-Scenario-Digest-MD5 PERLANCAR 0.005 0.005 Benchmark Digest::MD5 against md5sum utility
Bencher-Scenario-Digest-SHA1 PERLANCAR 0.004 0.004 Benchmark Digest::SHA1 against Digest::SHA
Bencher-Scenario-File-Which-Cached PERLANCAR 0.002 0.002 Benchmark File::Which::Cached
Bencher-Scenario-IPC-System-Options PERLANCAR 0.040 0.040 Measure the overhead of IPC::System::Options's system()over CORE::system()
Bencher-Scenario-List-MoreUtils PERLANCAR 0.041 0.041 Benchmark List::MoreUtils::PP vs List::MoreUtils::XS
Bencher-Scenarios-Crypt-Diceware-Wordlist PERLANCAR 0.002 0.002 Benchmark Crypt::Diceware::Wordlist modules
CGI-Application-Plugin-RunmodeParseKeyword RHESA 0.10_01 0.14 Declare cgiapp runmodes with keywords
CPAN-Test-Dummy-Perl5-MakeMakerBadName MIYAGAWA 0.01 0.02 Bad NAME in Makefile.PL
Catalyst-Model-MetaCPAN-Client LNATION 0.01 0.02 Catalyst Model for MetaCPAN
Catalyst-Plugin-CSRFToken JJNAPIORK 0.001 0.003 Generate tokens to help prevent CSRF attacks.
Catalyst-Plugin-SocialMeta LNATION 0.01 0.03 Generate social media meta tags for your catalyst application.
Catalyst-View-BasePerRequest JJNAPIORK 0.001 0.002 Catalyst base view for per request, strongly typed templates
Console-Blackjack GDONALD 0.01 0.02 A console-based implementation of Blackjack
Cron-Sequencer NWCLARK 0.01 0.05 show the sequence of commands that cron would run
Crypt-Noise ABBYPAN 0.01 0.01 Noise protocol
DBIx-Class-TemporalRelations GEEKRUTH 0.9000 0.9000 Establish and introspect time-based relationships between tables.
Dancer2-Plugin-Auth-Extensible-Provider-DBIxClass GEEKRUTH 0.0900 0.0902 authenticate via the Dancer2::Plugin::DBIx:Class plugin
Debug-CodeBlock LNATION 0.01 0.04 Add DEBUG codeblocks to your code.
Excel-Writer-XLSX-Simple-Tabs MRDVT 0.02 0.03 Simple Interface to the Excel::Writer::XLSX Package
ExtUtils-MakeMaker-META_MERGE-GitHub MRDVT 0.01 0.02 Perl package to generate ExtUtils::MakeMaker META_MERGE for GitHub repositories
File-KDBX CCM 0.800 0.903 Encrypted database to store secret text and files
File-KDBX-XS CCM 0.900 0.900 Speed up File::KDBX
File-KeePass-Agent-KDBX CCM 0.900 0.902 A KeePass 2 agent
File-KeePass-KDBX CCM 0.900 0.902 Read and write KDBX files (using the File::KDBX backend)
Firewall-Config-Connector CARELINE 0.001 0.004 turns baubles into trinkets
Firewall-Config-Content CARELINE 0.001 0.001 turns baubles into trinkets
Firewall-Config-Dao CARELINE 0.001 0.002 turns baubles into trinkets
Firewall-Config-Element CARELINE 0.001 0.002 turns baubles into trinkets
Firewall-Config-Parser CARELINE 0.001 0.002 turns baubles into trinkets
Firewall-Controller CARELINE 0.001 0.001 turns baubles into trinkets
Firewall-DBI CARELINE 0.001 0.002 turns baubles into trinket
Firewall-FireFlow-Config CARELINE 0.001 0.001 turns baubles into trinkets
Firewall-Policy-Designer CARELINE 0.001 0.001 turns baubles into trinkets
Firewall-Policy-Element CARELINE 0.001 0.001 turns baubles into trinkets
Firewall-Utils CARELINE 0.001 0.004 turns baubles into trinkets
GitHub-EmptyRepository CONTRA 0.00001 0.00002 Scan for empty repositories
HTTP-SecureHeaders KFLY 0.01 0.01 manage security headers with many safe defaults
Imager-File-AVIF TONYC 0.001 0.001 AVIF image file support for Imager
Irssi-Bot-BasicBot-Pluggable ANEI 0.1 0.1 Run Bot::BasicBot::Pluggable::Module_s in Irssi
JSON-UnblessObject KFLY 0.01 0.01 unbless object using JSON spec like Cpanel::JSON::XS::Type
JavaScript-Embedded CAVAC v2.7.0 v2.7.0 Perl interface to Duktape embeddable javascript engine
Jenkins-i18n ARFREITAS 0.01 0.04 functions for the jtt CLI
LaunchDarkly-Server MTIRPAK 0.01 0.02 Perl server side SDK for LaunchDarkly
Map-Tube-Hongkong CYFUNG 0.01 v0.04.1 Map::Tube::Hongkong – interface to the Hongkong MTR map.
Mardem-RefactoringPerlCriticPolicies MARDEM 0.01 0.01 Some Perl::Critic::Policies to search for needed refactoring
Math-FakeDD SISYPHUS 0.01 0.03 DoubleDouble precision arithmetic for all architectures
Math-Round-SignificantFigures MRDVT 0.01 0.01 Perl package for rounding numbers to a specified number of Significant Figures
Method-Signatures-Simple-ParseKeyword RHESA 1.11 1.12 Basic method declarations with signatures, without source filters
Module-ScanDeps-Static BIGFOOT 0.1 0.4 scan modules for dependencies
Monitoring-Sneck-Boop_Snoot VVELOX v0.0.1 v0.1.1 Boop the Monitoring::Sneck's snoot via SNMP
MooX-Keyword LNATION 0.01 0.04 The great new MooX::Keyword!
MooseX-Extended OVID 0.01 0.10 Extend Moose with safe defaults and useful features
MooseX-Role-WarnOnConflict OVID 0.01 0.01 Warn if classes override role methods without excluding them
Net-DynDNS-GoDaddy STEVEB 0.01 0.02 Provides Dynamic DNS functionality for your GoDaddy domains
Net-MitDK KARASIK 0.01 0.02 perl API for http://mit.dk/
Number-Equation LNATION 0.01 0.02 Track how a number is calculated progamically.
Octets-To-Unicode DART 0.02 0.06 модуль утилит Ð´Ð»Ñ Ñ€Ð°ÑÐ¿Ð¾Ð·Ð½Ð°Ð²Ð°Ð½Ð¸Ñ ÐºÐ¾Ð´Ð¸Ñ€Ð¾Ð²ÐºÐ¸ текÑта (в том чиÑле в файлах) и его декодированиÑ
Perl-Critic-Mardem MARDEM 0.02 0.04 Some Perl::Critic::Policies to search for needed refactoring
Plack-App-Tags-HTML SKIM 0.01 0.05 Plack application for running Tags::HTML objects.
Plack-Middleware-SecureHeaders KFLY 0.01 0.01 manage security headers middleware
Plack-Middleware-ValidateJSON MHANDISI 0.001 0.001 Checks validity of JSON POST'd to a Plack app and generates an error response if the JSON is not valid
Pod-LOL TIMKA 0.01 0.06 Transform POD into a list of lists
Pod-Query TIMKA 0.01 0.12 Query pod documents
Regexp-Pattern-Filename-Image-WhatsApp PERLANCAR 0.001 0.004 Image filename saved by WhatsApp
Regexp-Pattern-Filename-Media-WhatsApp PERLANCAR 0.001 0.004 Media (video, image) filename saved by WhatsApp
Regexp-Pattern-Filename-Video-WhatsApp PERLANCAR 0.001 0.002 Video filename saved by WhatsApp
SPVM-IO KIMOTO 0.01 0.02 I/O modules for File, Socket, select/polling.
SPVM-IO-File KIMOTO 0.01 0.01 File Input/Output
SPVM-MIME-Base64 KIMOTO 0.01 0.01 Base64 encode/decode
Sagan-Monitoring VVELOX v0.0.1 v0.0.1 LibreNMS JSON SNMP extend and Nagios style check for Sagan stats
Sys-OsPackage IKLUFT 0.1.0 0.1.6 install OS packages and determine if CPAN modules are packaged for the OS
Term-hr WOLDRICH 0.001 0.002 Color screen output using extended escape sequences
TimTools TIMKA 0.01 0.05 Some common functions.
Tk-GtkSettings HANJE 0.01 0.03 Give Tk applications the looks of Gtk applications
YAML-YAML2ADoc BZP 0.1.0 0.1.0 Something like yaml2rst but for AsciiDoc and in Perl

Stats

Number of new CPAN distributions this period: 96

Number of authors releasing new CPAN distributions this period: 43

Authors by number of new CPAN distributions this period:

No Author Distributions
1 PERLANCAR 12
2 CARELINE 11
3 TIMKA 6
4 SKIM 5
5 LNATION 5
6 CCM 4
7 ZMUGHAL 4
8 KIMOTO 3
9 MRDVT 3
10 KFLY 3
11 STEVEB 2
12 RHESA 2
13 OVID 2
14 MARDEM 2
15 JJNAPIORK 2
16 GEEKRUTH 2
17 VVELOX 2
18 WOLDRICH 1
19 BIGFOOT 1
20 ABBYPAN 1
21 ANEI 1
22 BRTASTIC 1
23 UTASHIRO 1
24 ARFREITAS 1
25 DAEMON 1
26 CYFUNG 1
27 CAVAC 1
28 BZP 1
29 DART 1
30 EBRUNI 1
31 MTIRPAK 1
32 KARASIK 1
33 MHANDISI 1
34 HANJE 1
35 NWCLARK 1
36 YOUPONG 1
37 MIYAGAWA 1
38 CONTRA 1
39 TONYC 1
40 JOHNMERTZ 1
41 SISYPHUS 1
42 GDONALD 1
43 IKLUFT 1

TPRC June Newsletter

Perl Foundation News

Published by Todd Rinaldo on Thursday 02 June 2022 18:09


Time to Pack

  • Plan your Stay
  • Stay Connected
  • Setup your Schedule
  • Call for Volunteers
  • Standards of Conduct
  • Sponsor
  • Lighting Talks
  • How to Reach Organizers

Welcome June! Hello Perl & Raku Conference!

Summer is here and brings with it a new in person Perl & Raku Conference in Houston from Tuesday June 21st to Friday June 25th.

Talks start on Wednesday 22 morning at 9:30 am. Come earlier to share a breakfast together and meet people from the community.

During the conference you can attend presentations covering Perl, Raku and supporting languages. You can also join us to one of the Hackathon sessions or subscribe to one of the classes organized the day before and the day after the talks.

June 21: * Creative, Compelling, and Confident: Becoming a Better Public Speaker * ~~Intro to Perl for existing coders~~ This class is now canceled.

June 25: * Introduction to Go * Oh Snap, I'm management. Now what?

Space is limited for these masterclasses. Be sure to register for them while registering for the conference: https://tprc2022.sched.com/tickets

Plan Your Stay

Where: The Hilton Houston North, 12400 Greenspoint Dr, Houston, TX 77060. Register: for the conference by going to https://tprc2022.sched.com/tickets Stay: Part of the conference is paid for by room reservations. We have negotiated discount rates through the hotel: https://tprc.us/hotel. Travel: Houston has two airports. We recommend traveling to George Bush Airport (IAH) if you have a choice. Hobby Airport (HOU) is on the other side of the city and requires additional travel after you land. Free Airport Shuttle: Hilton Houston North provides shuttles to and from IAH. Call the main number to request the shuttle: 281-875-2222

Stay Connected

During the conference you can stay connected using the #yapc channel on irc.perl.org. You can also join the perlfoundation on Slack in #perl. Contact us with your email address and we can send you an invite.

On social media you can track the event using the #TPRCHouston tag for The Perl and Raku Conference in Houston. You can also follow us via @PerlConferences on Twitter. Another great source of information is provided via the Conference Wiki.

Multiple In-Persons events are organized before/during and after the conference. Browsing the wiki you will be able to find more details about such activities like: * Arrival (and Alt) Dinner * Hackathons * BOFs aka Birds of a Feather * Bad Movie Night * Raku * Perl Mongeresses * Baseball: Astros vs Mets on Tuesday * Rock Climbing * Karaoke * Board Games Night: bring your favorite game and play with attendees! * Post Conference activities

More useful information will be added to the wiki during the conference.

Do not forget to visit The Perl and Raku Conference website: https://perlconference.us/

Setup your Sched(ule)

All talks and classes are listed on sched website. It’s highly recommended that you create an account on sched to organize your conference.

Sched Website for 2022: https://tprc2022.sched.com Using a sched account you can bookmark talks you want to attend. Installing the Sched Mobile App you can be sure to not miss any talks.

Registering to talks via Sched also provides useful information to the organizers to select the best room for the expected audience.

Standards of Conduct

Our goal is to provide a place open to everyone driven by respect, collaboration and consideration.

To help us reach that goal we invite you to read the Standards of Conduct to know the Expected Behavior from every participant but also know how to report incidents if these were to happen.

Let’s build together a friendly, safe and welcoming environment for all.

Health and Safety

The safety of our attendees is a top priority for us. We've been away for three years. As we return to in-person conferences, we want to ensure everyone is safe. Houston has moved to Level 3 “Stay Vigilant”.

Level 3 signifies a moderate, but controlled level of COVID-19. Per our Health and Safety Policies, attendees should be fully vaccinated. Fully vaccinated individuals should mask as local rules indicate.

Call for Volunteers!

This is your Conference. The conference is run by volunteers.

During the conference we always need some extra hands to help. Several calls for volunteers will be made at the beginning of the conference. Please come and help us.

You can email admin@perlconference.us to volunteer.

Lighting Talks!

text I hear the gong a comin' It's trolling round the room And I ain't seen the sunshine since I don't know when I'm stuck in The TPC, and time keeps draggin' on But that gong keeps a trollin' on the next speaker

Do you have something to say? Do you know something the whole conference should know? Submit your Lighting Talk now to have 5 minutes in the Big Room.

How to reach our organizers

  • Visit our website: https://tprc.us
  • Follow us on Twitter: @PerlConferences
  • Like us on Facebook: The Perl Foundation (@tpf.perl)
  • Subscribe to the mailing list: https://tprc.us/subscribe
  • Standard of conducts: https://perlconference.us/soc
  • Send any questions about The Perl Conference to admin@perlconference.us. An organizer will get back to you.