|Pathologically Eclectic Rubbish Lister|
Error Handling with Packagesby Dru (Hermit)
|on May 23, 2005 at 15:42 UTC||Need Help??|
Dru has asked for the wisdom of the Perl Monks concerning the following question:
Can someone point me in the right direction on error handling with packages? I have some die statements in a custom package, in case certain files don't exist, but it's preventing the rest of my script from executing when the die is encountered. Ideally, I would like to build in an error checking mechanism that if the package dies, I can catch this within the script and perform some action based on it. I thought something like this would work:
but $status never prints anything if the package dies. I have "return 1" at the end of the package, so maybe that's my problem?
My error handling skills are limited to "die" and "warn". I would appreciate if someone could point me in the right direction on how to handle this.