Title
Planet Perl
Go Home
Category
Description
Address
Phone Number
+1 609-831-2326 (US) | Message me
Site Icon
Planet Perl
Tags
Page Views
0
Share
Update Time
2022-10-23 22:12:56

"I love Planet Perl"

www.perlsphere.net VS www.gqak.com

2022-10-23 22:12:56

Planet Perl Text: [s]how / [h]ide Sources blogs.perl.org dev.to #perl domm (Perl and other tech) End Point Dev blog Perl topic MetaCPAN News Niceperl nxadm Perl Foundation News Perl Hacks Perl Maven Perl Weekly Perl-Academy.de perl.com Perlancar RabbitFarm Perl The Perl NOC The Weekly Challenge Subscribe OPML Powered by Perlanet Code on Github Feedback welcome Perl Weekly Challenge 187: Days Togetherblogs.perl.org Published by laurent_r on Monday 24 October 2022 03:13 These are some answers to the Week 187 of the Perl Weekly Challenge organized by Mohammad S. Anwar.Task 1: Days TogetherTwo friends, Foo and Bar gone on holidays separately to the same city. You are given their schedule i.e. start date and end date.To keep the task simple, the date is in the form DD-MM and all dates belong to the same calendar year i.e. between 01-01 and 31-12. Also the year is non-leap year and both dates are inclusive.Write a script to find out for the given schedule, how many days they spent together in the city, if at all.Example 1Input: Foo => SD: '12-01' ED: '20-01' Bar => SD: '15-01' ED: '18-01'Output: 4 daysExample 2Input: Foo => SD: '02-03' ED: '12-03' Bar => SD: '13-03' ED: '14-03'Output: 0 dayExample 3Input: Foo => SD: '02-03' ED: '12-03' Bar => SD: '11-03' ED: '15-03'Output: 2 daysExample 4Input: Foo => SD: '30-03' ED: '05-04' Bar => SD: '28-03' ED: '02-04'Output: 4 daysNo time this week, so I will only cover this task in Raku (I might come back to it later with additional material). The idea here is to create a yearly calendar mapping dates such as ‘05-04’ to their day number in the year. It is then quite easy to use simple arithmetic subtraction to find the result.my @m = < 0 31 28 31 30 31 30 31 31 30 31 30 31 >;my $c = 1;my %dates = map { $_ => $c++ }, (map { ((1..@m[$_])>>.fmt("%02d-$_")) }, map {.fmt("%02d")}, 1..12).flat;sub compute-common ($sd1, $ed1, $sd2, $ed2) { my $start-common = max %dates{$sd1}, %dates{$sd2}; my $end-common = min %dates{$ed1}, %dates{$ed2}; return $end-common - $start-common + 1;}for , , , , -> @input-dates { say "Number of days together for dates @input-dates[]: ", compute-common | @input-dates;}This program displays the following output:$ raku ./days-together.rakuNumber of days together for dates 12-01 20-01 15-01 18-01: 4Number of days together for dates 03-03 12-03 13-03 14-03: 0Number of days together for dates 02-03 12-03 11-03 15-03: 2Number of days together for dates 30-03 05-04 28-03 02-04: 4Number of days together for dates 12-01 13-03 09-01 25-04: 61Wrapping upThe 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 October 30, 2022. And, please, also spread the word about the Perl Weekly Challenge if you can. Days Together Are MagicalRabbitFarm Perl Published on Sunday 23 October 2022 17:11 The examples used here are from the weekly challenge problem statement and demonstrate the working solution.Part 1Two friends, Foo and Bar gone on holidays seperately to the same city. You are given their schedule i.e. start date and end date. To keep the task simple, the date is in the form DD-MM and all dates belong to the same calendar year i.e. between 01-01 and 31-12. Also the year is non-leap year and both dates are inclusive. Write a script to find out for the given schedule, how many days they spent together in the city, if at all.Solutionuse v5.36;use strict;use warnings;use Time::Piece;use Time::Seconds;sub days_together{ my($together) = @_; my $days_together = 0; my($start, $end); my $foo_start = Time::Piece->strptime($together->{Foo}->{SD}, q/%d-%m/); my $bar_start = Time::Piece->strptime($together->{Bar}->{SD}, q/%d-%m/); my $foo_end = Time::Piece->strptime($together->{Foo}->{ED}, q/%d-%m/); my $bar_end = Time::Piece->strptime($together->{Bar}->{ED}, q/%d-%m/); $start = $foo_start; $start = $bar_start if $bar_start > $foo_start; $end = $foo_end; $end = $bar_end if $bar_end < $foo_end; { $days_together++ if $start q/12-01/, ED => q/20-01/}, Bar => {SD => q/15-01/, ED => q/18-01/}}); say $days; $days = days_together({Foo => {SD => q/02-03/, ED => q/12-03/}, Bar => {SD => q/13-03/, ED => q/14-03/}}); say $days; $days = days_together({Foo => {SD => q/02-03/, ED => q/12-03/}, Bar => {SD => q/11-03/, ED => q/15-03/}}); say $days; $days = days_together({Foo => {SD => q/30-03/, ED => q/05-04/}, Bar => {SD => q/28-03/, ED => q/02-04/}}); say $days; }Sample Run$ perl perl/ch-1.pl4024NotesTime:Piece makes this easy, once we figure out the logic. The start date shouldbe the later of the two start dates since clearly there can be no overlap until thesecond person shows up. Similarly the end date should be the earlier of the twodates since once one person leaves their time together is over. By convertingthe dates to Time::Piece objects the comparisons are straightforward. Now, once the dates are converted to Time::Piece objects and the start and end datesdetermined we could also use Time::Piece arithmetic to subtract one from the otherand pretty much be done. However, since that might be a little too boring I insteaditerate and count the number of days in a redo loop!Part 2You are given a list of positive numbers, @n, having at least 3 numbers.Write a script to find the triplets (a, b, c) from the given list that satisfies a set of rules.Solutionuse v5.36;use strict;use warnings;use Hash::MultiKey;use Math::Combinatorics;sub magical_triples{ my(@numbers) = @_; my %triple_sum; tie %triple_sum, q/Hash::MultiKey/; my $combinations = Math::Combinatorics->new(count => 3, data => [@numbers]); my($s, $t, $u); while(my @combination = $combinations->next_combination()){ my($s, $t, $u) = @combination; my $sum; $sum = $s + $t + $u if $s + $t > $u && $t + $u > $s && $s + $u > $t; $triple_sum{[$s, $t, $u]} = $sum if $sum; } my @triples_sorted = sort {$triple_sum{$b} $triple_sum{$a}} keys %triple_sum; return ($triples_sorted[0]->[0], $triples_sorted[0]->[1], $triples_sorted[0]->[2]) if @triples_sorted; return ();}MAIN:{ say "(" . join(", ", magical_triples(1, 2, 3, 2)) . ")"; say "(" . join(", ", magical_triples(1, 3, 2)) . ")"; say "(" . join(", ", magical_triples(1, 1, 2, 3)) . ")"; say "(" . join(", ", magical_triples(2, 4, 3)) . ")";}Sample Run$ perl perl/ch-2.pl(2, 3, 2)()()(4, 3, 2)NotesThe "magical" rules, if not clear from the above code are:a + b > cb + c > aa + c > ba + b + c is maximum.To be certain, this problem is an excellent application of constraint programming.Unfortunately I do not know of a good constraint programming library in Perl.If you see my Prolog Solutionsfor this problem you can see just how straightforward such a solution can be!Here we find ourselves with a brute force implementation. Math::Combinatorics isa battle tested module when dealing with combinatorics problems in Perl. For all possible selectionsof three elements of the original list we evaluate the rules and track their sumsin a hash. We then sort the hash keys based on the associated values and returnthe triple which has maximal sum and otherwise passes all the other requirements.A nice convenient module used here is Hash::MultiKey which allows us to usean array reference as a hash key. In this way we can have immediate access to thetriples when needed.ReferencesChallenge 187 Use Dist::Zilla to Create a Perl Distributiondev.to #perl Published by Nicholas Hubbard on Sunday 23 October 2022 14:29 Dist::Zilla (dzil) is a program for creating Perl distributions. While the documentation for dzil is complete, it is not geared towards a beginner that has never created a Perl distribution before. This article provides a brief introduction to Dist::Zilla geared towards users that know little about Perl distributions in general. What is a Perl distribution?A Perl distribution is an archive of files that includes a Perl module. There are no official rules on what non-module files must be included in a distribution, but they often include (among other things) test scripts, a Makefile.PL, documentation, and the license. These distributions are commonly uploaded to CPAN, which is a place for Perl programmers to upload their Perl distributions for the purpose of sharing their code. Why Dist::Zilla?You may think that bundling together a Perl module with some other files is simple, but there are many things that need to be accounted for, and are prone to human error. There are also many possibilities for what somebody may want to include in a distribution, and how they want to include it. Dist::Zilla exists to be a one-stop solution to every possible problem involved in creating a Perl distribution. Using Dist::ZillaWhen you install Dist::Zilla, you will be provided with an executable named dzil. The most important command that dzil provides is build, which - when run in the projects root directory - outputs a distribution tarball. Other commands such as test and release are also provided, but when getting started with Dist::Zilla you will only need the build command. The "dist.ini" FileDist::Zilla is configured on a per-project basis through a file named dist.ini, which should be located at the root of the project's directory tree.The beginning of a dist.ini file specifies required settings that every distribution should have. These settings include name, version, abstract, copyright_holder, and license. (There is also author, which isn't required but you probably want to add it as well.)Here is an example:name = App-Fooversion = 1.0author = Jane Doecopyright_holder = Jane Doelicense = Perl_5abstract = the best software everAfter you specify these required settings, you can then configure your distribution by specifying what plugins you wish to use. Plugins are the mechanism that Dist::Zilla uses for providing features to your Perl distribution. If you have dist.ini that doesn't specify any plugins, Dist::Zilla will produce an empty distribution with no files.Let's look at example of the plugins that a simple distribution might use, then go over what a few of the plugins actually do:[MetaResources]homepage = https://github.com/JaneDoe/App-Foobugtracker.web = https://github.com/JaneDoe/App-Foo/issuesrepository.url = https://github.com/JaneDoe/App-Foo.git[GatherDir][PruneCruft][ManifestSkip][MetaYAML][License][ExecDir][MakeMaker][Manifest][AutoPrereqs][TestRelease]The MetaResources plugin adds resource entries to the distribution's metadata. MetaCPAN can use this information to provide useful links to the distribution's page.The GatherDir and PruneCruft plugins tell Dist::Zilla that you want to include all the files in your project's directory into the distribution, excluding the ones you certainly don't want. The files you certainly don't want include build artifacts introduced by recent invocations of Dist::Zilla. The combination of these two plugins is used in almost every Dist::Zilla project.The MakeMaker plugin will tell Dist::Zilla to produce an ExtUtils::MakeMaker-powered Makefile.PL. Dist::Zilla will deal with everything required to create a proper Makefile.PL, so you do not need to know anything about ExtUtils::MakeMaker. Unless you are doing something special, you almost certainly want to use this plugin.The UploadToCPAN plugin will allow you to use the dzil release command to upload your distribution to CPAN.It is important to note that each plugin takes effect in the order the plugins are specified in your dist.ini.There are many plugins available for Dist::Zilla - over 1,200 thus far - so you will probably find one that can do just about anything you could possibly need for creating a distribution. Here is a link for a metacpan query for "Dist::Zilla::Plugin", that can be used to explore the Dist::Zilla plugin ecosystem.Here are links to the documentation for the plugins in the example dist.ini that I did not explain: ManifestSkip MetaYAML License ExecDir Manifest AutoPrereqs TestRelease SynopsisDist::Zilla can seem daunting at first, but it is actually quite straightforward and easy to use once you figure it out. The only difficult thing is figuring out what plugins you want to use. Challenges, Solutions and more Challenges and more Solutionsdev.to #perl Published by jonasbn on Sunday 23 October 2022 14:13 I am maintaining two Perl distributions, which are using C-bindings.Crypt::OpenSSL::X509Crypt::OpenSSL::PKCS12I do not do much day to day maintenance, but on occassion there is a PR, which needs to be processed or a report from cpan-testers indicating a failing test, requiring further investigation. The thing it that the surroundings of these distributions change constantly. Circumstances involving change got me involved with the maintenance of the two distributions in the first place, I was a mere user and the platforms I was using these components on, where being updated continuously and we simply needed to keep up.Apparently this never stops and when I could see that I over time got failing tests due to the toolchains used around these kept evolving. The toolchain issue was often related to clang, I was visiting the documentation for clang on several occassions.By adjusting the command line parameters, I could keep the tests passing.Here are some examples on the mentioned docmentation:clang 10 diagnostic flags - https://releases.llvm.org/10.0.0/tools/clang/docs/DiagnosticsReference.htmlclang 11 diagnostic flags - https://releases.llvm.org/11.0.0/tools/clang/docs/DiagnosticsReference.htmlclang 12 diagnostic flags - https://releases.llvm.org/12.0.0/tools/clang/docs/DiagnosticsReference.htmlclang 13 diagnostic flags - https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.htmlclang 14 diagnostic flags - https://releases.llvm.org/14.0.0/tools/clang/docs/DiagnosticsReference.htmlIn order to see if a given option was available in a version or when it was introduced (or deprecated), I surfed across the pages with multiple tabs open, cross-checking command line options etc..And example: -Wunreachable-code-fallthroughPresent in version 14 (https://releases.llvm.org/14.0.0/tools/clang/docs/DiagnosticsReference.html#wunreachable-code-fallthrough) but not in earlier versions.Where: -Wall is present in versions all versions, below some examples:14 (https://releases.llvm.org/14.0.0/tools/clang/docs/DiagnosticsReference.html#wall) - https://releases.llvm.org/14.0.0/tools/clang/docs/DiagnosticsReference.html#wall13 (https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.html#wall) - https://releases.llvm.org/13.0.0/tools/clang/docs/DiagnosticsReference.html#wall4 (https://releases.llvm.org/4.0.0/tools/clang/docs/DiagnosticsReference.html#wall) - https://releases.llvm.org/4.0.0/tools/clang/docs/DiagnosticsReference.html#wallI had a challenge, I needed to keep an overview of the compiler diagnostic parameters. At the same time I could see that a pattern emerged as the URL structure was uniform and the pages had the some structure. So I decided to make a matrix of all of the diagnostic command line flags. The latter was clearly a benefit, so if you are creating similar documentation, please keep this in mind as a use-case.Anyway this lets me introduce: "clang diagnostic flags matrix generator", a Perl application that would iterate over a set of available web pages (one for each version of clang), extract/scrape the information and insert it into a data structure, from which I can print a matrix expressed as a Markdown table. Do note not all versions of clang are represented, but relevant versions and data is available from version 4 and above. Please see the source code for details.And it worked, one can discuss the readability due to the size of the matrix, but I had a challenge and I came up with a solution. The matrix was inserted into my TIL collection under the clang category, it is also available in the clang diagnostic flags matrix generator repository.A new problem occurred however. The matrix would not render correctly on GitHub, it would stop at some point, in the beginning I thought this was a transient error, but it did seem to persist. I did not observe the issue when using GitHub pages or the Markdown preview in Visual Studio Code, so the problem had to be with GitHub. So I reported it as a bug to GitHub and a got an answer, brief and to the point. My Markdown exceeded the limit of file size for rendering on GitHub.Text files over 512 KB are always displayed as plain text. Code is not syntax highlighted, and prose files are not converted to HTML (such as Markdown, AsciiDoc, etc.).REF: GitHub DocumentationI did a check on my file and it exceeded the 512 KB with a size exceeding 1MB.New challenge, how do I decrease the size of the generated Markdown table.I started out by eliminating much of the use of spaces and emojis, the latter I exchanged for ASCII characters. The size decreased, but then version 15.0.0 of clang came along and the size increased. But it was easy to spot the culprit as all of the command line flags would link to their respective documentation per version, meaning that the URL carried a log of redundant information, which was reapeated a lot.After thinking a little I came to the conclusion that had shorten the URL, boiling down all the redundant information like a compression algorithm. I did an experiment, where I just rewrote the URL to a short fake domain name. And immediately I could see an effect and I decided to implement support for redirecting via a short URL to the longer URL.I did some basic checks, since I could isolate the Markdown matrix/table output from the generator. The data is based on a matrix covering versions from 4 to 14.947393 KB with emojis and original (long) URLs926691 KB emojis exchanged for ASCII418901 KB no emojis and URLs shortenedAs mentioned version 15 of clang was introduced around the same time I was looking into this, so it gave me the opportunity to calculate as approximate size cost of a new version.462850 KB no emojis and URLs shortened including version 15.So the cost of version 15 is:462850 - 418901 = 43.949 KBMeaning in a few versions the maximum of 512 KB will be exceeded again at some point, but I will look at that challenge when it becomes a problem.Well the solution required a way to shorten the URL. I ended up with a sort of proxy which redirects from my short URL to the original. Actually reversing the change made by the clang diagnostic flags matrix generator.Next up was understanding what the common parts was and what the variables were. Looking at the URLs mentioned above, one will spot:version numberfragmentI could even abbreviate the version number, since it only documented major versions, since command line options was not added a removed via minor or bug releases (semantic versioning for the win).The service should need to support:version as a 1 digit numberfragment, the complete fragmentAnd I came up with the following scheme: //An example:https://releases.llvm.org/5.0.0/tools/clang/docs/DiagnosticsReference.html#rsanitize-addressWould be abbreviated to:https:///5/rsanitize-addressWhich could be expressed as:[X](https:///5/rsanitize-address)I created a basic service implemented in go: pxy-redirect. In addition I needed a short domain name and ended up registering: pxy.fi. The complete solution running at https://pxy.fi, which replaced the original domain name: https://releases.llvm.org/, doming the redirection by:expanding the version numberand transporting the last part of the URL as a fragmentTo recap:The URL: https://releases.llvm.org/5.0.0/tools/clang/docs/DiagnosticsReference.html#rsanitize-address is extracted as part of manual parsingThe Markdown is generated with a shorter representation: [X](https://pxy.fi/5/rsanitize-address)When the link is clicked, the service rewrites from: https://pxy.fi/5/rsanitize-address to https://releases.llvm.org/5.0.0/tools/clang/docs/DiagnosticsReference.html#rsanitize-addressThe the service is deployed with DigitalOcean anb is up and running and I am watching it's logs to spot any weird things.To begin with my code was very aimed at the proxy part, being very transparent, so I decided to introducean index.html for the root, just to introduce the service just in case somebody hit that particular URL, then I could guide them.Introducing index.html, then resulted in requests for favicon.ico and I recently added support for ´robots.txt`, since I could see this was requested.I can see somebody is requesting /login, which is very sweet, but that is not a valid URL and it results in an error. JFYI there is no need to crawl the site since it is a very basic and transparent redirecting proxy and all of the code is open source and is available on GitHubhttps://github.com/jonasbn/pxy-redirectI examined the option to implement this as serverless functions with DigitalOcean, but that will require some more research. If I need to do some more redirection I can added an extra part to the URL so I can separate into namespaces, but I do not currently have this requirement, so it is not implemented.The implementation has been really fun and I can highlight some of the key points:Mojo::UserAgent, which is an awesome tool for HTTP client workGitHub limitationsI am still in the process of learning Go, so it was fun with an experiment, which was not just another tutorialURL fragments and their natureDeploying on DigitalOcean and I want to dig into DigitalOceans functions, because I believe this to be a good use-case for serverless functions over a server solutionIdeas and suggestions for improvements are most welcome. I am thinking about doing some follow up posts on the different components mentioned to walk through the implementation highlighting different aspects, I believe this could also be a good way to spot points of interest for improvements. Magical Days Together with Tripletsdev.to #perl Published by Simon Green on Sunday 23 October 2022 12:21 Weekly Challenge 187Challenge, My solutionAfter a few interstate trips and a bout of COVID-19, it's now onward and upwards to the end of the year. The ICC Men's Twenty20 World Cup has also started here so it's time to change the channel and throw out the remote for the next month. Go Black Caps! Task 1: Days Together TaskTwo friends, Foo and Bar gone on holidays seperately[sic] to the same city. You are given their schedule i.e. start date and end date.To keep the task simple, the date is in the form DD-MM and all dates belong to the same calendar year i.e. between 01-01 and 31-12. Also the year is non-leap year and both dates are inclusive.Write a script to find out for the given schedule, how many days they spent together in the city, if at all. My solutionI really like this challenge, as it makes you think about how to solve them. Date math is never easy. For this task, I convert the four input dates into day of the year (1 = January 1st, 365 = December 31st). In Python, I use the date module, while I use Date::Calc for the Perl solution. This makes the rest of the solution relatively easy.I check that both Foo and Bar don't leave before they arrive. We can calculate the number of days by calculating when the last person arrives and when the first person leaves. If this is a negative number, they didn't see each other. Others we take the value and add 1 to print the solution. Examples$ ./ch-1.py 12-01 20-01 15-01 18-014 days$ ./ch-1.py 02-03 12-03 13-03 14-030 days$ ./ch-1.py 02-03 12-03 11-03 14-032 days$ ./ch-1.py 30-03 05-04 28-03 02-044 days Task 2: Magical Triplets TaskYou are given a list of positive numbers, @n, having at least 3 numbers.Write a script to find the triplets (a, b, c) from the given list that satisfies the following rules.a + b > cb + c > aa + c > ba + b + c is maximum.In case, you end up with more than one triplets having the maximum then pick the triplet where a >= b >= c. My solutionI'm sure there are smarter people doing this challenge that will come up with some formula for figuring out the quickest way to solve this, but some times the brute force approach is good enough. Especially when dealing with small number of things.For this challenge, I use the combinations function from itertools in Python and from Algorithm::Combinatorics in Perl to compute all possible combinations of three digits.I store the 'best' solution so far in the solutions list (which is set to None initially in Python, and an empty arrayref in Perl).I then loop through each combination and determine if the first three criteria are met. If they and the solution value is empty or the sum is greater than the current solution, I set solution to the new list.I finally print the result in the specified format. Examples$ ./ch-2.py 1 2 3 2(3, 2, 2)$ ./ch-2.py 1 3 2()$ ./ch-2.py 1 1 2 3()$ ./ch-2.py 2 4 3(4, 3, 2) The Weekly Challenge - Guest ContributionsThe Weekly Challenge Published on Sunday 23 October 2022 00:00 As you know, The Weekly Challenge, primarily focus on Perl and Raku. During the Week #018, we received solutions to The Weekly Challenge - 018 by Orestis Zekai in Python. It was pleasant surprise to receive solutions in something other than Perl and Raku. Ever since regular team members also started contributing in other languages like Ada, APL, Awk, BASIC, Bash, Bc, Befunge-93, Bourne Shell, BQN, Brainfuck, C3, C, CESIL, Chef, COBOL, Coconut, C Shell, C++, Clojure, Crystal, D, Dart, Dc, Elixir, Elm, Emacs Lisp, Erlang, Excel VBA, Fennel, Fish, Forth, Fortran, Gembase, GNAT, Go, Haskell, Haxe, HTML, Idris, IO, J, Janet, Java, JavaScript, Julia, Kotlin, Lisp, Logo, Lua, M4, Miranda, Modula 3, MMIX, Mumps, Myrddin, Nim, Nix, Node. (cdxv) 12 great CPAN modules released last weekNiceperl Published by Unknown on Saturday 22 October 2022 22:38 Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12.App::Netdisco - An open source web-based network management tool. Version: 2.057008 on 2022-10-18 Votes: 14 Previous version: 2.057007 was 14 days beforeClone - recursively copy Perl datatypes Version: 0.46 on 2022-10-19 Votes: 29 Previous version: 0.45 was 2 years, 5 months, 26 days beforeFuture - represent an operation awaiting completion Version: 0.49 on 2022-10-17 Votes: 56 Previous version: 0.48 was 8 months, 22 days beforeGraphViz - Interface to AT&T's GraphViz. Deprecated. See GraphViz2 Version: 2.25 on 2022-10-22 Votes: 14 Previous version: 2.25 was 2 months, 2 days beforeHTTP::Message - HTTP style message (base class) Version: 6.43 on 2022-10-22 Votes: 61 Previous version: 6.41 was 10 days beforeLog::Log4perl - Log4j implementation for Perl Version: 1.57 on 2022-10-21 Votes: 97 Previous version: 1.56 was 1 month, 19 days beforeMemoize - Make functions faster by trading space for time Version: 1.14 on 2022-10-15 Votes: 25 Previous version: 1.14 was beforeModule::CoreList - what modules shipped with versions of perl Version: 5.20221020 on 2022-10-20 Votes: 40 Previous version: 5.20220920 was 29 days beforeParams::Validate - Validate method/function parameters Version: 1.31 on 2022-10-22 Votes: 34 Previous version: 1.30 was 2 years, 4 days beforePath::Tiny - File path utility Version: 0.130 on 2022-10-20 Votes: 171 Previous version: 0.124 was 1 month, 18 days beforeSPVM - SPVM Language Version: 0.9657 on 2022-10-21 Votes: 27 Previous version: 0.9655 was 9 days beforeType::Tiny::XS - provides an XS boost for some of Type::Tiny's built-in type constraints Version: 0.025 on 2022-10-19 Votes: 15 Previous version: 0.022 was 2 years, 24 days before (dxxviii) metacpan weekly report - Text::TableNiceperl Published by Unknown on Saturday 22 October 2022 22:35 This is the weekly favourites list of CPAN distributions. Votes count: 48Week's winners (+3): Text::TableBuild date: 2022/10/22 20:34:40 GMTClicked for first time:Apache::ParseLog - Object-oriented Perl extension for parsing Apache log filesApp::Gimei - CLI for Data::GimeiCall::Context - Sanity-check calling contextCPAN::FindDependencies - generate reports when modules' dependencies get new releasesData::Gimei - a Perl port of Ruby's gimei generates fake data in Japanese.RPM::Tools - compare installed rpms with up-to-date distributionIncreasing its reputation:Acme::Inabajun::Utils (+1=2)AnyEvent (+1=157)App::cpanminus (+1=269)App::Staticperl (+1=20)Config::General (+1=28)Data::Dumper (+1=99)Data::Page (+1=16)Data::Section::Simple (+1=15)DBIx::Class::ParameterizedJoinHack (+1=5)DBM::Deep (+1=24)Devel::Size (+1=19)Dotenv (+1=7)GBK (+1=3)HTTP::CookieJar (+1=9)HTTP::Tiny (+1=104)IO::AIO (+1=16)Log::Log4perl (+1=97)Math::Prime::Util (+1=19)mb::JSON (+1=3)Memory::Usage (+1=5)Minion (+1=90)Mojolicious (+2=475)Moo (+1=291)Net::Curl (+1=17)Net::Curl::Promiser (+1=4)Net::IDN::Encode (+1=7)Net::LastFM (+1=4)Plack::Middleware::XSRFBlock (+1=8)Promise::ES6 (+1=6)Raisin (+1=43)Rex (+1=81)RPM::Packager (+1=2)Test::Deep (+1=51)Text::Iconv (+1=4)Text::Table (+2=17)URI (+1=106)UTF8::R2 (+1=3)Weather::GHCN::Fetch (+1=2)X::Tiny (+1=4) (dlvi) stackoverflow perl reportNiceperl Published by Unknown on Saturday 22 October 2022 22:33 These are the five most rated questions at Stack Overflow last week.Between brackets: [question score / answers count]Build date: 2022-10-22 20:33:03 GMTPerl, use regex to find a match and replace just the last character of the match (in this case a line break) - [3/3]Perl symmetric difference aka disjunctive union of two sets - [2/3]How to stack function definitions in perl (call them all at once)? - [2/2]Test::More failing test with equal strings - [2/1]Why can't I reference a (particular) Perl array as I'd expect? - [2/1] Buy a Perl 5.36 mug and support The Perl Foundationblogs.perl.org Published by Dean on Thursday 20 October 2022 06:26 Mugs celebrating Perl 5.36 are now available at The Perl Store with all proceeds going to The Perl Foundation Dancer2: Template TinyPerl Maven Published by Gabor Szabo on Wednesday 19 October 2022 08:40 Part of the Dancer2 video course available both to Pro subscribers and attendees of the Perl Dancer course on Leanpub. Containers for CoveragePerl Hacks Published by Dave Cross on Tuesday 18 October 2022 17:01 I’ve been building Docker containers again. And I think you’ll find this one a little more useful than the Perlanet one I wrote about a couple of weeks ago.Several years ago I got into Travis CI and set up lots of my GitHub repos so they automatically ran the tests each time I committed to the repo. Later on, I also worked out how to tie those test runs into Coveralls.io so I got pretty graphs of how my test coverage was looking. I gave a talk about what I had done.But two things changed.Firstly, Travis CI got too popular and, eventually, removed their free service. And, secondly, GitHub Actions was introduced. Over the last few years, I’ve set up many of my repos to use GitHub Actions for CI. But, basically because I’m lazy, I didn’t remove the Travis CI configuration from those repos.But last week I decided the time was right to start work on that. And when I went to remove the .travis.yml I realised that something was missing from my GitHub Actions CI workflows – they were running the unit tests, but they weren’t reporting on test coverage. So it was time to fix that.I needed to reimplement the logic that connected Travis CI to Coveralls.io in a GitHub workflow. That actually turned out to be pretty simple. There’s a CPAN module called Devel::Cover::Report::Coveralls which takes the output from Devel::Cover, converts it to the correct format and sends it to Coveralls.io. And, as a bonus, it has documentation showing how to implement that in a GitHub workflow.So I hacked at my workflow definition file for one of my CPAN modules and within a few minutes I had it working.Well, I say “a few minutes”, but it took over thirteen minutes to run. It turns out that Devel::Cover::Report::Coveralls is a pretty heavyweight module and needs to install a lot of other modules in order to do its work.At this point, you can probably guess where this is going. And you’d be right.I’ve created a Docker container that has Devel::Cover::Report::Coveralls already installed. And, obviously, it’s available for everyone to use from the Docker hub – davorg/perl-coveralls.A couple of small adjustments to my GitHub workflow and the coverage job is now running on my new container – and takes 29 seconds instead of 13 minutes. So that’s a win.The relevant section of my workflow file is here:coverage: runs-on: ubuntu-latest container: davorg/perl-coveralls:latest name: Test coverage steps: - uses: actions/checkout@v3 - name: Install modules run: cpanm -n --installdeps . - name: Coverage env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: cover -test -report CoverallsAnd it’s producing nice graphs on Coveralls.io like the one above.Let me know if you find it useful.The post Containers for Coverage appeared first on Perl Hacks. Board Updates October 2022Perl Foundation News Published by Amber Deuel on Monday 17 October 2022 19:08 Board Updates October 2022WelcomeFollowing nomination in July, 2022, The Perl Foundation is pleased to welcome Todd Rinaldo to the board. Todd has worked with the board for many years as a conference organizer, with the Grants Committee, and in other capacities. He is also a contributor to CPAN and Perl 5 Porters.During his board nomination interview, Todd expressed an interest in offering assistance in the Foundation's mission to help the community, stregthening communication between the steering councils and the board, and helping the board find ways they can support The Perl and Raku Conference going forward. We are pleased to welcome Todd to the board. FarewellNichola Evans has been a valuable member of the TPF team since 2020. During Nic's time with TPF she spearheaded the recent prospectus, organized all meetings and minutes, and served as the board's liason to the community. Recently Nic was helping run the Marketing and Sponsorship Committees, and she kept the community up to date with her articles on the TPF Blog. Truely, Nic contributed more to the community than can be listed in one blog post. We will miss her dearly. CI for CPAN modulesPerl Maven Published by Gabor Szabo on Monday 17 October 2022 10:30 After I read the editorial of Perl Weekly issue 586 I though I should try to sendas many PR as I can to enable GitHub Actions on CPAN projects.There is a whole series about why use CI and how to set up CI and several examples with videos.I started at CPAN Digger #586 - Perl and CamelPerl Weekly Published on Monday 17 October 2022 10:00 Hi there,This is my 115th edition of the weekly newsletter. I know it is nothing as compared to the 323 editions by the chief editor Gabor Szabo. I am very happy to have come this far, thanks to all the readers of the weekly newsletter for the support and encouragements. It took me 4 years and 5 months to achieve this milestone.Please excuse me for the long-winded editorial this week to celebrate the occasion.As we all know Perl and Camel are insperabale for years now. I still remember when I was first introduced to Perl in the late ninetees, we use to refer Perl books as Camel books. The association of Perl with the big publishing house like, O'Reilly is mostly responsible for the trend. Having said, there were few others too in the market but O'Reilly stood out among them. But we can't ignore the ground reality at the same time, for reasons known to most of all, the Perl books started disappearing from the book shelves in recent years. Talking about Perl books, we can't forget the service of brian d foy, Damian Conway, Curtis Poe, Dave Cross, Randall L. Schwartz and many more. Of all those, brian d foy still holding the ground as far as Perl is concerned in my humble opinion.Do you remember the announcement of Perl 7?I still remember, I watched the announcement by Sawyer X and was very excited about it. But as you all know, it didn't turn out as planned. Let's not go there. Immediately after the announcement, brian d foy came up with the book, Preparing for Perl 7, published by {Perl School} run by Dave Cross. I was lucky to get the FREE copy of the book by brian d foy. I thoroughly enjoyed it as his many other Perl books. While collecting informations for this editorial, I noticed the book is now declared retired, unfortunately.Fast forward, in the year 2021, we got another book, Perl new features v5.10 to v5.34 by brian d foy. Once again, I was offered the book for FREE by the author. I would highly recommend this book to anyone who is new to Perl or even if you have used Perl for years. I found many new features that I wasn't aware of earlier. The best part is the explanation of each features with great examples. It makes it so easy to understand the topic. I read the book from start to end and came up with my own examples of some of the features mentioned in the book. Those who follow me on Facebook, Twitter and LinkedIn knows that I ran daily feature series where I shared one feature with examples everyday. It is now documented for future reference in the form of GitHub repository as suggested by Dave Cross.How many of you have read the book "Learning Perl"?I have during my early days of learning Perl. It was the main source of information for me. Keeping the tradition on, brain d foy alongwith Randall L. Schwartz and Tom Phoenix came up with the 8th Edition. This time, I was offered not one (1) but four (4) copies of the physical book with free delivery by the generous brian d foy. I picked four members of Team PWC(The Weekly Challenge) and hand it over the book, Learning Perl 8th edition. A very big thank you to brian d foy from the entire Team PWC members.Do you think it stopped there?Well, the short answer is "No". Recently brian d foy contacted me and offered me 50 coupons of his new creation Learning Perl Exercises. Honestly speaking, I didn't know about the book earlier. I have been giving one coupon every week to one lucky member of Team PWC. So far, I have already given 10 coupons. If you are a Perl fan or new to Perl then why don't you join us and learn from each other something new every week. Trust me, you will enjoy the journey.How well do I know brian d foy?Honestly speaking I haven't met him yet but would love to one day. My first interaction with him was in the year 2010 when I published my first distribution, Test::Excel. During those days, one need to get the namespace registered with PAUSE admins. He is one of the PAUSE admins that I happen to interact with. I still remember during the email conversation he mentioned that he liked my distribution and one day he would use it. Ever since, I have had many email conversation with on different occasions. I proudly remember one such occasion when brian d foy offered me to do interview series for perl.com. I happily accepted his offer without even blinking once. I did three interviews namely with Gabor Szabo, Curtis Poe and Damian Conway. Unfortunately after that I got distracted and busy with other personal projects.Have you tried GitHub Workflow yet?Two names i.e. Gabor Szabo and Dave Cross immediately come to my mind when talking about GitHub Workflow. In fact, Gabor Szabo seems to be on a mission to help CPAN modules to have workflow configured. Recently I published a new release of Test::CSS, the very next morning I noticed blog post by him. I would highly recommend you to take a look at his other similar works. Talking about GitHub Workflow, my colleague at work and friend, Julien Fiegehenn, wrote a detailed and thorough guide on the topic, you really don't want to skip it.How many of you have completed the challenge of Hacktoberfest 2022?One thing I noticed this year, the pull request has to be accepted and merged for it to qualify. Now even after the pull request is accepted and merged, you still have to wait for another seven days review period. This year, I was lucky to receive the distribution, HTML::Form as my assignment for October as member of Pull Request Club. To my surprise, I noticed HTML::Form is participating in Hacktoberfest 2022. As of today, I have submitted 2 Pull Requests. That means, I am done as far as my monthly assignment for Pull Request Club. With regard to the Hacktoberfest 2022, both the pull requests have been accepted and merged, thanks to Olaf Alders. One of them is passed the review period and other is still waiting. Although I submitted 2 more pull requests but unfortunately they are not participating in Hacktoberfest 2022, although both have been accepted and merged. To qualify for FREE specially designed T-shirt, I still have to find a distribution and submit 2 more pull requests. Wish me luck.Have you nominated your Perl Hero?If not then you still have chance to nominate your Perl Hero. Quick and easy to nominate is just commenting on this official announcement and giving the name with reasons. Easy, right?Enjoy the rest of the newsletter. Zippy Fast Dubious OCR ProcessRabbitFarm Perl Published on Sunday 16 October 2022 22:38 The examples used here are from the weekly challenge problem statement and demonstrate the working solution.Part 1You are given two lists of the same size. Create a subroutine sub zip() that merges the two lists.Solutionuse v5.36;use strict;use warnings;sub zip($a, $b){ return map { $a->[$_], $b->[$_] } 0 .. @$a - 1;}MAIN:{ print join(", ", zip([qw/1 2 3/], [qw/a b c/])) . "\n"; print join(", ", zip([qw/a b c/], [qw/1 2 3/])) . "\n";}Sample Run$ perl perl/ch-1.pl1, a, 2, b, 3, ca, 1, b, 2, c, 3NotesThe solution here is basically that one line map. Since we know that the listsare of the same size we can map over the array indices and then construct thedesired return list directly.Part 2You are given a string with possible unicode characters. Create a subroutine sub makeover($str) that replace the unicode characters with their ascii equivalent.For this task, let us assume the string only contains letters.Solutionuse utf8;use v5.36;use strict;use warnings;### You are given a string with possible unicode characters. Create a subroutine # sub makeover($str) that replace the unicode characters with their ascii equivalent.# For this task, let us assume the string only contains letters.##use Imager;use File::Temp q/tempfile/;use Image::OCR::Tesseract q/get_ocr/;use constant TEXT_SIZE => 30;use constant FONT => q#/usr/pkg/share/fonts/X11/TTF/Symbola.ttf#;sub makeover($s){ my $image = Imager->new(xsize => 100, ysize => 100); my $temp = File::Temp->new(SUFFIX => q/.tiff/); my $font = Imager::Font->new(file => FONT) or die "Cannot load " . FONT . " ", Imager->errstr; $font->align(string => $s, size => TEXT_SIZE, color => q/white/, x => $image->getwidth/2, y => $image->getheight/2, halign => q/center/, valign => q/center/, image => $image ); $image->write(file => $temp) or die "Cannot save $temp", $image->errstr; my $text = get_ocr($temp); return $text;}MAIN:{ say makeover(q/ Ã Ê Í Ò Ù /);}Sample Run$ perl perl/ch-2.plEIONotesFirst I have to say upfront that this code doesn't work all that well for the problemat hand! Rather than modify it to something that works better I thought I wouldshare it as is. It's intentionally ridiculous and while it would have been greatif it worked better I figure it's worth taking a look at anyway.So, my idea was:take the input text and generate an imageocr the imagethe ocr process would ignore anything non-text (emojis and other symbols)the ocr process would possibly ignore the accent marksI wasn't so sure about that last one. A good ocr should maintain the true letters, accents and all. Tesseract, the ocr engine used here, claims to supportUnicode and "more than 100 languages" so it should have reproduced the originalinput text, except that it didn't. In fact, for a variety of font sizes and lettercombinations it never detected the accents. While I would be frustrated if I wantedthat feature to work well, I was happy to find that it did not!Anyway, to put it mildly, it's clear that this implementation is fragile for the task at hand!In other ways it's pretty solid though. Imager is a top notch image manipulation modulethat does the job nicely here. Image::OCR::Tesseract is similarly a high qualitywrapper around the Tesseract ocr engine. Tesseract itself is widely accepted as beingworld class. My lack of a great result here is mainly due to my intentional misuseof these otherwise fine tools!ReferencesImagerImage::OCR::TesseractChallenge 186 Colin Crain › Perl Weekly Review #180The Weekly Challenge Published on Monday 17 October 2022 00:00 ( …continues from previous week. )Welcome to the Perl review pages for Week 180 of The Weekly Challenge! Here we will take the time to discuss the submissions offered up by the team, factor out some common methodologies that came up in those solutions, and highlight some of the unique approaches and unusual code created. ●︎ Why do we do these challenges? I suppose any reasonable answer to that question would come from a field as wide ranging and varied as the people who choose to join the team. RECAP - The Weekly Challenge - 186The Weekly Challenge Published on Monday 17 October 2022 00:00 TABLE OF CONTENTS 01. HEADLINES 02. STAR CONTRIBUTORS 03. CONTRIBUTION STATS 04. GUESTS 05. LANGUAGES 06. CENTURION CLUB 07. DAMIAN CONWAY’s CORNER 08. ANDREW SHITOV’s CORNER 09. PERL SOLUTIONS 10. RAKU SOLUTIONS 11. PERL & RAKU SOLUTIONS HEADLINES Thank you Team PWC for your continuous support and encouragement.STAR CONTRIBUTORS Following members shared solutions to both tasks in Perl and Raku as well as blogged about it. The Weekly Challenge - 187The Weekly Challenge Published on Monday 17 October 2022 00:00 TABLE OF CONTENTS 01. HEADLINES 02. SPONSOR 03. RECAP 04. PERL REVIEW 05. RAKU REVIEW 06. CHART 07. NEW MEMBERS 08. GUESTS 09. TASK #1: Days Together 10. TASK #2: Magical Triplets HEADLINES Welcome to the Week #187 of The Weekly Challenge.Please welcome izem to the Team PWC. Thanks izem for your first contributions in Perl and Python.We are into the third week of Hacktoberfest 2022. I am not surprised the rise of popularity of The Weekly Challenge. (cdxiv) 13 great CPAN modules released last weekNiceperl Published by Unknown on Saturday 15 October 2022 22:04 Updates for great CPAN modules released last week. A module is considered great if its favorites count is greater or equal than 12.App::DBBrowser - Browse SQLite/MySQL/PostgreSQL databases and their tables interactively. Version: 2.304 on 2022-10-12 Votes: 12 Previous version: 2.303 was 2 months, 21 days beforeDateTime::TimeZone - Time zone object base class and factory Version: 2.55 on 2022-10-12 Votes: 19 Previous version: 2.54 was 18 days beforeExporter::Tiny - an exporter with the features of Sub::Exporter but only core dependencies Version: 1.004004 on 2022-10-15 Votes: 21 Previous version: 1.004003 was 15 days beforeHTML::Parser - HTML parser class Version: 3.79 on 2022-10-12 Votes: 43 Previous version: 3.78 was 6 months, 15 days beforeHTTP::Message - HTTP style message (base class) Version: 6.41 on 2022-10-12 Votes: 61 Previous version: 6.39 was 4 days beforeJSON - JSON (JavaScript Object Notation) encoder/decoder Version: 4.10 on 2022-10-09 Votes: 98 Previous version: 4.09 was 2 months, 8 days beforeJSON::PP - JSON::XS compatible pure-Perl module. Version: 4.12 on 2022-10-08 Votes: 16 Previous version: 4.12 was beforeMCE - Many-Core Engine for Perl providing parallel processing capabilities Version: 1.881 on 2022-10-14 Votes: 91 Previous version: 1.879 was 4 months, 21 days beforeMCE::Shared - MCE extension for sharing data supporting threads and processes Version: 1.878 on 2022-10-10 Votes: 14 Previous version: 1.877 was 4 months, 17 days beforeMojolicious - Real-time web framework Version: 9.28 on 2022-10-14 Votes: 474 Previous version: 9.27 was 1 month, 2 days beforeSPVM - SPVM Language Version: 0.9655 on 2022-10-12 Votes: 27 Previous version: 0.9654 was 7 days beforeText::Table - Organize Data in Tables Version: 1.135 on 2022-10-12 Votes: 15 Previous version: 1.134 was 2 years, 4 months, 28 days beforeURI - Uniform Resource Identifiers (absolute and relative) Version: 5.16 on 2022-10-12 Votes: 105 Previous version: 5.13 was 6 days before (dxxvii) metacpan weekly report - mb::JSONNiceperl Published by Unknown on Saturday 15 October 2022 21:57 This is the weekly favourites list of CPAN distributions. Votes count: 52Week's winners (+3): mb::JSONBuild date: 2022/10/15 19:56:27 GMTClicked for first time:Acme::CPANModules::PortedFrom::Ruby - Modules/applications that are ported from (or inspired by) Ruby librariesApp::wsgetmail - Fetch mail from the cloud using webservicescPanel::APIClient - cPanel APIs, à la TIMTOWTDI!EAV::XS - Email Address Validation LibraryMail::Log::Parse - Parse and return info in maillogs.Math::Numerical - Algorithms for numerical functions (solver, root findings, etc.)Increasing its reputation:AnyEvent (+1=156)API::Plesk (+1=2)App::dateseq (+1=2)App::DBBrowser (+1=12)App::GhostWork (+1=2)App::GUI::Harmonograph (+1=3)BioPerl (+1=30)CHI (+1=53)CHI::Driver::Redis (+1=3)common::sense (+1=22)Config::Crontab (+1=6)Cpanel::JSON::XS (+1=42)cPanel::PublicAPI (+1=4)cPanel::TaskQueue (+1=2)DateTime (+1=208)enum (+1=12)Exporter::Simple (+1=3)IPC::Pipeline (+1=7)Jacode (+1=3)Jacode4e (+1=3)Jacode4e::RoundTrip (+1=3)JSON::XS (+1=112)libwww::perl (+1=158)List::Keywords (+1=9)List::UtilsBy (+1=38)mb (+1=2)mb::Encode (+1=2)mb::JSON (+3=3)Modern::Open (+1=3)Module::CoreList (+1=40)perl (+2=398)perlfaq (+1=10)PerlIO::gzip (+1=13)Promise::ES6 (+1=5)Rex::Group::Lookup::Nagios (+1=2)Scalar::List::Utils (+1=163)Selenium::Remote::Driver (+1=46)Syntax::Operator::Equ (+1=4)Syntax::Operator::In (+1=2)Template::Toolkit (+1=138)Term::ANSIColor (+1=58)Unicode::Normalize (+1=10)Win32::LongPath (+1=7) Dancer2: Upload filePerl Maven Published by Gabor Szabo on Thursday 13 October 2022 07:40 Part of the Dancer2 video course. Mystery Buglet #2blogs.perl.org Published by Buddy Burden on Thursday 13 October 2022 06:24 Hey! I know, I know: long time, no blog. I would love to blame the pandemic, but the truth is, I just haven’t been inspired with any sufficiently Perl-y topics lately. Until recently, when I ran into this.Now, once upon a time, I wrote a post about a small buglet I had encountered. The post presented the problem, then asked you if you saw the problem, then explained what was going on. So let’s do that again. First, the code:sub generate_temp_file{ state $TMPFILES = []; END { unlink @$TMPFILES } my $tmpfile = `script-which-generates-tempfile`; chomp $tmpfile; push @$TMPFILES, $tmpfile; return $tmpfile;}As before, the actual code does a bit more, but I promise I’ve omitted nothing that’s relevant to the bug. Do you see it? If not, click to find out more. Hey! I know, I know: long time, no blog. I would love to blame the pandemic, but the truth is, I just haven’t been inspired with any sufficiently Perl-y topics lately. Until recently, when I ran into this.Now, once upon a time, I wrote a post about a small buglet I had encountered. The post presented the problem, then asked you if you saw the problem, then explained what was going on. So let’s do that again. First, the code:sub generate_temp_file{ state $TMPFILES = []; END { unlink @$TMPFILES } my $tmpfile = `script-which-generates-tempfile`; chomp $tmpfile; push @$TMPFILES, $tmpfile; return $tmpfile;}As before, the actual code does a bit more, but I promise I’ve omitted nothing that’s relevant to the bug. Do you see it? If not, click to find out more.You might be able to spot the bug just from reading the code, but I can also offer you a big hint by telling you what the actual error was. First off, I should note that there was no error in my testing. Then I committed the code and pushed it out to the repo, where all my fellow developers propmptly downloaded it and started using it... and there was still no error. Then, one coworker (our sysadmin, as it happened) ran the script which used this code in a particular way, and reported this error: Can't use an undefined value as an ARRAY reference at ... and the line number that contained unlink @$TMPFILES.To see what’s going on here, it’s worth taking a brief detour into what a state variable is. If you’re familiar with the C-based family of languages (e.g. C++, and I’m pretty sure Java as well), it’s what they would refer to as a static variable. I don’t know if I agree that state was the best name for it, but it sure beats the hell out of static.So what’s a state variable? Well, it’s a bit like a global variable... and also not. To explain that apparent contradiction, and also to address why state variables are awesome while everyone knows that globals are bad, we need to pick apart that stereotype. Are all global variables bad? Well... depends on what you mean by “global.” See, when we talk about a “global variable,” we’re talking about a variable with global scope. And scope actually consists of two distinct parts: visibility, and lifetime. Most of the variables that we refer to as “globals” are those which have global visibility and global lifetime. And those are definitely bad. But they’re bad because the global visibility part is bad. That’s what causes all the trouble. But the global lifetime part... nothing wrong with that at all. And a state variable is one which has a global lifetime, but only block visibility.1 And that’s not bad at all. It’s quite useful, in fact.Now, if my tempfile were being generated by Perl, I would of course use File::Temp (or something which in turn used it, such as Path::Tiny), and that would handle the cleanup for me. But, since the file is being generated by some script, I need to arrange that cleanup myself. How do I do that? simple: by using an END block, which will always get called when my program exits.2 Admittedly, my simplistic use of it assumed that unlink is fine with receiving no arguments (e.g. in the case where the function hasn’t actually been called yet, and thus @$TMPFILES is empty). By the way, if you’re wondering why I’m using state $TMPFILES = [] and @$TMPFILES instead of state @TMPFILES and @TMPFILES, it’s because one of state’s quirks is, it will only work with scalar variables.But, as it turns out, unlink is fine with getting an empty list (I tested it). So that wasn’t the problem. Still, the last two sentences of the previous paragraph, when combined, contain the answer to the mystery. If you haven’t spotted it by now, you may want to take a moment to reread them carefully and see if I you see it before proceeding further.Still stumped?Very well, then. Read on.What does happen if the function is never called? Well, $TMPFILES still exists: it’s a (sorta kinda) global, so the END block can access it perfectly fine even if the function is never executed. And that’s important, because END blocks are processed at compile time. In fact, that very sticking point is why I’m using the state variable in the first place. That is, why can’t I just do it this way?sub generate_temp_file{ my $tmpfile = `script-which-generates-tempfile`; chomp $tmpfile; END { unlink $tmpfile } push @$TMPFILES, $tmpfile; return $tmpfile;}It’s because END happens at compile-time, when $tmpfile hasn’t been set yet. Not to mention what happens if generate_temp_file is called multiple times: the END block only gets added to the chain of END blocks for the program once, so it only gets called once: if there’s a possibility of this function happening multiple times, I need to store my tempfiles in an array. None of those would be an issue if END happened at run-time, of course. But that ain’t the way it works.3So I’ve set it up to handle all that, by using a (semi-)global state var, which will always exist, and can contain multiple things, and can get processed once by the END block. Except that I had to use $TMPFILES = [] instead of @TMPFILES, like I really wanted, and that’s where it all fell apart. See, the variable certainly exists whether the function is executed or not... but it only gets assigned the first time it’s called. So, before the function is called for the first time, $TMPFILES is not []... it’s undef. And that’s what triggered the error message, of course. If state would let me declare an array instead of an arrayref, I wouldn’t have had the problem, but, once again: that ain’t the way it works.So, in the end, once I finally realized the problem, the fix was trivial:- END { unlink @$TMPFILES }+ END { unlink @$TMPFILES if $TMPFILES }And now it works whether the function is called (which it always was in my testing, and always was in most of my coworkers’ usages), or whether it’s never called at all (which was the case when my sysadmin ran it). And it taught me a valuable lesson about the interaction of seemingly unrelated implementation details of the language. And now I’ve shared it with you.Hopefully it’s been helpful.__________1 Assuming you declare it inside a block. I suppose a state var outside any block would have file visibility, or package visibility, or somesuch. But that’s a more esoteric usage that we don’t really need to get into.2 Well, not always... in fact, the (unflattering) comparison between Perl’s END and bash’s trap ... EXIT was one of the points I made in my post on Perl vs shell scripts (see the “Commands on Exit” section).3 Although, it occurs to me that, if I were using Perl5.36+, I could probably work around this by using defer instead of END. I think. Perl Weekly Challenge 186: Zip List and Unicode Makeoverblogs.perl.org Published by laurent_r on Wednesday 12 October 2022 02:55 These are some answers to the Week 186 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 Oct. 16, 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: Zip ListYou are given two lists @a and @b of same size.Create a subroutine sub zip(@a, @b) that merges the two lists as shown in the example below.Example:Input: @a = qw/1 2 3/; @b = qw/a b c/;Output: zip(@a, @b) should return qw/1 a 2 b 3 c/; zip(@b, @a) should return qw/a 1 b 2 c 3/;Zip List in RakuRaku has a built-in zip routine, so we will name zip-it our subroutine to avoid any confusion. In addition, Raku has an infix Z operator which performs exactly what is requested in the task. So we will use this operator in thezip-it subroutine.sub zip-it (@a, @b) { return ~ (@a Z @b).flat;}my @tests = , ;say zip-it @tests[0], @tests[1];say zip-it @tests[1], @tests[0];This script displays the following output:$ raku ./zip-list.raku1 a 2 b 3 ca 1 b 2 c 3Zip List in PerlThe program iterates over the indices of any of the two lists (which have the same size) and concatenates to the output the corresponding values of both arrays. use strict;use warnings;use feature qw/say/;sub zip { my @c = @{$_[0]}; my @d = @{$_[1]}; my $out = ""; for my $i (0..$#c) { $out = $out . $c[$i] . " " . $d[$i] . " " ; } return $out;}my @tests = ([], []);say zip $tests[0], $tests[1];say zip $tests[1], $tests[0];This script displays the following output:$ perl ./zip-list.pl1 a 2 b 3 ca 1 b 2 c 3Task 2: Unicode MakeoverYou are given a string with possible unicode characters.Create a subroutine sub makeover($str) that replace the unicode characters with ascii equivalent. For this task, let us assume it only contains alphabets.Example 1:Input: $str = 'ÃÊÍÒÙ';Output: 'AEIOU'Example 2:Input: $str = 'âÊíÒÙ';Output: 'aEiOU'I’m not sure what is meant by “it only contains alphabets,” but the two examples provided only contain vowels in the right alphabetical order. In my implementations, I’ve used the two test cases provided above and added a third test case, just for testing a few more letters, without attempting to satisfy any particular order.I don’t like very much problems dealing with Unicode because, while I know quite a few things about Unicode, UTF8, and so on, I usually don’t fully understand what is going on at a deeper level. As a result, I often end up trying various things until it works properly, and this is really not my vision of what a programmer should be doing.Unicode Makeover in RakuIn Raku, we’ll use the built-in samemark routine, which does exactly what we need.sub makeover ($in) { return $in.samemark('a');}for 'ÃÊÍÒÙ', 'âÊíÒÙ', 'àçùòîéèûä' -> $test { say "$test -> \t", makeover($test);}This script displays the following output:$ raku ./unicode_makeover.rakuÃÊÍÒÙ -> AEIOUâÊíÒÙ -> aEiOUàçùòîéèûä -> acuoieeuaUnicode Makeover in Perluse strict;use warnings;use feature 'say';use utf8;use Unicode::Normalize;binmode(STDOUT, ":utf8");sub makeover { return join '', map { /(.)/ } map { /(\X)/g } NFD shift;}for my $test ('ÃÊÍÒÙ', 'âÊíÒÙ', 'àçùòîéèûä' ) { say "$test -> \t", makeover($test);}This script displays the following output:$ perl ./unicode_makeover.plÃÊÍÒÙ -> AEIOUâÊíÒÙ -> aEiOUàçùòîéèûä -> acuoieeuaWrapping upThe 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 October 23, 2022. And, please, also spread the word about the Perl Weekly Challenge if you can. Perl Weekly Challenge 185: MAC Address and Mask Codeblogs.perl.org Published by laurent_r on Wednesday 12 October 2022 02:27 These are some answers to the Week 185 of the Perl Weekly Challenge organized by Mohammad S. Anwar.Task 1: MAC AddressYou are given MAC address in the form i.e. hhhh.hhhh.hhhh.Write a script to convert the address in the form hh:hh:hh:hh:hh:hh.Example 1:Input: 1ac2.34f0.b1c2Output: 1a:c2:34:f0:b1:c2Example 2:Input: abc1.20f1.345aOutput: ab:c1:20:f1:34:5aMAC Address in RakuThis is done in a hurry, less than 45 minutes before the deadline. There might be a better or simpler way to solve this task, but using a couple of regexes is so simple that I don’t see any reason to try something else.for "1ac2.34f0.b1c2", "abc1.20f1.345a" -> $test { $_ = $test; s:g/\./:/; s:g/(\w\w)(\w\w)/$0:$1/; .say;}This script displays the following output:$ raku ./mac-address.raku1a:c2:34:f0:b1:c2ab:c1:20:f1:34:5aMAC Address in PerlAlso using two regexes in Perl:use strict;use warnings;use feature qw/say/;for my $test ("1ac2.34f0.b1c2", "abc1.20f1.345a") { $_ = $test; s/\./:/g; s/(\w\w)(\w\w)/$1:$2/g; say;}This script displays the following output:$ perl ./mac-address.pl1a:c2:34:f0:b1:c2ab:c1:20:f1:34:5aTask 2: Mask CodeYou are given a list of codes in many random format.Write a script to mask first four characters (a-z,0-9) and keep the rest as it is.Example 1Input: @list = ('ab-cde-123', '123.abc.420', '3abc-0010.xy')Output: ('xx-xxe-123', 'xxx.xbc.420', 'xxxx-0010.xy')Example 2Input: @list = ('1234567.a', 'a-1234-bc', 'a.b.c.d.e.f')Output: ('xxxx567.a', 'x-xxx4-bc', 'x.x.x.x.e.f')Mask Code in RakuThe idea is to iterate over the input string and use a regex substitution to replace alphanumeric characters with “x” four times.I started this task trying to use only one counter ($count), but quickly found that there are a number of edge cases where it would not work properly. So we need to manage separately the number of successful matches ($count) and the place where to start the next search ($/.to, i.e. the atom next to the last successful match).Note that I initially used the \w character class, but then changed it to to remove the “_” (underscore) from it.constant MAX = 4;my @tests = ;for @tests -> $test { my $count = 0; my $result = $test; my $pos = 0; while $count < MAX { $count++ if $result ~~ s:c($pos)//x/; $pos = $/.to; } say "$test\t => $result";}This script displays the following output:$ raku ./mask-code.rakuab-cde-123 => xx-xxe-123123.abc.420 => xxx.xbc.4203abc-0010.xy => xxxx-0010.xy1234567.a => xxxx567.aa-1234-bc => x-xxx4-bca.b.c.d.e.f => x.x.x.x.e.f12__34567.a => xx__xx567.aMask Code in PerlI used a different strategy in Perl: the input string is split into an array of characters in order to test each character individually.use strict;use warnings;use feature qw/say/;use constant MAX => 4;my @tests = qw;for my $test (@tests) { my $result = ""; my $count = 0; for my $char (split //, $test) { if ($count < MAX and $char =~ /[A-Za-z0-9]/) { $char = 'x'; $count++; } $result .= $char; } say "$test\t => $result";}Note that this program would not work the same way as the Raku program above for strings containing non-ASCII alphanumeric characters, but I don’t really care, since we have not been given any indication on how to manage non-ASCII Unicode characters. It would not be difficult to obtain the same behavior as the Raku program with something like this: if ($count < MAX and $char =~ /[A-Za-z0-9]/ and $char ne '_') {This script displays the following output:$ perl ./mask-code.plab-cde-123 => xx-xxe-123123.abc.420 => xxx.xbc.4203abc-0010.xy => xxxx-0010.xy1234567.a => xxxx567.aa-1234-bc => x-xxx4-bca.b.c.d.e.f => x.x.x.x.e.f12__34567.a => xx__xx567.aWrapping upThe 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 October 16, 2022. And, please, also spread the word about the Perl Weekly Challenge if you can. Adding GitHub Actions to Math::NumericalPerl Maven Published by Gabor Szabo on Tuesday 11 October 2022 11:50 Starting at CPAN::Digger I found the Math::Numerical distributionwithout any Continuous Integration configured. GitHub Actions for Pinto-Remote-SelfContainedPerl Maven Published by Gabor Szabo on Tuesday 11 October 2022 10:30 Starting off from CPAN Digger I wanted to add Github Actions configuration file to Pinto-Remote-SelfContained. Not that PR, thanksPerl Hacks Published by Dave Cross on Monday 10 October 2022 16:01 It’s October. And that means that Hacktoberfest has started. If you can get four pull requests accepted on other people’s code repositories during October then you can win a t-shirt.In many ways, I think it’s a great idea. It encourages people to get involved in open source software. But in other ways, it can be a bit of a pain in the arse. Some people go crazy for a free t-shirt and that means you’ll almost certainly get several pull requests that aren’t really of the quality you’d hope for.I have a particular problem that probably isn’t very common. I’ve talked before about the “semi-static” sites I run on GitHub Pages. There’s some data in a GitHub Repo and every couple of hours the system wakes up and runs some code which generates a few HTML pages and commits those HTML pages into the repo’s “/docs” directory. And – hey presto! – there’s a new version of your web site.A good example is Planet Perl. The data is a YAML file which mostly consists of a list of web feeds. Every couple of hours we run perlanet to pull in those web feeds and build a new version of the web site containing the latest articles about Perl.Can you see what the problem is?The problem is that the most obvious file in the repo is the “index.html” which is the web site. So when people find that repo and want to make a small change to the web site they’ll change that “index.html” file. But that file is generated. Every few hours, any changes to that file are overwritten as a new version is created. You actually want to change “index.tt”. But that uses Template Toolkit syntax, so it’s easy enough to see why people with no Perl knowledge might want to avoid editing that.The README file for the project explains which files you might want to change in order to make different types of changes. But people don’t read that. Or, if they do read it, they ignore the bits that they don’t like.So I get pull requests that I have to reject because they change the wrong files.Last year I got enough of these problematic pull requests that I decided to automate a solution. And it’s this pretty simple GitHub Workflow. It runs whenever my repo receives a pull request and looks at the files that have been changed. If that list of files includes “docs/index.html” then the PR is automatically closed with a polite message explaining what they’ve done wrong.This makes my life easier. It’s possible it might make your life easier too. The post Not that PR, thanks appeared first on Perl Hacks. #585 - Handle your Pull-Requests, please!Perl Weekly Published on Monday 10 October 2022 10:00 Hi there!I know you are busy with tons of stuff and I know that as an Open Source developer you are most likely just a volunteer, but so are the people who send you Pull-Requests. It is very unpleasant to do the work, even if it small, send the pull-request and then never hear from the author any more.Looking at my GitHub profile, apparently I created 600 Pull-requests, 530 of them are closed but 70 are still open. Some of them are open since 2011, that is 11 years ago. Some are as small as changing http to https in a URL, accepting (or rejecting) them should not take more than a few second. Finding them might be harder as GitHub does not seem to have a button for that, but you can easily search for them as you can see in my post Listing Pull-request waiting for a user.So I'd like to ask you to check if there are any Pull-Requests waiting for you and try to clean up the queue.Hacktoberfest: If you receive a Pull-request during October, if you like it, accept it and consider marking it according to the instructions for maintainers so the PR will be accepted. (Hacktoberfest recognized 11 PRs I sent since registering, none of the repos are marked as participating. I am not sending the PRs for Hacktoberfest, but it would be encouraging to get the recognition.)Enjoy your week! Colin Crain › Perl Weekly Review #179The Weekly Challenge Published on Monday 10 October 2022 00:00 ( …continues from previous week. )Welcome to the Perl review pages for Week 179 of The Weekly Challenge! Here we will take the time to discuss the submissions offered up by the team, factor out some common methodologies that came up in those solutions, and highlight some of the unique approaches and unusual code created. ●︎ Why do we do these challenges? I suppose any reasonable answer to that question would come from a field as wide ranging and varied as the people who choose to join the team. How I use Yabsm to Manage my Btrfs Snapshotsdev.to #perl Published by Nicholas Hubbard on Thursday 06 October 2022 23:02 I am the author of Yabsm (yet another btrfs snapshot manager), which is written in Perl, and I will explain how I use Yabsm to manage my Btrfs snapshots.This article is meant to supplement the official documentation linked above, and assumes a basic understanding of Linux's Btrfs filesystem.Please note that Yabsm can be configured to suit many different use cases other than the one described here. Snapshots vs BackupsBefore we go on, let's clear up the difference between a snapshot and a backup.A snapshot is a read-only nested subvolume created with a command such as btrfs subvolume snapshot -r $SUBVOLUME $DEST. SNAPSHOTS ARE NOT RELIABLE BACKUPS! If a subvolume is corrupted then all snapshots of that subvolume will also be corrupted.A backup is an incremental backup sent to some location via Btrfs's send/receive commands. These backups will not be corrupted if the subvolume being backed up is corrupted. My Btrfs FilesystemI like to have just one top-level Btrfs subvolume mounted at /. This allows me to snapshot my entire system (excluding nested subvolumes) by running btrfs subvolume snapshot -r / $DEST. My Yabsm ConfigMy configuration is based on the philosophy that because snapshots are both valuable and cheap, it makes sense to take a lot of snapshots.Here is my /etc/yabsm.conf:yabsm_dir=/.snapshots/yabsmsubvol root_subvol { mountpoint=/}snap root { subvol=root_subvol timeframes=5minute,hourly,daily 5minute_keep=36 hourly_keep=72 daily_times=15:00,23:59 daily_keep=62}ssh_backup slackmac { subvol=root_subvol ssh_dest=slackmac dir=/.snapshots/yabsm-slacktop timeframes=daily daily_times=23:59 daily_keep=365}local_backup easystore { subvol=root_subvol dir=/mnt/easystore/backups/yabsm-slacktop timeframes=daily daily_times=23:59 daily_keep=365} Yabsm DirI use the traditional /.snapshots/yabsm directory as my yabsm_dir, which is the location that my snapshots will reside. Yabsm will also use this directory for storing data necessary for performing SSH and local backups. SubvolAs I mentioned earlier, I only have one top-level Btrfs subvolume, so I only need to define one subvol in my Yabsm config, which I name root_subvol. SnapI define one snap named root that tells Yabsm I want to take snapshots of root_subvol in the 5minute, hourly, and daily timeframe categories.In the 5minute timeframe category I keep 36 snapshots. This lets me go to any state of my machine in the last 3 hours in 5 minute increments. I use the 5minute category because it gives me a valuable safety net. How many times have you broken your code that was working 20 minutes ago? If you take 5minute snapshots then you can easily go back to the state of that code 20 minutes ago.In the hourly timeframe I keep 72 snapshots, which allows me to go back 3 days in hourly increments. How many times have you broken code that was working 2 days ago? If you take hourly snapshots (and keep enough of them), you can go back through the state of your machine from 2 days ago, in 1 hour increments.In the daily timeframe category I keep 62 snapshots taken at midnight (23:59) and midafternoon (15:00). This gives me two snapshots per day in the last month.Please note that there is also a weekly and monthly timeframe category. SSH BackupI define one ssh_backup named slackmac that backs up my system to my old MacBook running Slackware.The ssh_dest value is set to slackmac, which is a host defined in the yabsm user's $HOME/.ssh/config file. (Yabsm runs as a daemon process, using the special username yabsm.)The dir value is set to the directory on slackmac where the backups will be located.I perform this ssh_backup only in the daily timeframe category, backing up every night at midnight. I keep 365 of these backups so I can go back an entire year. Local BackupI define one local_backup named easystore that backs up my system to my EasyStore external hard drive.The hard drive is mounted at /mnt/easystore, and I keep my backups in the /backups/yabsm-slacktop directory on the hard drive.Just like my slackmac ssh_backup, I perform my local_backup only in the daily timeframe category, every night at midnight. Finding SnapshotsYabsm provides the find command that I use to jump around to different snapshots and backups. The find command takes two arguments, the first is the name of any of your snaps, ssh_backups, or local_backups. The second argument is a query. The different kinds of queries are all documented in the link above.Instead of repeating the documentation, let's break down a practical example of the find command's usage.How many times have you broken code that worked 30 minutes ago? Because I take 5minute snapshots I can easily get back the state of the code 30 minutes ago.An example:$ diff "$(yabsm find root back-30-mins)/$HOME/projects/foo/script.sh" $HOME/projects/foo/foo.shThis command will show the diff output of the $HOME/projects/foo/foo.sh file with this same file that was snapshotted 30 minutes ago. We can use this output to help figure out what we messed up.The command yabsm find root back-30-mins will output the path to a snapshot for the snap named root that was taken 30 minutes ago. In the example we use our shell's parameter expansion feature to create a string that appends the path to foo.sh to the output of the yabsm find command. This is a powerful pattern!The find command can do more than find a snapshot taken N units ago, it can also: Find the newest or oldest snapshot/backup. Find a snapshot/backup taken on a specific day and time. Find all the snapshots/backups taken before or after a certain time. Find all the snapshots/backups taken between two times. Find all snapshots/backups.The output of yabsm find --help shows some examples:usage: yabsm [--help] [ ]see the section "Finding Snapshots" in 'man yabsm' for a detailed explanation onhow to find snapshots and backups.examples: yabsm find home_snap back-10-hours yabsm f root_ssh_backup newest yabsm f home_local_backup oldest yabsm f home_snap 'between b-10-mins 15:45' yabsm f root_snap 'after back-2-days' yabsm f root_local_backup 'before b-14-d' SynopsisYabsm is a powerful tool for managing your Btrfs snapshots. If you are interested in using Yabsm, then I recommend you consult the official documentation. Building a Perlanet ContainerPerl Hacks Published by Dave Cross on Thursday 06 October 2022 09:43 I’m a dinosaur who still believes that web feeds are a pretty neat idea. I wrote and maintain perlanet (a Perl program for aggregating web feeds into a new feed – and building a web site based on that new feed) and I use it to build a few sites on topics I’m interested in.Last year, I worked out a way to use GitHub Actions to rebuild these sites automatically every few hours – thereby enabling me to host the sites on GitHub Pages (I still think it’s a useful technique, but I sometimes worry slightly about the large number of commits those repos have – someone at GitHub must surely notice one day!)Yesterday, I was doing some light maintenance on one of those sites when I realised that each rebuild of these sites was taking a significant time (by which I mean four or five minutes) and started wondering if there was a way to speed them up and use less of GitHub’s resources. The problem is that Perlanet is a pretty hefty module and each rebuild was installing that module (and, therefore, dozens of other modules) on a pristine Ubuntu container.When you say it like that, the solution is obvious.You don’t need to run your GitHub Actions on the standard containers that GitHub supplies. You can run them on any container that’s available from any public container hosting service. So the solution was to build a Perlanet container and run the jobs using that instead. So that’s how I spent an hour or so yesterday.Here’s the Dockerfile I ended up with:FROM perl:latestRUN apt-get update && \ apt-get -y upgrade && \ apt-get install -y build-essential && \ apt-get install -y cpanminus libtidy-dev libxml++2.6-dev libhtml-tidy-perl && \ cpanm --notest Test::Exception && \ cpanm --notest Perlanet && \ cpanm --notest LWP::Protocol::httpsIt’s (obviously) available on GitHub in case anyone wants to improve on my rather ropey knowledge of Docker.I explicitly install Test::Exception because HTML::Tidy (one of Perlanet’s pre-requisites) needs it and I can’t work out why the standard installation procedure isn’t installing it. And while, LWP::Protocol::https is, strictly speaking, not required by Perlanet, you wouldn’t get very far on the modern web if you only accessed web feeds that are available over HTTP.A little bit of Docker Hub set-up and the container is available for everyone to use (and rebuilt automatically whenever I commit to the repo).It was then just a case of changing my GitHub Actions to use my container. Here’s an example of one of the commits that did that.I realise I’m pretty late to the party here, but I think this is a useful pattern. If you have a Perl library (or, indeed, any other software) that exists to provide a service to users then it’s a great idea to provide a containerised version of that software.And I’m happy to report that my site rebuilds have gone from 4-5 minutes to about 45 seconds.The post Building a Perlanet Container appeared first on Perl Hacks. Feature release 1.32 of Date::Holidays Perl distributiondev.to #perl Published by jonasbn on Tuesday 04 October 2022 18:09 Due to a contribution from Wesley Schwengle (waterkip) I am happy to announce release 1.32 of the Date::Holidays Perl distribution.The release introduces support for:Date::Holidays::BQ, a distribution handling holidays for Bonaire.In addition the adapters for:Date::Holidays::NL (Netherlands), Date::Holidays::Adapter::NLDate::Holidays::AW (Aruba), Date::Holidays::Adapter::AWHave had their:is_holidayis_holiday_dtMethods extended with support for additional parameters so the user can specify, the following parameters:gov for handling special dates influencing government interactionlang so language for holidays names can be specifiedPlease see the specific documentation for the 3 distributions.Date::Holidays::AWDate::Holidays::BQDate::Holidays::NLI am happy that waterkip created the PR to have Date::Holidays support the use for the 3 and it outlines one of the features that would be nice to have implemented, namely support for localized holiday names (#12)Here is a short demo of inquiring whether 2022-12-25 is a holiday in the 3 respective calendars.#!/usr/bin/env perluse strict;use warnings;use Data::Dumper;use Date::Holidays;my $holidays_hashref = Date::Holidays->is_holiday( year => 2022, month => 12, day => 25, countries => ['nl', 'bq', 'aw'],);print STDERR Dumper($holidays_hashref);exit 0;The output:$VAR1 = { 'aw' => 'Pasco di Nacemento', 'bq' => 'Pasco di Nacemento', 'nl' => 'Kerst' };Change log for Date::Holidays. 1.32 2022-10-03 Feature release, update not requiredIntroduction of Date::Holidays::Adapter::BQ for adapting Date::Holidays::BQSupport for extra parameters for is_holiday and is_holiday_dt:Date::Holidays::NL via Date::Holidays::Adapter::NLDate::Holidays::AW via Date::Holidays::Adapter::AWDate::Holidays::BQ via Date::Holidays::Adapter::BQAll via PR #70 (https://github.com/jonasbn/perl-date-holidays/pull/70) by Wesley Schwengle (@waterkip) author of:Date::Holidays::NLDate::Holidays::AWDate::Holidays::BQFixed and clean up to Dist::Zilla configuration by @jonasbn Nominate heroes for the 2022 White Camel AwardsPerl Foundation News Published by Makoto Nozaki on Monday 03 October 2022 23:00 We're looking for nominations for the 2022 White Camel Awards that recognize significant non-technical achievement in the Perl community. Each year we recognize work in the broad categories of community, advocacy, and user groups. The Board will consider all nominations and will solicit feedback from the Advisory Board and the Perl Steering Council. To nominate someone, you can respond here with a name and your reasoning. As our community has become more diverse, we request that the reasoning is written so that it’s understandable for those who do not know the nominee directly.Previously, the awards were organized by brian d foy with The Perl Foundation. We appreciate brian’s leadership in the past years. The past awards recipients and their achievements are at https://www.perl.org/advocacy/white_camel/Raku language awards will be arranged separately. #584 - Hacktoberfest & PerlPerl Weekly Published on Monday 03 October 2022 10:00 Hi there,Happy Hacktoberfest 2022 everyone !!!I am sure, most of you, already started hacking open source code. If not then you haven't missed the train yet. You still have plenty of time to submit at least 4 Pull Requests to qualified repositories in GitHub or GitLab. If you are new to Hacktoberfest then I suggest you please take a look at this page.The rule of the game has changed since I first participated in the year 2015. I have received the specially designed T-shirt every year after completing the challenge ever since. As far as Perl is concerned, there are plenty of choices we have. However you have to make sure the open source project is taking part in the Hacktoberfest event. As mentioned in the official note, you have to be quick as only the first 40,000 participants who complete the challenge are eligible to receive the FREE T-shirt.Almost all my opensource contributions are hosted on GitHub, you are FREE to pick any from GitLab too. If you are like me, then you can pick and choose the participating repository from the list here. Having said, if you are still not sure then I would recommend two fun open source projects, Pull Request Club run by Kivanc Yizan and The Weekly Challenge.Do you miss London Perl Workshop?There has been discussion started few days ago among the team members behind the LPW. We have an official announcement requesting your opinions about the proposed LPW 2023. I sincerely request you all who participated in the past and would like to attend the event next year. Please do share with your friends too. I have already seen emails with suggestions, being one of the organiser. Thank you for your inputs, much appreciated.Enjoy the rest of the newsletter. List of new CPAN distributions – Sep 2022Perlancar Published by perlancar on Saturday 01 October 2022 00:32 distauthorfirst_versionlatest_versionabstractAcme-CPANModules-DeadPERLANCAR0.0010.001List of dead (no-longer-updated, no-longer-buildable, no-longer-working) modulesAcme-DOBBY-UtilsDOBBY0.010.01The great new Acme::DOBBY::Utils!Algorithm-LCS-XSJOESUF1.04v2.0.2Fast (XS) implementation of the Longest Common Subsequence (LCS) AlgorithmAlien-Build-Plugin-Download-GitLabPLICEASE0.010.01Alien::Build plugin to download from GitLabAlien-LibtensorflowZMUGHAL0.0010.001Alien for Libtensorflow machine learning library C APIAlien-bc-GNUSKIM0.010.03Find or download and install GNU bcAlien-ed-GNUSKIM0.010.02Find or download and install GNU ed.Alt-Lexical-Var-ButSupportModernPerlTOBYINK0.0010.001alternative distribution of Lexical::Var, with support for more modern versions of PerlApp-Angle2ZodiacSKIM0.010.01Base class and script for angle2zodiac conversion.App-GUI-HarmonographLICHTKIND0.4_00.43sculpting beautiful circular drawingsApp-Greple-typeUTASHIRO0.010.01file type filter module for grepleApp-Greple-updateUTASHIRO0.010.03Greple module to update filesApp-ListUtilsPERLANCAR0.0010.001Command-line utilities related to lists in filesApp-Schema-DataSKIM0.010.02Script for Schema data manipulation.App-tarwebPLICEASE0.010.01Open an archive file in your web browser!CPAN-Smoker-UtilsARFREITASv1.0.0v1.0.1Set of CLI's to manage a Perl CPAN smoker machineClass-PlainKIMOTO0.010.04a class syntax for the hash-based Perl OO.Data-HTML-ButtonSKIM0.010.04Data object for HTML button element.Data-HTML-FormSKIM0.010.04Data objects for HTML form.Data-Record-Serialize-Encode-csvDJERIUS0.010.02encode a record as csvData-TraceTIMKA0.010.05Trace when a data structure gets updated.EflPERLMAX0.680.68Perl bindings for the Enlightenment Foundation LibrariesGHCNPUCKERINGv0.22.257v0.22.258collect station objects and weather dataGetopt-EX-RPNUTASHIRO0.010.01RPN calculation module for Getopt::EX command optionHash-Util-RegexpPERLANCAR0.0010.001Hash utility routines related to regular expressionMojo-DB-Role-DBIx-ClassSCESANO0.0010.002provides a convenience role creating a DBIx::Class for your Mojo databaseMojo-DOM-Role-StyleSCESANO0.0010.003Adds a style method to Mojo::DOMMojoX-Log-RotateXLAT1.2226301.222670Makes mojolicious log file rotation easyMojolicious-Plugin-LogrotateCARELINE0.0010.003Logrotate Mojolicious Application logMooX-Role-DBIConnectionCORION0.020.04handy mixin for objects with a DB connectionMooseX-ShortHasMITHALDU1.2224901.222491shortcuts for common Moose has attribute configurationsMuuseMITHALDU1.2224901.222490Moose but with less typingPDKCARELINE0.0010.005personal perl devkitsParallel-ManagerCARELINE0.0010.004fork threads to run some callback togetherPerl5-CoreSmokeDB-SchemaABELTJE1.071.07DBIC::Schema for the smoke reports databasePlack-App-LibarchivePLICEASE0.010.02Serve an archive via libarchive as a PSGI web appPlack-Middleware-Auth-OAuth2SKIM0.010.01Plack OAuth2 middleware.Plack-Middleware-EmulateOPTIONSRRWOv0.1.0v0.2.1handle OPTIONS requests as HEADPod-L10N-ModelARGRATH1.061.06Model for Pod::L10NProtocol-DqliteFELIPE0.01_010.02Dqlite in PerlRF-Antenna-Planet-MSI-FormatMRDVT0.010.02RF Antenna Pattern File Reader and Writer in Planet MSI FormatRF-FunctionsMRDVT0.010.03Perl Exporter for Radio Frequency (RF) FunctionsSPVM-SysKIMOTO0.010.07System Calls such as File IO, User, Process, Socket,SQL-SimpleOpsCCELSOv2022.212.1v2022.266.1SQL Simple OperationsSchema-DataSKIM0.010.03Abstract class for classes for database data.StancerJDASILVA1.0.01.0.0Stancer Perl librarySubs-TraceTIMKA0.010.02Trace all calls in a package.TableDataBundle-Business-ID-DGIPPERLANCAR20220831.0.020220831.0.0Collection of TableData:: modules related to the Directorate General of Intellectual PropertyTags-HTML-FormSKIM0.010.02Tags helper for form.Tags-HTML-PagerSKIM0.010.03Tags helper for pager.Terminal-IdentifyZTENRETEP0.010.03Module with methods for the control of the terminal windowTest-CircleCHYLLI0.0010.021…Test-Circle2CHYLLI0.0060.009…Test-ReleaseCHYLLI0.0010.001…Test-Release4CHYLLI0.0010.002…Test2-Tools-MemoryCyclePLICEASE0.010.01Check for memory leaks and circular memory referencesText-HyperScriptNYARLA0.040.05The HyperScript like library for Perl.Time-Duration-Concise-LocalizBINARY2.622.62localize concise time duration string representation.Type-FromSahTOBYINK0.0010.005create an efficient Type::Tiny type constraint from a Data::Sah schemaTypes-Sah-FirefoxPERLANCAR0.0010.002Various Sah schemas related to FirefoxUnidexerLNATION0.010.01…Weather-GHCN-FetchPUCKERINGv0.0.001v0.0.003Fetch station and weather data from the NOAA GHCN repositoryWeather-GHCNPUCKERINGv0.0.001v0.0.001collect station objects and weather dataWebService-ADSBExchangeTYUPYRCML0.0011.222600Interface with the ADSBExchange APIWin32-ElevateSUBJUT0.010.01Perl module for gaining higher access privilegeWordList-FromFile-LinePERLANCAR0.0010.001Wordlist from lines of fileWordList-FromFile-WordPERLANCAR0.0010.001Wordlist from words in filesealedJOESUFv4.1.1v4.1.8Run Django Templates in PerlStatsNumber of new CPAN distributions this period: 68Number of authors releasing new CPAN distributions this period: 34Authors by number of new CPAN distributions this period: NoAuthorDistributions1SKIM102PERLANCAR73PLICEASE44CHYLLI45UTASHIRO36PUCKERING37CARELINE38KIMOTO29MITHALDU210MRDVT211TIMKA212SCESANO213TOBYINK214JOESUF215ABELTJE116ARGRATH117CCELSO118CORION119PERLMAX120DOBBY121XLAT122LICHTKIND123LNATION124NYARLA125ARFREITAS126FELIPE127SUBJUT128ZTENRETEP129JDASILVA130TYUPYRCML131RRWO132ZMUGHAL133DJERIUS134BINARY1 #583 - Sponsoring Perl and other Open Source workPerl Weekly Published on Monday 26 September 2022 10:00 Hi there!Happy New Year - Shana Tova - to all the Jews around the world!A couple of days ago Ed Freyfogle wrote us pointig to their post on sponsoring MetaCPAN. I love this on so many levels. First of all, of course the fact that they sponsor some Perl-related activity. They also blog about it. They also send us a heads up to be included here in the Perl Weekly. I hope many more small and large companies, and also individuals will follow them.Dean Hamstead also sent us an email linking to the new Perl Store, that was also announced on The Perl Foundation blog. Buying a T-shirt or some other swag will both help you with clothing and help TPF financially. Nice initiative!Finally, I managed to set up my GitHub sponsors profile. So now, if you'd like to support my Perl and in more general Open Source work (articles, code, and videos) you can do so via GitHub as well. It would be awesome to get a few of you start supporting me via GitHub in the next couple of days. That will help things get rolling there and I would be able to see how the system really works.Enjoy your week! Take part in Hacktoberfest - register between 26 September and 31 OctoberPerl Foundation News Published by Nic Evans on Monday 26 September 2022 07:20 Support perl during October's Hacktoberfest. Running for the last nine years, this annual event is contributed to by thousands of coders and non coders world wide. However small or large, your input will make a difference.Take a look at the Hacktoberfest website and get involved. You can also read about it on the Perl Blogs site. Perl documentation audit project featured at conferencePerl Foundation News Published by Nic Evans on Saturday 24 September 2022 07:08 Khawar Latif presented the findings of his Google Season of Docs perl documentation audit at the IEEE ProComm 2022 and the conference paper, Documentation in Open-Source Organizations: Content Audit and Gap Analysis for Perl, is now published at IEEExplore.Khawar said: “Thanks to Jason McIntosh, Makoto Nozaki and Dan Book for their support, and everyone who helped with the project. I hope this helps Perl and Open Source organizations in general.” @davorg / Monday 24 October 2022 00:58 UTC