This week in PSC (124) | 2023-11-16

This week we:

  • Reviewed some recent email threads:
    • Returning values from require multiple times - seems not useful as compared to using do FILE or the new load_module builtin
    • CPAN.pm observed to use lots of memory, but also complicated to fix. It might benefit a new smaller simpler tool being provided by Perl core
  • Perl 5.39.5 is due soon and we have release managers up to 5.39.8, but we’re still in need of folks to do up to 5.40.0

Of Go, C, Perl and fastq file conversion Vol III : pledging allegiance to the flag

In the previous entry, we presented a regex based fastq parser. As the regex engine maps to a finite state automaton, we should be able to rewrite the parser without regular expressions, using flags to keep track of the part of the record we are at. The code is straightforward, but lacks the elegance of the regex parser. It is provided as a possibly faster alternative to the regular expression implementation.

Perl Weekly Challenge 266: Uncommon Words

These are some answers to the Week 266, 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 April 28, 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: Uncommon Words

You are given two sentences, $line1 and $line2.

Write a script to find all uncommon words in any order in the given two sentences. Return ('') if none found.

A word is uncommon if it appears exactly once in one of the sentences and doesn’t appear in other sentence.

Example 1

Input: $line1 = 'Mango is sweet'
       $line2 = 'Mango is sour'
Output: ('sweet', 'sour')

Example 2

I just discovered Dev.to

I don't really keep up with online resources, and I blogs.perl.org to be (like perl) a nice and stable home. I've watched resources come and go - I've lost untold content in the process (geocities, myspace, LtU, hello??).

I recently discovered dev.to because of a nice benchmarking article published by a long standing community member:

Benchmarking Perl Core Class in v5.38 By John Napiorkowski

https://dev.to/jjn1056/benchmarking-core-class-573c

So I guess this is like some kind of substack for developer blogging? I only recently discovered that resource also.

This week in PSC (122) | 2023-10-26

This week we discussed:

  • Release process needs better docs, maybe some more automation.
  • "inward goto" has been deprecated since 5.12. We have set an end date for it and will announce in 5.40 that we'll remove it in 5.42.
  • Our call for a project manager to get SSL into core has not gone unheeded. We're happy to accept Nicolas Mendoza to the role.
  • We need to review our notes about keeping multiple CPAN indexes from PTS in Lyon and publish them for all to see

Idle Thoughts on Old Perl Versions for New Distributions

Crossposted from my blog

My upgrade of my home server from Debian 11 ("bullseye") to Debian 12 ("bookworm") went almost without a hitch. Yesterday I realized that the Postgres data hadn't been migrated from the old DB to the Debian package of Postgres 15. But luckily, the good Pg people provide a Debian package of 9.6 (the version which held my data) for Debian 12. I could install that one, fire it up, dump all data into SQL, fire up Pg 15 from Debian and import it there. Now I run such an SQL dump daily, just to have the data available as SQL files.

I wonder if it would be worthwhile for Perl to provide prebuilt binaries/packages of old Perl versions for current OSes, but then, there are so many build options that it's not worth the effort in general.

Outdated perl utility txt2html migration

I noticed the other day we had an old utility script txt2html.pl that gave a warning
/usr/local/bin/txt2html.pl
$* is no longer supported at /usr/local/bin/txt2html.pl line 1512.
Apparently $*=1 was how multi-line regex searching was done in old perls.

Now it is regex flag m and s like
$a =~ m /foo/ms;
I found the code had been updated and put in HTML::TextToHTML https://metacpan.org/release/RUBYKAT/txt2html-2.02 so I did
$ sudo cpanm HTML::TextToHTML
which gives us /usr/local/bin/txt2html, then mv'd the old txt2html.pl to txt2html.pl.orig and used ln -s to symlink txt2html.pl to point at /usr/local/bin/txt2html.

In my google search on the warning, I found this call for help:
https://github.com/resurrecting-open-source-projects/txt2html/blob/master/CONTRIBUTING.md
so added a github Issue and emailed the author saying the updated and migrated txt2html.pl was already available on CPAN.

The Hidden Power of Prototypes

Introduction

I have been leaning very heavily on Perl's prototype feature for creating new modules. The imptetus for this can traced back to the day I looked at the source code for Try::Tiny, and realized that it was implemented using prototypes. The main reason for using prototypes for many new modules I've created recently is my focus on making a thing I do repeatedly available in a more Perlish or idiomatic way.

Required reading if you have not and are about to dive into an article about prototypes: Far More Than Everything You've Ever Wanted to Know about Prototypes in Perl by Tom Christiansen.

The following article demonstrates 2 CPAN modules I have written that focus more on Perl programmer UX and why Perl prototypes can provide a way forward for a great many ideas that people have. Prototypes misunderstood, yes; but more so, they are misunderestimated. They are infact, very powerful and when used for their intended purpose; a lot of hand wringing can be avoided during feature discussions.

This week in PSC (121) | 2023-10-19

  • Reviewed recent mailing list threads - multiple namespaces, moose + warnings conflicts. Determined there’s not a lot the perl core can do (at the moment)

  • Reviewed PR#21532 (Module loading function)

  • SSL out of the box still needs someone to project manage whatever various bits need to be done. A specific email on the subject will be sent to the list.

  • PR#18059 to fix up perl version number macros is still outstanding and needs fixing up so it can be merged

Komodo IDE is now Open Source

Hi all,

Please note that Komodo IDE is now open source. Komodo IDE is a very feature-rich Integrated Development Environment (IDE). Basically a sophisticated source-code editor. Notable features why I used Komodo IDE:

  • Syntax highlighting
  • Code intelligence (autocomplete, code refactoring etc.)
  • Run and debug programs easily
  • Debug with breakepoints and inspect the variables and their values in the GUI
  • Integrates with version control

