P is for Practical | |
PerlMonks |
Error moduleby hotshot (Prior) |
on Aug 18, 2003 at 09:56 UTC ( [id://284522]=perlquestion: print w/replies, xml ) | Need Help?? |
hotshot has asked for the wisdom of the Perl Monks concerning the following question:
Hi everyone! I'm trying to use Error in my command line utility and had some troubles doing so. For example: Several things: 1. The above example doesn't work, I found out later that func1() should be defined BEFORE the try block. Why is that? 2. After I moved the definition of func1() before the try block (now it's working), I still didn't understand how can I return to the try block execution after the catch block finishes, from CPAN: catch CLASS with BLOCK BLOCK will be passed two arguments. The first will be the error being thrown. The second is a reference to a scalar variable. If this variable is set by the catch block then, on return from the catch block, try will continue processing as if the catch block was never found.Can anyone help here? 3. If I add at the end of the file a print print "End of program\n";, I get the following error (the program exits after printing the line): Can't use sting ("1") as a HASHREF while "strict refs" in use at /usr/lib/perl5/site_perl/5.8.0/Error.pm line 456 If I put two print lines at the end, only the first one is printed. As I said I want to put the try/catch in the main loop of my CLI to catch exeptions of command execution, so this problem realy gets me stucked, anyone for this one? Hotshot
Back to
Seekers of Perl Wisdom
|
|