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
| [reply] |
| [reply] |
| [reply] |
It seems normal to me that if you use a Perl script to launch an application, the Perl script will continue to run until the application it has launched returns to the script. The script will then continue.
Perhaps you want to launch a detached process instead? (I'm not sure how this is done under Windows.)
--t. alex
"Nyahhh (munch, munch) What's up, Doc?" --Bugs Bunny
| [reply] |
Try using exec instead of system if you don't need a return value from the other program you are running. Your perl.exe will be overwritten in memory by the other program. flounder
| [reply] [d/l] [select] |
well you could you try exec instead.
The exec function executes a system command and never returns-- use system instead of exec if you want it to return.
system does exactly the same thing as exec LIST, except that a fork is done first, and the parent process waits for the child process to complete. | [reply] |