Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Too many "or die" clauses?

by bloonix (Monk)
on Jun 17, 2008 at 10:16 UTC ( [id://692457]=note: print w/replies, xml ) Need Help??


in reply to Too many "or die" clauses?

Hi, you could wrap system() and chdir().
sub do_exec { my ($cmd, $args) = @_; system("$cmd $args") == 0 or die "Command '$cmd' failed: $!"; } sub do_chdir { my ($dir) = @_; chdir $dir or die "Couldn't change dir to '$dir': $!"; } sub run { do_exec('foo', '--bar baz'); do_chdir('foobar'); do_exec('foo', '--bar baz2'); do_exec('foo2', '--bar baz'); do_chdir('..'); do_exec('bar', '--foo baz'); } run();

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (None)
    As of 2024-04-25 00:02 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found