You can read more about Komodo IDE here.

The blog post announcing Komodo IDE going Open Source is here.

The blog post also contains an explanation why it is made open source. One of the reasons is that there is already a lot of free and good editors available, e.g. Visual Studio Code. Though, as I was using Komodo IDE for at least 7 years now, I still very much like it and it’s OOTB feature set.

Komodo-IDE.png

Perl Weekly Challenge #231 - Not Going to Extremes but Accepting Senior Citizens

Hi everybody! In this week's weekly challenge, we're searching for anything but the minimum or maximum in a dataset, and searching for senior citizens on a plane.

Min And Max

This challenge is a very interesting one, because obviously the easiest solution in terms of development is to sort and filter the first and last element. However, that is O(n log n) and it's very little added complexity to do the O(n) solution with a single-pass filter.

Perl Weekly Challenge 231: Senior Citizens

These are some answers to the Week 231, 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 August 27, 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 2: Senior Citizens

You are given a list of passenger details in the form “9999999999A1122”, where 9 denotes the phone number, A the sex, 1 the age and 2 the seat number.

Write a script to return the count of all senior citizens (age >= 60).

Example 1

Input: @list = ("7868190130M7522","5303914400F9211","9273338290F4010")
Ouput: 2

The age of the passengers in the given list are 75, 92 and 40.
So we have only 2 senior citizens.

Example 2

This week in PSC (120) | 2023-10-12

This week we discussed the following topics:

  • load_module has a PR in progress; needs continued nudging on a few last issues so we can move forward and merge it
  • Pod “U<..>” for underline has better docs; again that could possibly be merged now if all are happy
  • We spent further time thinking about other ideas for extending and improving Pod: further details may be published in due course
  • We briefly discussed how to break the logjam on PPC0013 and continue work on join/etc…

Next stable DBD::SQLite will be released in the middle of September

DBD::SQLite 1.73_01 (with SQLite 3.42.0) is a release candidate for the next stable DBD::SQLite. This release is mainly to upgrade the bundled SQLite library.

I'll wait for about a month and release 1.74 in the middel of September if there's no blocker nor request to wait for more. Thank you for your patience.

Perl Weekly Challenge #230 - Turning Numbers into Characters and Words into Numbers

Hi everybody! I'm finally back with another PWC/TWC blog post for week 230.

Separate Digits

For the first challenge we want to split all the numbers in the array into single digits. Here's the code:

use v5.36;
my @nums;
push(@nums, split(//, $_)) for @ARGV;
say $_ for @nums;

It very simply splits anything in its arguments into individual characters and pushes them onto a new array.

Count Words

Our second challenge asks us to count the words that start with the given prefix. Here's a 4-liner (minus boilerplate) to help us out with this one:

Why YACM (yet another color module) ?

At the recent YAPC::EU (still running) I gave a talk about my latest CPAN module: Graphics::Toolkit::Color (in short GTC - v1.53). It went a little out of hand and even worse: some of the key thoughts I did not formulate as clear as wanted. That is why I use this channel to correct that. In this first part I outline the goal of the module and the next part will be about the design principles of the public API, moving than into implementation details and the general issues when dealing with colors.

This week in PSC (119) | 2023-10-05

This week we discussed the following topics:

  • Module::CoreList is still somewhat awkward and manual to update around releases. We need better instructions and possibly some automation around the simpler
  • Pod’s new U<> format needs more documentation around its limited availability.
  • Test2::Suite sometimes spuriously fails in perl core; needs some poking
  • We should put out a call for bugfixes for a possible 5.38.1 release

Of Go, C, Perl and fastq file conversion Vol I : intro

Next Generation Sequencing (NGS) has really taken off the last few years, as both devices and the cost of experiments have dramatically declined. NGS decipher the identity (base composition, the sequence of letters in the alphabet of DNA and RNA) of nucleic acids and return the results in the fastq open data format. Fastq files are flat text files with a standardized layout: each molecule present in the sample that is captured by the sequencer is represented with four fields:

  1. a '@' character and is followed by a sequence identifier and an optional description

  2. one (typically) or more lines of characters in the four letter alphabet of nucleic acids

  3. a metadata field starting with the "+" optionally followed by the same sequence identifier and description as in the first field

  4. one, or more lines of the quality of each symbol sequence reported in field 2

An example of such a four field entry may look something like this

Perl Weekly Challenge 265: Completing Word

These are some answers to the Week 265, 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 April 21, 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: Completing Word

You are given a string, $str containing alphanumeric characters and array of strings (alphabetic characters only), @str.

Write a script to find the shortest completing word. If none found return empty string.

A completing word is a word that contains all the letters in the given string, ignoring space and number. If a letter appeared more than once in the given string then it must appear the same number or more in the word.

Example 1

Resource::Silo - declarative lazy resource container library

Resource::Silo is a declarative lazy resource container library for Perl. It allows to declare resources such as configuration files, database connections, external service endpoints, and so on, in one place; acquire them on demand; cache them; and release in due order.

It may also be described as the single source of truth for the application's side effects.

For those unfamiliar with Bread::Board:

Hey, hey, hey, hey! A shiny new solution just arrived!

  • declare all of your application's resources / dependencies in one place using a simple DSL;
  • instantiate them on demand and only once, with little overhead;
  • override them with mocks in your tests & guard against unexpected side effects;
  • gain more fine-grained control via the ctl frontend.

For Bread::Board users:

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.