Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Updating scripts from late 90's

by Anonymous Monk
on Apr 12, 2005 at 15:49 UTC ( [id://447059]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am planning to update Perl scripts we have that were created in 1998. What kind of things will updating the scripts with latest Perl Technology do for my server? Will it give me faster processing time and what else? I see some of the scripts are using the pack function:
$value =~ s/%(..)/pack("c",hex($1))/ge;
Please advise.

Replies are listed 'Best First'.
Re: Updating scripts from late 90's
by brian_d_foy (Abbot) on Apr 12, 2005 at 16:05 UTC

    The pack() function isn't something you need to worry about. It's still in Perl, and it still does what it did (and a bit more). Anything written in 1998 was written after Perl 5 was released.

    Worry about broken CGI parsers, though. If you are looking for speed increases, you probably want something such as mod_perl (even with just PerlRun).

    --
    brian d foy <brian@stonehenge.com>
Re: Updating scripts from late 90's
by davido (Cardinal) on Apr 12, 2005 at 15:56 UTC

    You're updating the version of Perl, not the scripts, and asking what doing so may break, right?

    You could run through all of the perldelta POD's to scan for problems. Or you could install the latest Perl in a different path, retaining the older version too, so that you can freely go back and forth as necessary.

    This approach will allow you to thoroughly test the old scripts under the new Perl versions. It's impossible for us to know what version-specific things are being used in the scripts you are talking about, without spending a lot of time looking at them and researching.


    Dave

Re: Updating scripts from late 90's
by gellyfish (Monsignor) on Apr 12, 2005 at 16:01 UTC

    $value =~ s/%(..)/pack("c",hex($1))/ge;

    This looks like you are decoding URL encoded form data yourself - in modern code you probably want to use the CGI module to access CGI form parameters.

    /J\

Re: Updating scripts from late 90's
by ikegami (Patriarch) on Apr 12, 2005 at 15:57 UTC

    The snippet fails badly if a poorly encoded URL is provided.
    $value =~ s/%([A-Fa-f0-9]{2})/pack("c",hex($1))/ge;
    is much more resilliant. Actually, you should be using CGI instead of home grown alternatives to avoid bugs and problems like this one.

Re: Updating scripts from late 90's
by RazorbladeBidet (Friar) on Apr 12, 2005 at 16:00 UTC
    According to perlhist - 1998 included the release to 5.005. But, these scripts of yours could have been written for any version up to and including that.

    I suggest you check perlhist for a comprehensive list of changes to Perl.
    --------------
    "But what of all those sweet words you spoke in private?"
    "Oh that's just what we call pillow talk, baby, that's all."
Re: Updating scripts from late 90's
by cog (Parson) on Apr 12, 2005 at 15:53 UTC
    I am planning to update

    And exactly what to you mean by "update"?

    What kind of things will updating the scripts with latest Perl Technology do for my server?

    What kind of updating will that be?

    Will it give me faster processing time and what else?

    What are you going to do, precisely?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (5)
As of 2024-03-29 11:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found