I think both the comments above are great solutions to your quandary, along with being very similiar.
The Nagios software will conduct a number actions for you, however you specify. It will watch for normal activity, log in specified events and notify when necessary. You can also schedule outages along with other things relative to a centralized monitoring system. The one pretty big downfall is that it is not the easiest software to customize, particularly when you are looking for something used for simple scripts.
The second solution, in your case, is most likely ideal for you and is really a VERY simplified version of Nagios. In your case, along with the wonders of Perl, there are a number of ways to take care of this. I'll add a simple example that might hopefully spark your imagination.
First, hopefully you wont have to be weary of every line of code in your scripts. Generally speaking, there are a limited numbrer of things that will unexpectedly cause your script to fail. In these circumstances, you can 'catch' these by using the
eval{} block, followed by a test for
$@ special variable.
For example:
eval {
die 'Ack!';
};
print "ERROR: $@\n";
exit;
__END__
Will output:
ERROR: Ack!
Using this, you can:
eval {
# Something that can die ...
};
Your::CustomMod::launch_error( $@ ) if ( $@ );
This way, you can programatically avoid areas where you want a die, warn, etc. to happen, yet catch the unexpected. You can be sure you catch only what you want to catch.
Good Luck