open doesn't normally die on errors, so actually, your exception handling kind of is working ;-)
Looks to me like you might be using a combination of diagnostics and autodie:
#!/usr/bin/env perl use warnings; use strict; use diagnostics -traceonly; use autodie; open FOO, '<', '/tmp/foo/' or die "ACK! $!"; __END__ Uncaught exception from user code: Can't open '/tmp/foo/' for reading: 'No such file or directory' at - + line 6 main::__ANON__("FOO", "<", "/tmp/foo/") called at - line 6
If you don't want open to die and you want to handle the error yourself, you can lexically disable autodie, as shown in its synopsis:
{ no autodie qw(open); # open failures won't die open(my $fh, "<", $filename); # Could fail silently! # ^^^ add your "or die" to this open }
In reply to Re: open or die..
by Anonymous Monk
in thread open or die..
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |