The quickest way to do this is to redirect stderr to /dev/null near the top of the script. This will direct any runtime stderr output from die() or warn() to /dev/null.
Code:
open STDERR, "/dev/null" or die "Cannot redirect stderr: $!";
If you are stuck on never receiving a single error message from your script then you can wrap the above statement in a BEGIN block.
Code:
BEGIN {
open STDERR, "/dev/null" or die "Cannot redirect stderr: $!";
}
This will swallow up all runtime errors and any compile time errors that are generated after the BEGIN phase (ie use()ing a module that doesn't exist will still generate and error to the terminal). This second option isn't a good way to go because if there are any errors in the script it will just quit silently.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.