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

Re: Nested runtime warning disabling

by gaal (Parson)
on Jul 26, 2004 at 20:42 UTC ( [id://377572]=note: print w/replies, xml ) Need Help??


in reply to Nested runtime warning disabling

Hackish, but you could use Hook::LexWrap to surround your GenerateWarning() with a wrapper that does no warnings;.

Replies are listed 'Best First'.
Re^2: Nested runtime warning disabling
by kryten (Scribe) on Jul 28, 2004 at 10:02 UTC
    Thanks. I tried out Hook::LexWrap
    use Hook::LexWrap; sub test_warnings { my $lexical = wrap 'GenerateWarning', pre => sub { no warnings }; GenerateWarning(); AnotherSub(); }
    This does produce the result I was looking for, but I agree it is a little hackish.

    Does anyone have a more elegant solution?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-25 09:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found