Ron Bergin wrote: >> print $s @_ or die $!; >> >> The downside is that the warning still gets printed: >> >> print() on unopened filehandle NOSUCH at trap-print-errors2.pl >> line 12. >> >> And $! isn't very meaningful: >> >> trapped error Bad file descriptor at trap-print-errors2.pl line >> 12. >> >> 2. The warnings pragmatic module has an option for turning warnings >> into errors: >> >> use warnings FATAL => 'all'; >> print $s @_; >> >> This eliminates the warning message and gives me a meaningful $@: >> >> trapped error print() on unopened filehandle NOSUCH at >> trap-print-errors2.pl line 24. >> > > It's interesting that you found the warning message to be meaningless, > but the exact same message was helpful when you told the pragma to > raise the level of warnings to be fatal. > > I should have said nearly the same message. Both messages told you where the problem was located and with that info it should have been easy to find/fix the problem. In my mind that's not meaningless.
-- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/