I have several Perl scripts that use something like this:
eval { require 'libs/filter.lib' };
if (eval "defined(&filters)") {
($result1, $result2) = filters($example1, $example2, ...);
}
In this example,
sub filters($example1, $example2, ...) { } is a subroutine inside of
libs/filter.lib. I honestly don't remember why I use
eval... maybe to suppress error messages if there's a problem? It's been awhile since I wrote it, so I honestly don't remember.
Every so often, I have to make a manual modification to filter.lib. What I want to do is, if there's a fatal error in that file, I want to write the error code in a text file within the same directory. It currently writes to the error_log, which is fine, but it's a larger file in a separate directory and it would be a lot easier if I could just write it to its own unique file.
Any suggestions?