Reputation: 67
eval {require $testRequirePath};
While running the above, if there is syntax error in $testRequirePath
file, then it prints it to the STDOUT. I want to redirect it to /dev/null
. How can i do it?
Upvotes: 3
Views: 1248
Reputation: 98498
What you are seeing is a warning, not an error; errors will be captured by the eval and placed in $@. To suppress warnings also, you can just do:
eval { local $SIG{__WARN__} = sub {}; require $testRequirePath }
Upvotes: 1