Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: Take reference and then dereference die() and warn()

by dmitri (Curate)
on Nov 09, 2013 at 04:52 UTC ( #1061795=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Take reference and then dereference die() and warn()
in thread Take reference and then dereference die() and warn()

I realize that; my error message is much longer than "failed", and I do not want to copy-and-paste it.


Comment on Re^4: Take reference and then dereference die() and warn()
Replies are listed 'Best First'.
Re^5: Take reference and then dereference die() and warn()
by Laurent_R (Monsignor) on Nov 09, 2013 at 10:27 UTC

    OK, I understand your motivations, now.

    You still have numerous simpler ways to do it, such as storing your long error message in a variable (you actually had a $error variable in your original post) or doing something like this:

    $ perl -e 'use diagnostics; $die_on_err=shift; 0 or print "error messa +ge" and ($die_on_err? die $! : warn "\n" ) ' 0 error message
    or, yet simpler, using a subroutine such as the one proposed by Jenda in this post: Re: Take reference and then dereference die() and warn().

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (9)
As of 2015-07-30 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (270 votes), past polls