Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

[SOLVED]:Upgrading Perl 5.8 program to 5.22

by $h4X4_|=73}{ (Monk)
on May 23, 2016 at 10:58 UTC ( [id://1163860]=perlquestion: print w/replies, xml ) Need Help??

$h4X4_|=73}{ has asked for the wisdom of the Perl Monks concerning the following question:

I would like a Perl program I made years ago to run the latest version of Perl 5.22. But the biggest problem I face with this task is the size of the program. The only way I see this happening is if I rebuild the hole framework from scratch under 5.22 while trying to recycle and convert some methods.

There is no other reason I can see why i need to upgrade other than the fact that the program is stuck at Perl 5.8 and to upgrade to 5.22 would need a major overhaul to the hole framework.

Are there any advantages of using the latest Perl version that I missed?

The lesson was... Don't use Exporter in a file you have named "exporter" to keep your variables in scope. But you can use Exporter in a file called "foo" and it will work fine.

Replies are listed 'Best First'.
Re: Upgrading Perl 5.8 program to 5.22
by Corion (Patriarch) on May 23, 2016 at 11:11 UTC

    There haven't been many wide-sweeping changes between 5.8 and 5.22 that would immediately break your program.

    The most obvious changes would be the much better handling of Unicode.

    The annoying stuff for migrating to a new Perl version is that you need to collect all the missing prerequisites that likely have accumulated in your old Perl installation. I keep track of my prerequisites in a Makefile.PL even if I don't intend to distribute the software ever. This makes reinstallation of all prerequisites as easy as:

    cpanm --installdeps .

    You can test the migration to a new version of Perl by installing a separate version of Perl using perlbrew. That way, you have a low risk of ruining your existing installation.

      The error I get when changing to 5.10 is "Undefined subroutine &Exporter::import called at C:/strawberry/perl/lib/CGI/Carp.pm line 371." That is the same message I get for any version higher. I'm kinda sure its because of the way I use Exporter in a module to keep all the objects and variables in scope through the program.

      Correct me if I'm wrong. Looking in the perl5100delta at perldoc. The "Incompatible Changes" >> "Recursive inheritance detected earlier" could be the thing that broke the program.

      I do not think I can do the magic I could with Exporter any more.

        Did you upgrade modules such as CGI::Carp after upgrading the Perl version? It seems more likely that an old version of CGI::Carp was relying on some behavior that has changed. Upgrading CGI::Carp to a newer version could fix the issue.


        Dave

Re: Upgrading Perl 5.8 program to 5.22
by haukex (Archbishop) on May 23, 2016 at 11:31 UTC

    Hi $h4X4_|=73}{,

    How big of an overhaul your program would need really depends - there is plenty of Perl code that runs fine on Perl 5.24 all the way down to 5.6 and even lower. If you do want to try out an upgrade, I'd recommend you don't jump directly from 5.8 to the latest version, instead run your script on 5.10, 5.12, 5.14 etc. all the way up to 5.24. The reason is that quite a few features went through deprecation cycles where Perl would first warn that a feature was deprecated, and the feature wasn't actually removed until a later version. That is admittedly a bit tedious but there's perlbrew to help you, and if you have tests those will help very much as well - and if you don't, it's never too late to add at least a few smoke tests :-)

    Hope this helps,
    -- Hauke D

Re: Upgrading Perl 5.8 program to 5.22
by cavac (Parson) on May 23, 2016 at 11:04 UTC

    Well, security for one. There have been a lot of internal changes to keep up with modern threats.

    "For me, programming in Perl is like my cooking. The result may not always taste nice, but it's quick, painless and it get's food on the table."

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1163860]
Approved by cavac
Front-paged by cavac
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-03-28 15:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found