Perl Monk, Perl Meditation | |
PerlMonks |
Re: RFC: Shell::DWIMby Zaxo (Archbishop) |
on Oct 07, 2002 at 16:52 UTC ( [id://203395]=note: print w/replies, xml ) | Need Help?? |
The system function is inherently platform specific. Its arguments must be in a form the OS can digest, and available system calls vary widely between platforms. It seems to me that system as it is reminds us to think twice before calling it. On *nix, the value returned by system doesn't necessarily reflect an OS error. It may contain an application-specific exit code. In perl, you can write exit -5; to indicate, say, that command line arguments are not to your liking, and provide other exit codes to help diagnose other runtime problems. When perl system or a command line process returns, the process run is done and its environment has evaporated. Its $! (errno) is gone. All that is left is what can be recovered by wait. The child error $? encodes the low eight bits of the of the exit code, a signal number and a flag indicating a core dump. What distinct information is available on exit from a VMS, Win32 or OS/2 system call? How much different are the extended error returns? After Compline,
In Section
Meditations
|
|