Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: die function

by GhodMode (Pilgrim)
on Aug 02, 2006 at 06:02 UTC ( [id://565172]=note: print w/replies, xml ) Need Help??


in reply to die function

You've got two questions there. I'm not sure I understand the first one, and I don't use eval much. So, I'll just try to answer the second one.

By default, die adds the file name and line number to the end of whatever message you give it, but it takes it off if the message has a newline (\n) at the end.

If you want to put the information somewhere in the middle of the message, the tokens __LINE__ and __FILE__ are the line number and filename. Use them like constants (outside of any quotes). $0 also contains the file name. If you're in a subroutine, you can use the caller function, which, if used in a list context, returns the package, file name, and line number that the current subroutine was called from.

--
-- Ghodmode
Blessed is he who has found his work; let him ask no other blessedness.
-- Thomas Carlyle

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-19 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found