in reply to segmentation fault for perl

The value returned by system/$? is from the OS. If the OS says the child segfaulted, there's not much Perl can do but to trust it.

I find it very unlikely that the OS would say it segfaulted if it didn't.

Update: Not on Windows, I suppose. Windows has larger exit codes that are squished into the unix format. Are you on Windows? Maybe there's a bug in the emulation.

Replies are listed 'Best First'.
Re^2: segmentation fault for perl
by Anonymous Monk on Jul 06, 2009 at 06:48 UTC
    My os is solaris 10. Stating the problem again. 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.

      You can't find out if a segfault occured by looking at $? >> 8. Do you mean $? & 127? What's the value of $??

      In any case, if a segfault did occur, I can't see how Perl was responsible.