Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Too many "or die" clauses?

by bloonix (Monk)
on Jun 17, 2008 at 10:16 UTC ( #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? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2022-01-28 16:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (73 votes). Check out past polls.

    Notices?