This week in PSC (155) | 2024-08-08

Just Graham and Aristotle this time.

  • Discussed tracking perl authorized releasers updates and storing historical data
  • Dual-Life modules need some cleanup to get a more normal release process that can be done more regularly. Cleanup has been done on Storable.
  • Time::HiRes by default doesn’t seem terrible, if possible
  • X509 in core could make sense as part of a more complete interface to OpenSSL
  • Discussion about how it would be possible to have support for Markdown or other new Pod extensions in a more backwards compatible way. Possibly a way to define alternate formats for =begin/=end sections.

[P5P posting of this summary]

Perl Weekly Challenge 284: Lucky Integer

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

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

Task 1: Lucky Integer

You are given an array of integers, @ints.

Write a script to find the lucky integer if found otherwise return -1. If there are more than one then return the largest.

A lucky integer is an integer that has a frequency in the array equal to its value.

Example 1

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

Example 2

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

Example 3

Dancer2 1.1.1 Released

The Dancer Core Team is happy to announce that Dancer2 1.1.1 is on its way to CPAN. This is a maintenance release that deals with the following issues:

[ BUG FIXES ]
* GH #1712: Fix use of send_as in templates (Andy Beverley)

[ DOCUMENTATION ]
* PR #1706: Document missing logging hooks and log format option;
  fix typo in logging test (Jason A. Crome)

Happy Dancing! Jason / CromeDome

TWC 277: Strength Uncombined

In which thousands become millions, as we achieve a near-linear solution.

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

This week, the whole PSC was in attendance.

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

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

Perl Weekly Challenge 283: Digit Count Value

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

Spoiler Alert: This blog post provides some solutions to this challenge. Please don’t read on if you intend to complete the challenge on your own.

Task 2: Digit Count Value

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

Write a script to return true if for every index i in the range 0 <= i < size of array, the digit i occurs exactly the $ints[$i] times in the given array otherwise return false.

Example 1

How to use perl v5.40's boolean builtins in Mojo::Pg queries

Perl v5.40 introduced native true and false keywords. Unfortunately not all CPAN modules are ready to use them. One of those not yet ready is Mojo::Pg.

Normally you'd want to pass booleans to your queries as just 1's and 0's. However, since Mojo::JSON's true & false stringify to 1 and 0, my 5.38-using codebase is full of Mojo::Pg queries with Mojo::JSON's true and false as arguments.

This is a problem if I want to upgrade the perl interpreter of that project to Perl v5.40, because if I write "use v5.40;" in the file that contains those boolean keywords, Perl's builtin booleans will be used instead, which don't stringify to 1 and 0, but to 1 and the empty string, which can't be used by DBD::Pg in boolean fields and makes DBD::Pg throw an exception.

The solution I found was to subclass Mojo::Pg::Database, and wrap the query method, so that if Perl's builtin booleans are found, they are replaced in the query with native Pg booleans.

The source of the module and a lot more information can be found in my blogpost, here.

Using Coro and AnyEvent Interactively

Problem

I have not been able to figure out how to run an async thread in the background while using a REPL like reply. The moment I run the main loop, it takes over the input from the REPL. Here's what a typical failed REPL session might look like.

Sailing the Seven YAPCs


[This is my seventh YAPC / TPC.  If you like, you can read about my other YAPC experiences: YAPC 2011, YAPC 2013, YAPC 2014, YAPC 2015, YAPC 2016, YAPC 2018.]


Well, after taking a very long break inspired (to understate it a bit) by the pandemic, I’m back to attending in-person Perl events with my seventh YAPC.  Or, The Perl Conference, I suppose, but it still feels like YAPC to me.  As per usual, here are some reflections.

Perl Weekly Challenge 283: Unique Number

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

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

Task 1: Unique Number

You are given an array of integers, @ints, where every element appears more than once except one element. ` Write a script to find the one element that appears exactly one time.

Example 1

Input: @ints = (3, 3, 1)
Output: 1

Example 2

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

Example 3

Repository of examples using Perl and Assembly together

Sometimes one needs an extra ounce of performance. Why not combine the high level semantics of Perl with the punch of assembly?

This repo includes various examples of how this can be done.

Today I learned... #1: variable scoping in if-else blocks

This block of code is valid Perl:

if (my $var1 = calc1()) {
    say $var1;
} elsif (my $var2 = calc2()) {
    say "$var1, $var2";
}

As you can see, $var1, which is declared in the if clause, is visible inside the elsif clause too.

Perl never ceases to amaze me!

(Also appears in my blog)

Justifying Embarrassing Errors.

I remember when one one of my grandchildren helpfully decided reorganise a bookshelf whilst by himself. Upon being discovered, sitting in front of an empty shelf with books strewn all around him, his instinctive reaction made me feel proud to be his grandpa. He looked up and said, “Oh dear! Oh dear! what happened?”, as if this calamity had occurred spontaneously, astonishing him as much as the angry parent who was going to have to tidy it all up. It is hard to hide amusement when you watch your kids have to deal with their kids.

Advanced Disaster Management Strategy for Grandchildren and Programmers

Perl Weekly Challenge 282: Changing Key

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

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

Task 2: Changing Keys

You are given an alphabetic string, $str, as typed by user.

Write a script to find the number of times user had to change the key to type the given string. Changing key is defined as using a key different from the last used key. The shift and caps lock keys won’t be counted.

Example 1

What's new in Perl v5.40?

Here I share my personal favourite core enhancements in Perl v5.40.

https://theweeklychallenge.org/blog/what-is-new-in-perl

This week in PSC (152) | 2024-06-20

Just Graham and Philippe this time.

We talked about HTTPS in core, and some ideas about it, while the CPAN Security Group is preparing some proposals. Today was the deadline for releasing 5.41.1, but we don’t have volunteers yet, so Graham said he would do it sometime soon.

We also noted that we’ll need some volunteers for the next 10 or so development releases.

Neuigkeiten: OTOBO 11 Veröffentlicht

Wir freuen uns, die Veröffentlichung von OTOBO 11 bekannt zu geben! Die neueste Version der beliebten Open-Source-Ticketsystem-Software bringt zahlreiche Verbesserungen und neue Funktionen mit sich. Erfahren Sie mehr über die neuen Features und Änderungen auf OTOBO

Perl Weekly Challenge 282: Good Integer

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

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

Task 1: Good Integer

You are given a positive integer, $int, having 3 or more digits.

Write a script to return the Good Integer in the given integer or -1 if none found.

A good integer is exactly three consecutive matching digits.

Example 1

Input: $int = 12344456
Output: "444"

Example 2

Input: $int = 1233334
Output: -1

Example 3

Caching & Memoization with state variables

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

Making time to waste.

Over the years that I have existed in four dimensions, I have come to accept that time is not a linear concept heading inexorably in one direction at a uniform rate. It didn't take an Einstein or Hawking to convince me either. Time is as malleable as the distortions applied by our consciousness, or imposed by those around us. Consider my youngest daughter's essay due to be handed in on Tuesday, a task assigned 4 months earlier. At 4,000 words, it represented roughly 6 words an hour allowing for eating, sleeping, work, weekend fun, and other essential time-devouring activities. Yet the "I have got plennnnty of time, chill, dad!" of a few months ago, has now turned into cries of despair, as she has to do an all nighter at her desk instead of being at some selfie-rich event critical to her mental well-being and social standing.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.