perl - Why does this program use return with various different exit codes? -


what meaning of return different values in exit_code below:

sub exit_code {     $testresult = shift;     if ( $testresult eq "pass" ) {         return 0;     } elsif ( $testresult eq "fail" ) {         return 1; }     elsif ( $testresult eq "abort" ) {         return 40;     } else {         print "invalid testresult argument passed..\n";         print "valid testresults are: pass, fail or abort\n";     } } 

in *nix, programs have return values, can evaluated (e.g., using $? environment variable). 0 means program completed without error. values larger 0 mean error occurred, , documentation should state each unique value means. while perl functions not share semantics of returning 0 upon successful execution, function presumably used return exit code for program.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -