Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

try-catch with eval-die

by Anonymous Monk
on Jun 29, 2009 at 17:10 UTC ( #775746=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I'm moving away from using Error qw(:try) into using just eval and die for my try-catch blocks.

The annoying thing is that die always prints the line/file info at the end of the message. Is there a clean way of configuring what die prepends to $@?

I just didn't want to regex-it out of $@ myself.

many thanks,
miguel

Replies are listed 'Best First'.
Re: try-catch with eval-die
by kennethk (Abbot) on Jun 29, 2009 at 17:15 UTC
    As discussed in die, if your die (or warn) message is terminated with a new-line character, the line/file information will not be included.
Re: try-catch with eval-die
by perrin (Chancellor) on Jun 29, 2009 at 18:38 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2019-12-11 02:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?