develooper Front page | perl.perl5.porters | Postings from June 2008

Re: Generic system() replacements

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
June 18, 2008 03:18
Subject:
Re: Generic system() replacements
Message ID:
20080618101810.14261.qmail@lists.develooper.com
Paul Fenwick schreef:

> eval {
>   run($some_command);
>   run($some_other_command);
> };
>
> if ($@) {
>   say $@->command;
>   say $@->exitval;
>   say $@->signal_no;
>   say $@->signal_name;
>   say $@->dumped_core;
>   say "Pretty printed error: $@";
> }


Consider:

 eval {
   run($some_command);
   run($some_other_command);
   1;
 }
 or do {
   my $err = $@;
   say $err->command;
   say $err->exitval;
   say $err->signal_no;
   say $err->signal_name;
   say $err->dumped_core;
   say "Pretty printed error: $err";
 };

-- 
Affijn, Ruud

"Gewoon is een tijger."

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About