Home / Alt manpages / perl5100delta(1)

  • perl5100delta(1)
  • User command
  • linux

Use perl5100delta to Audit Perl 5.10 Compatibility

You will finish with a short, repeatable check for Perl 5.10-era syntax on the interpreter installed on a Linux machine. The useful result is not a blind upgrade decision: it is a record of which features your code can use, which historical changes need testing, and which warnings deserve follow-up.

Before you start

You need a shell, Perl, and the perl-doc package if you want the local manual page. Allow about 10 minutes for a small compatibility check, or longer if you are auditing a large application. The commands below only read documentation or run small one-line programs. They do not change files, services, or the installed Perl.

Checkpoint

This guide describes the Perl installed here, which is 5.38.2. perl5100delta is a historical release note: it compares Perl 5.8.8 with Perl 5.10.0. It is not a description of every change in Perl 5.38.

1. Record the interpreter and manual

Start by recording the exact interpreter that will run your program. A package manager version and a Perl version are related, but they are not interchangeable.

perl -e 'printf "v%vd\n", $^V'
dpkg-query -W -f='\${Package} \${Version}\n' perl-doc 2>/dev/null || true
man perl5100delta

On the machine used for this guide, the first command prints v5.38.2 and the package query reports perl-doc 5.38.2-3.2ubuntu0.6. The manual identifies itself as "what is new for perl 5.10.0" and says that its comparison starts at 5.8.8.

For a terminal-friendly copy without the formatted pager, use:

perldoc -T perl5100delta | sed -n '1,35p'

Do not treat a successful man lookup as proof that a program is running Perl 5.10. It only proves that the documentation is installed.

2. Read the change record by risk

Use the manual as a map, not as a checklist to copy into production. Begin with "Core Enhancements" for syntax you may want to use, then read "Incompatible Changes" for code that may silently change meaning or stop compiling. The manual also separates module and pragma changes, utility changes, performance work, diagnostics, internals, known problems, and platform-specific problems.

The most useful first pass is to search for the feature or incompatibility named by your code review:

man perl5100delta | col -b | grep -n -E 'feature|Defined-or|say\(\)|state\(\)|Incompatible Changes|UTF-8|\$\^V|Pseudo-hashes'

These headings are version-specific evidence. For example, the page says that the feature pragma is lexical, documents -E, the defined-or operator, say, and state, and records that $^V became a version object rather than a v-string. It also records removals such as pseudo-hashes. Those notes tell you what to test; they do not tell you that every old program uses the affected construct.

Checkpoint

Write down the two or three headings that match your application. If none match, stop widening the search. A complete release note is not automatically a useful migration plan.

3. Probe the features you intend to use

Test one feature at a time with a disposable one-liner. The following probes are directly tied to the documented 5.10 additions.

perl -e 'use 5.010; use feature "say"; say "feature enabled"'
perl -e 'my $value; print(($value // "fallback"), "\n")'
perl -e 'use feature "state"; sub next_value { state $n = 0; return ++$n } print next_value(), " ", next_value(), "\n"'
perl -E 'say "-E enables optional features"'

Expected output is:

feature enabled
fallback
1 2
-E enables optional features

// selects its right-hand side only when the left-hand value is undefined, unlike ||, which also treats a false value such as 0 as a reason to fall back. state keeps its value between calls, and use 5.010 states a minimum language version. Keep the version declaration if the program genuinely requires that language level, rather than adding it merely because a feature happened to work during a probe.

4. Treat switch and smart match as a warning

The 5.10 release notes describe given, when, default, and the smart-match operator. Modern Perl still accepts a small probe, but the installed 5.38.2 interpreter emits deprecation warnings:

perl -e 'use feature "switch"; given ("perl") { when ("perl") { print "matched\n" } default { print "not matched\n" } }'

On this system it prints warnings that given and when are deprecated, followed by matched. That is the distinction to record: a historical feature can parse and run while still being a poor choice for new code. Do not suppress the warning just to make a compatibility report look clean. Check the current perlsyn and feature documentation before retaining this construct in a maintained application.

5. Turn the result into a migration decision

Run your real test suite with the same perl binary used in step 1. A one-liner proves that the interpreter recognises a construct; it does not prove that your modules, warnings, Unicode handling, regular expressions, or XS extensions behave correctly.

command -v perl
perl -v
perl -c path/to/your-program.pl
prove -l t

Replace path/to/your-program.pl with an existing file. The -c check compiles without running the program, while prove -l t runs a test directory and adds the local lib directory to Perl's search path. If your project uses another test command, use that command instead. No elevated privileges are needed for these checks.

If a test fails, return to the relevant section of perl5100delta, reduce the failure to a small example, and compare interpreters deliberately. Avoid "fixing" a failure by changing system Perl or deleting modules. If you did create a temporary test file, remove only that named file after reviewing it; the probes above create none.

Done means

  • You recorded the interpreter version and the installed perl-doc version.
  • You confirmed that perl5100delta is a 5.8.8 to 5.10.0 historical comparison.
  • You tested only the documented features your code may use.
  • You recorded deprecation warnings instead of hiding them.
  • You compiled and ran the project's own tests with the intended interpreter.