in reply to Upgrading Perl codebase of older Perl version

There are two major changes that affected many projects, both done for security:
  1. 5.18 introduced more-randomized hashes. This shouldn't break any code, but some code only worked by chance of which order the hash keys landed normally, and will be broken now that they iterate in a different order on every run.
  2. 5.24 removed the current directory "." from the @INC include path. This breaks any project that used use MyModule; to mean require "./MyModule.pm";. You can still add the current directory back to @INC manually, but it's much better to organize the module directories and declare them all in perl -I ... or PERLLIB at startup.
Most of the rest tends to be stuff related to deprecating/removing old features from perl 4 or early versions of 5, or experimental features. If your Perl 5.16 code was written in a "normal" style, none of this should affect you.

Replies are listed 'Best First'.
Re^2: Upgrading Perl codebase of older Perl version
by cavac (Prior) on Sep 04, 2024 at 11:46 UTC

    BEGIN { unshift @INC, "/some/path/Net-Clacks/lib"; unshift @INC, "/another/path/My-Secret-Module/lib"; }; use Net::Clacks; use My::Secret::Module;

    At least that's the variant i use when debugging. (Original code checks for the '--debug' flag and only unshifts the uninstalled paths if that is set).

    PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
    Also check out my sisters artwork and my weekly webcomics
      That works too. I prefer more like
      #! /bin/sh exec perl -I /some/path/Net-Clacks/lib -I /another/path/My-Secret-Modu +le/lib myapp.pl "$@"
      in a file named debug_myapp.pl, which helps keep my temporary local debugging stuff out of the committed code of the project.

        My full BEGIN checks for the "--debug" command line switch to enable the INC modifications, disable some caching/precompression algorithms (for faster startup) and also enable extra debug output:

        ... use Array::Contains; ... our $isDebugging; BEGIN { if(contains('--debug', \@ARGV)) { print("Development INC activated\n\n"); my $uname = 'cavac'; if(defined($ENV{PC_LINUXUSER}) && $ENV{PC_LINUXUSER} ne '') { $uname = $ENV{PC_LINUXUSER}; } unshift @INC, "/home/$uname/src/Net-Clacks/lib"; unshift @INC, "/home/$uname/src/pagecamel_framework/lib"; unshift @INC, "/home/$uname/src/pagecamel_er_base/lib"; $isDebugging = 1; } else { $isDebugging = 0; } } ... my $backend = PageCamel::CMDLine::WebBackend->new($isDebugging, $confi +gfile); $backend->run; ...

        PerlMonks XP is useless? Not anymore: XPD - Do more with your PerlMonks XP
        Also check out my sisters artwork and my weekly webcomics