Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: die and subroutine combo

by flounder99 (Friar)
on Oct 08, 2003 at 12:32 UTC ( [id://297554]=note: print w/replies, xml ) Need Help??


in reply to die and subroutine combo

You can do a simple concat. If you put any print statements in the sub they will be printed before the other error message (when the sub is called). This way you don't have to screw arround with signal handlers.
sub mysub { print STDERR "This is printed before the error message.\n"; return "\nThis is printed in the middle of the error message."; } open(TMPFILE,"<datafile.txt") || die "Cant open: $!" . mysub();
outputs:
This is printed before the error message. Cant open: No such file or directory This is printed in the middle of the error message. at temp.pl line 6.

--

flounder

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-20 02:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found