|
Perl Weekly
Issue #768 - 2026-04-13 - Perl and XS
latest | archive | edited by Mohammad Sajid Anwar
|
|
Hi there,
Nearly a year ago, Robert Acock shared a complete tutorial, Learning XS. I promised myself that one day I would go through the tutorials start to finish in one go without interruptions, but life had other plans. A couple of days ago, Robert, added one more post to the series: Custom Ops. It made me realise how far behind I am. Time management is something, I need to learn, and learn quickly, before it is too late. My upcoming book on DBIx::Class is also on hold after I finished the first draft. Well, in this case, I have a perfect excuse. While I was working on the book, someone dropped the idea of making DBIx::Class operations asynchronous. The idea blew me away for quite a while and resulted in a CPAN module: DBIx::Class::Async. I am happy with the end result, but it delayed the book and I am yet to start on it again. So what else is keeping me busy now? Well I just published my first mobile app for Android device: The Weekly Challenge. For those who don't know, this is my pet project started seven years ago where I throw out two challenges every Monday and members solve them in Perl, Raku and many other programming languages. So the real question is: finish the book on DBIx::Class or Learn XS?
I noticed, Robert, published a handful of Perl modules to CPAN with a flavour of XS. You can find the list on MetaCPAN. Now to understand the workings of these modules, I need XS knowledge. This is going on my TODO list for the time being. If you have the time and energy, I would highly recommend the tutorial.
For the first time in a long while, I saw so many new Perl modules published to CPAN back to back. Nearly every module deserves a closer look. For example, WebService::Bugzilla, SimpleMock, LRU::Cache and many more. If you don't want to miss the fun then watch this MetaCPAN page regularly.
Dave Cross latest monthly newsletter was fun to read as always. I am not an AI fan yet but this is interesting.
I am sure you have plenty to read this week in the newsletter, so enjoy!!
Mohammad Sajid Anwar
|
|
|
Articles
|
|
|
by Dan Book (DBOOK)
Dependencies or prerequisites are an integral feature of the CPAN software repository. They define what other CPAN modules are required for a particular CPAN distribution to be built, tested, or ultimately to function, as well as optionally to improve or add functionality.
|
|
by Lukas Mai (MAUKE)
Sometimes, when you're trying to debug encoding issues in Perl code, it is useful to quickly get an idea of what code points Perl thinks are in your string. Explore the different ways to look at the encoding issues.
|
|
by Laurent Dami (DAMI)
I am going to watch this closely. Unfortunately no time to give constructive feedback right now. If you have then please do share with him.
|
|
|
by Todd Rinaldo
This is not for faint heart. Have a coffee before you start reading this post. I find it very engaging and informative.
|
|
Discussion
|
by Karl Williamson
This is interesting and handy for anyone wants to contribute the core Perl. The post gives a detailed instructions how to. This is the best so far I have come across inviting first timer to join the team,
|
|
CPAN
|
by Nicholas Hubbard
The Net::Nostr module is a clean, idiomatic Perl module for communicating with and performing tasks that comply with the Nostr Protocol. Net::Nostr abstracts away many of the complexities associated with signing events, relaying data, and converting between different formats. This technical assessment describes how modular design can successfully use Schnorr signatures as well as other advanced signature types when creating decentralised social networks using Perl. Developing applications based on the decentralised social space will only be possible if you can successfully communicate and implement these functions within your program.
|
|
by Robert Acock
Robert presents LRU::Cache, a high-performance cache for Perl written in XS that achieves O(1) performance on the caching layer for Perl. Using an OP-optimised functional API that avoids method dispatch for the standard Perl OOP model; this module is capable of achieving 5-20 x faster than pure Perl alternative caches, making it an ideal choice for your performance-critical applications.
|
|
by Marian Marinov (HACKMAN)
Net::BART offers both IPv4 and IPv6 routing using Balanced Routing Tables (BART). By implementing two layers of routing tables, one in pure Perl and one using C/XS, Net::BART achieves a high level of performance. Net::BART has great technical value for developers looking for fast routing lookups, offering efficient Longest Prefix Match (LPM) calculations and sparse array handling capabilities.
|
|
by Robert Acock
Priority Queue is a top performing C extension for binary Heaps written in Perl and can outperform pure Perl by an astonishing 55 times. The purpose of this article is to document the features of Heap's Priority Queue: Versatile APIs (procedural functional as well as traditional OO) and specialised NV Heaps that minimise the overhead of SV creation/maintenance and increase the throughput of C doubles (represented as raw C doubles).
|
|
by Jacques Deguest (JDEGUEST)
The DateTime::Lite library offers a lightweight technical alternative to the standard DateTime library while still providing a drop-in API replacement. The use of one SQLite database file instead of hundreds of timezone files, along with a three-level memory cache, significantly improves startup performance and throughput making it a desirable solution for both high-concurrency micro-services and low-memory constrained environments.
|
|
|
The Weekly Challenge
The Weekly Challenge by Mohammad Sajid Anwar will help you step out of your comfort-zone. You can even win prize money of $50 by participating in the weekly challenge. We pick one champion at the end of the month from among all of the contributors during the month, thanks to the sponsor Lance Wicks.
|
by Mohammad Sajid Anwar (MANWAR)
Welcome to a new week with a couple of fun tasks "Valid Tag" and "Group Division". If you are new to the weekly challenge then why not join us and have fun every week. For more information, please read the FAQ.
|
|
|
by Mohammad Sajid Anwar (MANWAR)
Enjoy a quick recap of last week's contributions by Team PWC dealing with the "Make it Bigger" and "Big and Little Omega" tasks in Perl and Raku. You will find plenty of solutions to keep you busy.
|
|
|
by Abigail
Abigail composed extensive analysis for each of the paradigms mentioned, which include advanced Perl regex arithmetic and multiple versions of the same generalised procedure used within related formats (Bash & C). An excellent example of this was modern Perl's character class arithmetic (?[ ]) as an extremely useful method of completing this challenge for multiple types of code.
|
|
by Abigail
This article examines how Abigail's method for finding prime factorisation avoids the overhead of running a primality test, using a single loop to increment both the 'small omega' and 'big omega' counts while performing a single optimised division. The result is an efficient and mathematically elegant solution, combining mathematical reasoning and computational speed.
|
|
by Arne Sommer
The blog post shows a nice, straightforward technical solution for the "Bigger Big" challenge using Raku's strong functional programming capability such as combinations and map. The expressive syntax of the language allows for complex list manipulations to be reduced to easy-to-read one-liner logic with clear validation of logic using Raku's strong type system.
|
|
|
by Jorg Sommrey
There is an algorithmically sound answer to the problem of how to maximise a number after removing digits, as well as a mathematically sophisticated generalisation of counting the number of prime factors using a variable, or flexible, exponent in the second problem. The Perl and J implementations of the two tasks demonstrate instructive examples of two original implementations: one with direct solvers that can use iterative loops, and one that uses functional programming concepts to achieve the same goals without the use of loops.
|
|
by Lubos Kolouch
In an excellent blog post, Lubos compares the two programming languages Perl and Python. He explains how to solve complicated algorithms in both programming languages, while adhering to the idioms of each language. He provides extremely complete solutions to the algorithmic problems, using Perl's succinct use of regular expressions and arrays and Python's logical, clear, and concise syntax to provide a comprehensive and cross-platform tutorial on how to solve problems.
|
|
by W Luis Mochan
This post stands out among other examples of technical excellence from W. Luis Mochán due to its very high level of Perl support and its extremely compact and elegant code for solving problems using minimal resources. I really enjoyed his clever use of the Math::Prime::Util module, which allows him to create an effective and concise one-liner for calculating prime factors, along with his very clever approach to optimizing string numbers by reading from left to right, which allows him to provide both concise code as well as a very efficient algorithm.
|
|
|
by Matthias Muth
This solution set demonstrates string manipulation using regular expressions (regex) and manipulate numbers efficiently (number theory). The idea of using conditional regex patterns to remove an optimal digit in Task 1 is clever, and using Math::Prime::Util and List::Util in Task 2 shows how simple it is to use Perl for a project or write production-quality scripts. Each solution is clearly explained, has a minimal amount of code, and follows a clear mathematical logic based on the problem statement.
|
|
by Packy Anderson (PACKY)
The multi-language showcase provided by Packy demonstrates a great deal of skill when developing code solutions to week 368. The review emphasises how architecture can influence an elegant response to solve the challenge. By comparing the built-in indices and uniqueness of methods within Raku with the elaborate recursive solution used in Elixir, you will see an extensive technical competency of Packy based on various programming paradigms.
|
|
|
by Peter Campbell Smith
This note from Peter provides an outstandingly efficient method for solving Challenge 368, especially with regard to the "bits of conflict" analysis. The technical evaluation also features exceptional high-level mathematical intuition used in conjunction with using circular arithmetic to solve the problem of complex interval overlaps. Additionally, his Perl solutions are uniquely clean and optimized for speed.
|
|
|
by Reinier Maliepaard
This approach is very straightforward because the next step is to compare the digits/values created after removing both the first and the second occurrence of the target digit. Using the index to find each location of the digit and then using substr to create the candidate strings is efficient, and you can easily see this through its implementation. The use of input validation will give the code additional robustness because the validation checks that there was exactly two occurrences of the digit. The structure of the code will help support the intent of the algorithm, and the test cases will be able to show the expected outcome.
|
|
by Reinier Maliepaard
This approach clearly distinguishes two omega functions by using Math::Prime::Util's factor_exp function, which returns all prime factorization as well as their respective exponents. The source code is extremely clear; it uses the number of exponent pairs (for little omega - count of distinct prime numbers) in conjunction with summing together all the exponent values (for big omega - total number of prime factors). There is also an explanation (for the math) in conjunction with the examples to make this both an educational and production-quality example.
|
|
by Robbie Hatley
Robbie's work on Challenge 368 is an impressive example of a technical review that is mathematically precise; particularly in the Conflicting Events task where he treated time as a circular interval. His implementation of this task in Perl is also equally impressive because it solves the problem of certain events that cross midnight using highly accurate minute-normalization and very creative "wrap-around" logic for the solutions. This, along with an excellent defensive coding style, results in Robbie having created an excellent implementation of the task.
|
|
by Roger Bell West (FIREDRAKE)
The post provides good versatility in different languages as well as impressive implementations of the string manipulation problem in both Perl and Raku utilising assignable substr for efficiency. The method for performing prime factorisation has been implemented in a very solid and organised manner, including a custom prime sieve and factoriser that successfully addresses both non-distinct and distinct numbers of prime factors; the Typst solution gives a readable and clear option for the initial problem.
|
|
by Simon Green (SGREEN)
Simon provides practical method for creating easily-readable and dependable programs through clear examples of brute force and iterative algorithms. He has made the transition from using Python to using Perl (both programming languages) by keeping the original algorithms intact, to maximise the usability of these algorithms for the greatest number of programmers (regardless of computer programming expertise).
|
|
|
Rakudo
|
|
|
Weekly collections
|
|
|
Events
|
|
|
|
|
|
|
June 26-29, 2026, Greenville, SC, USA
|
|
You know, you could get the Perl Weekly right in your mailbox. Every Week. Free of charge!
|