Beefy Boxes and Bandwidth Generously Provided by pair Networks BBQ
XP is just a number
 
PerlMonks  

Re^2: calling a perl script within a perl script

by sauoq (Abbot)
on Nov 27, 2005 at 12:55 UTC ( #512015=note: print w/ replies, xml ) Need Help??


in reply to Re: calling a perl script within a perl script
in thread calling a perl script within a perl script

system("...") || die "Can't run ...: $!\n";

No, that's almost never what you would want because system(), unlike qx(), returns the exit status which is conventionally 0 on success.

It usually better to be explicit with your system() calls:

if (system( ... ) == 0) { # it succeeded. } else { # it failed. my $exit_val = $? >> 8; my $signal = $? & 127; my $coredump = $? & 128; }

I should note that some people much prefer to write that clause as if (0 == system( ... )) and will go into violent spasms if they see it written as above. Of course, they've probably fallen out of their chairs by now, so we don't have to worry about them too much.

-sauoq
"My two cents aren't worth a dime.";


Comment on Re^2: calling a perl script within a perl script
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://512015]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2013-05-19 04:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (396 votes), past polls