My Y2020 Bug

For reasons that must have been clear at the time, I once wrote a test in terms of epoch time, and wanted it to run on systems that did not use January 1 1970 as the epoch. So I loaded Time::Local and added timegm( 0, 0, 0, 1, 0, 70 ) to the desired epoch.

This morning I got a CPAN testers report failure. It seems that if you give timegm() a year in the range 0-99 it assumes it is within 50 years of the current year, so my test suddenly …

Perl Unicode versions

A spell of hacking around with Unicode got me wondering which version up with:

Perl version Unicode version
5.7.33.1.1
5.8.03.2.0
5.8.14.0.0
5.8.44.0.1
5.8.74.1.0
5.8.95.1.0
5.9.44.1.0
5.9.55.0.0
5.10.15.1.0
5…

Stupid Unicode Trick: Noncharacters

Perl RT 133292 is a request to expose the internal perl subroutine that does string interpolation, so that one does not need to figure out how to double-quote a string (escaping where necessary) when feeding it to eval() as a quick-and-dirty templating system.

In fact, there is no such subroutine (the parser makes an interpolation into a concatenation), and anyway why not just use sprintf()…

Wildcard Unicode Property Values

In addition to Native Variable-Length Lookbehind, Perl 5.29.9 (sic) includes another Regexp enhancement: wildcard Unicode property values. (And yes, this blog post sat around in draft form for over a month.)

Despite its name, the implementation is in terms of regular expressions rather than traditional wildcards. An example may be better than an explanation here: instead of writing /[\p{Script=Latin}\p{Script=Greek}]/, the new feature allows you to write …

Native Variable-Length Lookbehind

No, I'm not talking about Dr. Regex' emulated variable-length lookbehinds, which frankly make my head hurt. Beginning with Perl 5.29.9, Perl has honest-to-heaven, really truly variable-length lookbehinds.

Now, there is at least one restriction. No lookbehind assertion can be more than 255 characters long. This limit has been around, as nearly as I can tell, ever since lookaround assertions were introduced in 5.005. But it has been lightly documented until now. This restriction means you can not use …