in reply to Death can be such a Tragedy
Always check for success on system calls.
Anything that can go wrong (that depends on Perl interacting with your system in some way, whether opening a file, making a database connection, executing a program via system or backticks, or the like) needs to be checked. If your program can't continue if it can't open its configuration file, die. If you have a reasonable set of defaults available, warn.
You would use Carp in places where you need to get the context of the error. carp <=> warn and croak <=> die, but they report more details, making debugging easier.
Update: confess gives you a full stack trace -- which functions were called, what arguments did they get. It's industrial strength.
|
|---|