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

Fellow Monasterians:

I know that the Perlish way to handle an errors, like writing to a file, is to die, print the error $!, and take the forced exit. However, because I am writing commercial end-user web apps, I can't just exit—I need to put the best face on the error and keep the program going. In review, this is what I was taught:

... open UPLOADFILE, ">$upload_dir/$filename" or die "$!\n"; ...

However, this is basically what I have been doing instead:

my $error = uploader($dir, $name); print $error if ($error); sub uploader { my ($upload_dir, $filename) = @_; ... open UPLOADFILE, ">$upload_dir/$filename" or return("There was a pr +oblem uploading your file: $!"); ... }

Is it "safe" or "good practice" not to die? Or is there some intrinsic value of die that I am missing by not using it? Thanks all!

"The important work of moving the world forward does not wait to be done by perfect men." George Eliot