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.