views:

260

answers:

5

I'm trying to execute a copy of the Perl interpreter using Java's Runtime.exec(). However, it returned error code 9. After running the file a few times, the perl interpreter mysteriously started to return code 253 with no changes in my command at all.

What does code 253 / code 9 mean? A Google search for perl interpreter's exit codes turned up nothing. Where can I find a list of exit codes for the Perl interpreter?

+4  A: 

In normal circumstances, perl will return whatever the program it runs returns. Hence you can not generalize the meaning of the return value without knowing the program it's running.

Leon Timmermans
+4  A: 

Perl itself doesn't have any defined exit codes; unless the perl interpreter crashes in a really horrific way, the exit code is determined by the program that perl is running, not by perl itself.

hobbs
I read that I had to bitshift the return value right 8bits to get the script's return value? Don't they output their return values side by side, occupying one byte each?
futureelite7
+6  A: 

See perldoc perlrun:

If the program is syntactically correct, it is executed. If the program runs off the end without hitting an exit() or die() operator, an implicit exit(0) is provided to indicate successful completion.

Thus, the program you are running must be somehow specifying those exit values via die, exit or equivalent.

Sinan Ünür
+1  A: 

Since the error code changed after some runs; if you are running a Java app as a continuously running webapp, check if it can be some kind of memory leak.

You can test your perl script from various problems by running it with the perl interpreter's -Tw options, for tainted modes and warnings enabled, see perlrun for more info about these.

Thor
Can you explain why taint would help totrck this problem down?
justintime