in reply to ActivePerl exit codes

If the exit code is an error return from a system call being passed through, it could mean ERROR_INVALID_DATA, but the only way to interprete that (maybe) is if you knew what syscall was returning it.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail

Replies are listed 'Best First'.
Re^2: ActivePerl exit codes
by qadwjoh (Scribe) on Jun 11, 2004 at 14:12 UTC
    Turns out it's a 'permission denied error' : perl.exe can't open the perl script. I had the script run again and redirected both STDOUT and STDERR to a file and that's what it prints out.

    It's funny there's no listing of these codes on the net somewhere...

    Thanks for the help,
    A

      Take a look at errno.h in your local C compiler include directory. 13 translates to EACCESS which marries up with your 'permission denied'.

      From that I guess it is safe to assume that perl.exe uses the appropriate unix-style error code as exit values.

      It would be nice if this was tagged in perlrun somewhere, but it probably the default expectation for unix tools and so doesn't rate a mention.


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
        It would be nice if this was tagged in perlrun somewhere, but it probably the default expectation for unix tools and so doesn't rate a mention.

        It isn't. The default for most unix utilities is to just exit with 1 (or 255 for a few)[1]. Test exits with 1 for false condition and 2 for an error. A few programs give a detailed error code depending on the error. I however have never seen any (other than Perl) that would use the ERRNO code as a return value. Ruby exits with 1 no matter what.

        Update: I have $? printed in my bash prompt, that's how I know.

        [1]: I'm not sure in that.

        Update: The glibc manual says

        ... it does not work to use the value of `errno' as the exit status--these can exceed 255.
        This is not yet actual as the errno codes are less than 126 in my system, but there might be much more in later systems. (There are 252 syscalls in linux, they will soon exceed one byte. Lucky the number is stored in %eax so we can have up to 4G syscalls and 2G errno values:)