Home / Alt manpages / perl5140delta(1)

  • perl5140delta(1)
  • User command
  • linux

Audit a Perl 5.14 Upgrade with Reproducible Checks

Perl 5.14 is the release that quietly changed how your regex objects stringify, and perl5140delta is where that surprise is documented. Turn it into a short upgrade audit instead of finding out the hard way in a log comparison.

You will record the interpreter you are testing, exercise the Unicode and regular-expression changes that can alter results, and search for syntax and deprecation traps. Allow 20 to 30 minutes for a small application, plus time to run its own tests.

  • Scope: this guide treats Perl 5.14.0 as the subject, not the version installed here. The local perl-doc package is 5.38.2-3.2ubuntu0.6 and the local interpreter is Perl 5.38.2, useful for checking the examples but not for reproducing every warning or edge case an actual 5.14 binary would show.
  • Older than 5.12? Read the intervening delta documents too; this one covers 5.12.0 to 5.14.0 only.

1. Record the interpreter and read the delta document

Capture the version that will run your tests:

$ perl -e 'print $^V, "\n"'
v5.38.2
$ perldoc perl5140delta

The second command opens the installed copy of the document. Its NAME and DESCRIPTION sections state the comparison range. This is a change list, not a migration script, so keep your application's test suite open beside it.

Checkpoint

Write down the old interpreter, the candidate interpreter, and the package versions that supplied both. "Perl 5" is not a useful version label when behaviour and bundled modules matter.

2. Make Unicode intent explicit

Perl 5.14 completed the unicode_strings feature and added Unicode 6.0 data, with documented exceptions. The real question is not whether your program can store a non-ASCII character. It is which semantics its string operations and regular expressions are meant to use.

Run a focused comparison with an accented character:

$ perl -e 'print "no match\n" unless "é" =~ /\w/a; print "ascii restriction checked\n"'
ascii restriction checked
$ perl -Mfeature=unicode_strings -e 'print "unicode match\n" if "é" =~ /\w/'
unicode match

The /a modifier keeps \w, \d, \s and POSIX character classes in the ASCII range while keeping Unicode case behaviour. The /u modifier asks for Unicode semantics. Do not bolt either on mechanically: pick it where the input contract requires it, then add a test for a real boundary character.

Named characters need a look too. Perl 5.14 changed the handling of names around BELL; use \N{BEL}, \N{ALERT} or \a when you mean U+0007, rather than the transitional spelling. This is a source-review task, not a reason to touch generated Unicode data files. The 5.14 manual says those database files stopped shipping with Perl, without removing the runtime functionality.

3. Check regular expressions for changed assumptions

Perl 5.14 added the /d, /l, /u and /a regex modifiers, and it changed how compiled expressions stringify. Code comparing a regex string to a fixed value can break even when the matching itself is fine.

$ perl -we 'my $re = qr/foo/i; print "$re\n"'
(?^i:foo)

Search tests, loggers and serialisers for comparisons against the old (?i-xsm:...) style. If the program needs the pattern and modifiers separately, use the documented re interface rather than parsing this display form.

The release also added non-destructive substitution and transliteration with /r, which returns a changed copy and leaves the source untouched:

$ perl -we 'my $old = "cat"; my $new = $old =~ s/cat/dog/r; print "$old/$new\n"'
cat/dog

A safe refactor where old code only copied to avoid modifying its input. Keep the original test that proves the source stays unchanged. Treat regex code blocks such as (?{...}) as a separate risk: the manual still calls them experimental, even though re-entrant use got safer.

4. Search for source and deprecation traps

Run searches over the source tree before changing anything. These patterns target documented 5.14 compatibility points:

$ rg -n 'for\s+\$\w+\s+qw\(|\$\[|\bBELL\b|\?[^?]+\?|defined\s+%[A-Za-z_]' lib bin t

Give every match a human decision:

  • qw(...) used where parentheses were implied. Perl 5.14 stopped accepting some of these.
  • Assignment to $[. Deprecated.
  • ?PATTERN? search. Changed from once-only to resettable.
  • defined %Package:: as an emptiness test. Not what it looks like; use scalar hash behaviour instead.

Skip the broad search-and-replace. A literal string, a comment and executable Perl need different treatment. Run the application's tests after each small batch.

5. Check modules and binary boundaries

The delta lists new and updated core modules, including HTTP::Tiny, JSON::PP and CPAN::Meta. Compare your dependency manifest with what the target package actually provides; a module being core in one Perl release does not prove a separately packaged OS build supplies the same version.

Flag XS modules and embedded interpreters too. Perl 5.14 was not binary-compatible with previous stable releases, so rebuild native extensions and rerun their tests against the target interpreter. This is the point where elevated privileges may be needed to install a system package, though the audit commands above stay unprivileged. Do not replace the system Perl just to test an application; use an isolated build or your distribution's supported packaging method.

6. Finish with a controlled test run

Run the project's normal checks with warnings enabled where possible:

$ prove -lr t
$ perl -c bin/example.pl
bin/example.pl syntax OK

A test fails? Keep the failing input and interpreter version before editing anything. That makes a Unicode boundary, regex stringification change or deprecation warning reproducible. Recovery is normally a code or dependency rollback: do not silence a warning globally until you know which compatibility issue it represents.

Done means

  • Versions on record. The old and candidate Perl versions and package sources are noted.
  • Unicode policy set. Matching has an explicit, tested policy for the application's inputs.
  • Regex changes tested. Stringification comparisons and /r refactors have tests.
  • Deprecations reviewed. Deprecated syntax, BELL names, $[ and qw edge cases were checked, not blindly rewritten.
  • Suite passed. XS dependencies were rebuilt, the full test suite passed, and no system interpreter or service changed during the audit.