in reply to Perl.exe weird behavior on windows

Probably the most important thing to remember when rewriting code to work with Perl.exe is data persistence. Since scripts do not "exit", all data stays in memory. If you depend on something to be empty, or filled from the results of previous code, declaring my $variable=""; in the early part of your code will clear up most data persistence errors.

Remember that BEGIN blocks are executed only when the script is compiled, i.e., the first time you run it. This means that you can open your log files, and your data files / data connections and then leave them open until the END block is run, i.e., on server shutdown, or when the script has been run the number of times defined by the Reload registry entry.

For the average user, Perl scripts should run with no changes. You will usually run into these issues only if the script makes assumptions about variables automatically becoming uninitialized when it is finished executing.

When executing a script that returns a non-zero exit value, Perl.exe removes the script from its internal memory, and the script will be recompiled before it is next executed. A script that calls exit with the value "0", or with no argument, will not be removed from memory.
Source: Activestate.com

cheers
JS

Replies are listed 'Best First'.
Re: Re: Perl.exe weird behavior on windows
by Anonymous Monk on Mar 25, 2004 at 18:40 UTC
    jspart is right. This has nothing to do with the question. Here's the actual quote from ActiveState (emphasis mine):

    Getting your code working with PerlEx Probably the most important thing to remember when rewriting code to work with PerlEx is data persistence. Since scripts do not "exit", all data stays in memory. If you depend on something to be empty, or filled from the results of previous code, declaring my $variable=""; in the early part of your code will clear up most data persistence errors.

    See the difference between PerlEx and perl.exe? It's not even accurate after changing Ex to exe.

Re: Re: Perl.exe weird behavior on windows
by jsprat (Curate) on Jun 10, 2002 at 20:42 UTC
    How does this apply? This looks almost like mod_perl issues...

    (pause while /me searches activestate.com)

    Yep. Look at the PerlEx documentation - it seems you've mistaken 'PerlEX' (AS's web server accelerator) with 'perl.exe'