Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: open or die..

by Corion (Patriarch)
on Feb 14, 2015 at 19:43 UTC ( [id://1116718]=note: print w/replies, xml ) Need Help??


in reply to open or die..

If you think your exception handling is not working, why do you show us the code where the exception gets thrown?

Maybe you want to show us the code of your exception handling and tell us how it fails to do what you think it should do?

Have you tried replicating the situation without needing a file? Does your exception handling work for a simple, unconditional die statement?

Replies are listed 'Best First'.
Re^2: open or die..
by Laurent_R (Canon) on Feb 15, 2015 at 11:57 UTC
    Yes, an exception is raised, but why doesn't it print the message that is given as a param to the die built-in? I would expect that.

    For example:

    $ perl -e 'open my $FOO, "<", "foo2.txt" or die "Could not open file + foo2.txt : $!";' Could not open file foo2.txt : No such file or directory at -e line 1.

    Je suis Charlie.

      I completely missed that the error message as caught was not the error message as (should have been) raised.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1116718]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-28 23:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found