in reply to Re: segmentation fault for perl
in thread segmentation fault for perl

I am invoking the script x.pl from y.pl as system(x.pl); my $exit_status = $? >> 8; I am capturing the status always. It sometimes happen that x.pl is able to execute successfuly (it updates a database before exiting). But capturing the error status in y.pl shows the system(x.pl) has a exit status of segmentation fault. My os is solaris 10

Replies are listed 'Best First'.
Re^3: segmentation fault for perl
by rovf (Priest) on Jul 07, 2009 at 09:23 UTC
    I am invoking the script x.pl from y.pl as system(x.pl);

    I take it to mean system('x.pl');. And I guess you made sure that x.pl has a correct #! line?

    my $exit_status = $? >> 8; I am capturing the status always.
    How do you know that your program died by segmentation fault? $? >> 8 is whatever x.pl passes to its exit call, so from this value alone, you can not deduce that your program segfaulted.

    But *if* it does, it could be that either the Perl used has a problem (that's why I'm asking you about the #! line), or (more likely) that x.pl uses some Perl module which contains compiled parts, so this would be the place to look.

    -- 
    Ronald Fischer <ynnor@mm.st>