Home / Alt manpages / perl5340delta(1)

  • perl5340delta(1)
  • User command
  • linux

Use perl5340delta to Check Perl 5.34 Compatibility

You will turn the installed perl5340delta release notes into a short compatibility check for Perl programs. The useful result is not a blind upgrade: it is a list of syntax, default-feature and module changes that you have tested against the interpreter you will actually run. Allow 15 to 30 minutes for a small script, longer for a service with CPAN dependencies.

You need a shell, a copy of the program or test suite you plan to run, and the perl-doc package. The manpage installed on this machine is for Perl 5.34.0, while the executable is Perl 5.38.2 from Ubuntu package perl-base 5.38.2-3.2ubuntu0.6. That distinction matters: this document describes what changed in the 5.34.0 release, not what is new in the local interpreter.

1. Confirm which Perl and notes you are using

Start by recording the executable and the installed documentation package. These commands only read system state and do not require elevated privileges.

$ command -v perl
/usr/bin/perl
$ perl -v | sed -n '1,4p'
This is perl 5, version 38, subversion 2 (v5.38.2) built for x86_64-linux-gnu-thread-multi
$ dpkg-query -W -f='${Package} ${Version}\n' perl-doc perl-base
perl-base 5.38.2-3.2ubuntu0.6
perl-doc 5.38.2-3.2ubuntu0.6
$ man perl5340delta

Checkpoint: if man perl5340delta fails, install or enable the distribution's documentation package through your normal package-management process. Do not substitute a different release note without checking its version number. If several Perl installations exist, use an absolute interpreter path for the tests below.

2. Test the new syntax in isolation

Perl 5.34.0 introduced an experimental try/catch syntax, accepted an empty lower bound in a regular-expression quantifier, and added 0o octal literals. Put these features in tiny one-shot checks before changing a larger program.

$ perl -e 'use feature "try"; try { die "boom\n" } catch ($e) { print "caught: $e" }'
try/catch is experimental at -e line 1.
try/catch is experimental at -e line 1.
caught: boom
$ perl -we 'print 0o123, qq(\n); print oct("0o123"), qq(\n); print "x" =~ m/x{,3}/ ? qq(match\n) : qq(no\n)'
83
83
match

The warning is expected for the experimental exception syntax. Treat it as a review signal, not as a reason to suppress all warnings. The release notes point to perlsyn for the full rules, including the fact that caller() does not see try blocks.

Checkpoint: the two octal conversions should print 83, and the quantifier test should print match. If a feature check fails, stop and identify the interpreter or syntax error before testing the application. A successful one-liner does not prove that the surrounding program handles exceptions correctly.

3. Check defaults that can change old code

Perl 5.34.0 added the bareword_filehandles and multidimensional feature entries. The release notes say the former is enabled by default and the latter is enabled by default while allowing multidimensional array emulation to be disabled. These are compatibility details, not commands to paste into production.

$ perl -e 'use feature "bareword_filehandles"; use feature "multidimensional"; print "feature names accepted\n"'
feature names accepted

For a real application, search its source and tests for bareword handles, comma-separated array or hash subscripts, and explicit feature pragmas. Then run the existing test command with the target interpreter. Keep use strict and use warnings in place while doing so; removing diagnostics can hide the compatibility issue you are trying to find.

Do not infer that every module has the version listed in the 5.34.0 notes. Those entries describe the versions shipped with that Perl release. On this machine, query the modules that the program loads:

$ perl -MArchive::Tar -MIO -MJSON::PP -e 'printf "Archive::Tar %s\nIO %s\nJSON::PP %s\n", $Archive::Tar::VERSION, $IO::VERSION, $JSON::PP::VERSION'
Archive::Tar 2.40
IO 1.52
JSON::PP 4.16

Those local versions are newer than several versions named in the Perl 5.34.0 document. Test the interfaces your code calls instead of comparing version strings mechanically. A dependency can also come from a separate system package or a project-local library.

4. Review the operational and build changes

If you maintain XS, build Perl itself, or support Windows, read the relevant sections rather than stopping at the headline syntax changes. The release notes cover a new ExtUtils::PL2Bat core module, changes to include-path handling, removal of the stadtx hash function in favour of SipHash, and a development-only -Dusedefaultstrict build option. They also record Windows changes for symbolic links and file-stat information.

On Linux, the most practical check is usually the project test suite, run with the exact interpreter selected in step 1:

$ cd /path/to/your/project
$ /usr/bin/perl -Ilib -c bin/your-script
/path/to/your/project/bin/your-script syntax OK
$ /usr/bin/perl -Ilib -M prove -v -l t
# test output is project-specific

Replace the path and test command with real values. The compile check does not execute the program, and a passing compile check does not cover module loading, file permissions, network calls or service behaviour. Do not run a service restart as part of this check. If the suite needs a database or other external service, record those prerequisites and test in a disposable environment first.

5. Investigate failures without changing the system

When a test fails, reduce it to the smallest Perl invocation that still fails. Capture the interpreter version, module versions and the exact diagnostic. The 5.34.0 notes mention new errors for disabled multidimensional lookup and disallowed bareword filehandles, a warning for wide characters in environment-variable keys, and clearer argument-count diagnostics. These clues help separate a language change from an application defect.

$ /usr/bin/perl -V:version -V:archname
version='5.38.2';
archname='x86_64-linux-gnu-thread-multi';
$ /usr/bin/perl -MConfig -e 'print "$Config{prefix}\n$Config{privlib}\n"'
/usr
/usr/share/perl/5.38

Do not copy a fix from an unrelated release note. The manual describes differences between Perl 5.32.0 and 5.34.0; if you are upgrading from 5.30.0, it explicitly points you to perl5320delta first. Read each intermediate delta document that lies between your starting and target versions.

Done means

  • You recorded the Perl executable, interpreter version and documentation version.
  • The 5.34.0 syntax examples produced the expected values, with the experimental warning understood.
  • Your program's tests ran under the exact interpreter intended for deployment.
  • Module versions were queried locally rather than assumed from the release notes.
  • Failures have a small reproducer, diagnostic and recovery plan before any upgrade or service change.