http://www.perlmonks.org?node_id=459595

Dru has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

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:
use strict; user warnings; use VPNUser qw(get_vpn_user $user $fullname $location); my $ip = shift; my $time = shift; my $status = get_vpn_user($ip, $time); print "$status\n";
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.

Thanks,
Dru