Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: BEGIN { } block

by ggvaidya (Pilgrim)
on Aug 09, 2009 at 10:48 UTC ( [id://787154]=note: print w/replies, xml ) Need Help??

in reply to BEGIN { } block

Remember that use statements are implicitly emBEGINned - they're evaluated as soon as perl understands that they're there. So BEGIN blocks are actually evaluated not just when use is used, but before any other (non-BEGIN) code executes at all.

I've written a web application which uses BEGIN {} blocks to set up signal handlers for die()/warn() calls to do various site-specific stuff with them (like e-mailing the errors to the system admin so he knows there's problem afoot, and silencing warnings on the production site but making them fatal otherwise).

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-05-26 15:38 GMT
Find Nodes?
    Voting Booth?

    No recent polls found