sjhalani has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, I have a perl script on AIX platform which calls a Java program as :- `Java Program 1' Now this Java program calls another perl Script. This Second Perl script in turns call another Java program and captures its output as :- my $output = `Java Program2' This works fine in all platforms other than AIX unix. The above command when executed on AIX returns the value in $? as 139 (I believe this means succesful as 139 << 8 is 0) But If I check the second Java program never gets called. The $output varaible value is eq "" Any help how can I achieve this would be highly appreciated.
  • Comment on Executing a command from a Perl Program on AIX

Replies are listed 'Best First'.
Re: Executing a command from a Perl Program on AIX
by pc88mxer (Vicar) on Mar 21, 2008 at 07:27 UTC
    To check the meaning of the status you should use the W* functions provided by the POSIX module:
    use POSIX; my $st = 139; print "WIFEXITED: ", WIFEXITED($st), "\n"; print "WIFSIGNALED: ", WIFSIGNALED($st), "\n"; print "WTERMSIG: ", WTERMSIG($st), "\n";
    On my Linux system this shows:
    WIFEXITED: 0 WIFSIGNALED: 1 WTERMSIG: 11
    which indicates that the process was terminated by a SEGV signal. You should run this on your AIX box in case AIX uses a different structure for the status code. So it is quite possible that the first java program is segfaulting.