in reply to Capturing SGE exit code in Perl
This doesn't work, however. I get an error related to strict because of the @cmd array, but I don't understand why it has to be an array. Actually, I tried using a scalar first, but it didn't work either.
You skipped a chapter on argument passing, see http://perldoc.perl.org/perlintro.html#Writing-subroutines ( and/or http://learn.perl.org/books/beginning-perl/, http://perl-tutorial.org/, Modern Perl )
use
sub qsub { my ( $args, $msg ) = @_; my ($stdout, $stderr, $success, $exit_code) = capture_exec( $args ); if( not $success or $exit_code > 0 or length $stderr ){ die "$error_message ( exit_code $exit_code )( stderr $stderr )\n"; } }
|
|---|