palette has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I have a .pl script. Inside the .pl script I am using a system command to call another script.
Consider the first script as 1.pl and the second one as 2.pl
There are print stmts in 2.pl and there are chances that 2.pl can throw error.
I have to catch the error in eval block and print the error in the script 1.pl
1.pl code snippet
Pls note if 2.pl is displaying any output that should not be treated as error and caught in $@;
I have a .pl script. Inside the .pl script I am using a system command to call another script.
Consider the first script as 1.pl and the second one as 2.pl
There are print stmts in 2.pl and there are chances that 2.pl can throw error.
I have to catch the error in eval block and print the error in the script 1.pl
1.pl code snippet
... .. eval { system("perl 2.pl"); }; if($@) { print "the error that was thrown in 2.pl"; } ...
Pls note if 2.pl is displaying any output that should not be treated as error and caught in $@;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: system command
by tachyon-II (Chaplain) on Jun 18, 2008 at 12:44 UTC | |
by palette (Scribe) on Jun 18, 2008 at 12:58 UTC | |
by tachyon-II (Chaplain) on Jun 18, 2008 at 14:05 UTC | |
Re: system command
by psini (Deacon) on Jun 18, 2008 at 12:28 UTC | |
Re: system command
by olus (Curate) on Jun 18, 2008 at 12:32 UTC | |
Re: system command
by zentara (Archbishop) on Jun 18, 2008 at 15:21 UTC |
Back to
Seekers of Perl Wisdom