Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: How can I suppress 'uninitialized' warnings in a CPAN module?

by educated_foo (Vicar)
on Nov 17, 2013 at 16:25 UTC ( #1062998=note: print w/replies, xml ) Need Help??

in reply to How can I suppress 'uninitialized' warnings in a CPAN module?

Why does the "no warnings 'uninitialized';" not work?
"use warnings" and "no warnings" are lexical, which means that you can't change them in modules you use. I'd remove "use warnings;" from, or add
BEGIN { $INC{""}="blah" }
to the beginning of your program.

EDIT: To explain, %INC is a hash table where Perl keeps track of what modules it has already loaded. The above line tells Perl "yeah, yeah, I've already loaded "". "" does its work in warnings::import(), called when some code does "use warnings," but since you've told it that "" has already been read, and warnings::import() is undefined, Perl won't call it, and hence won't create the annoyance.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1062998]
[erix]: I've been to Amsterdam before you were born
[LanX]: 1899?
[chacham]: Just paint the white house black again.
dbander snorts
LanX Gesundheit! :)
talexb wonders about dividing developers in those born before the Unix timestamp of zero .. and after. Spoiler: I'm before.
chacham remebers I am a mad scientist
[stevieb]: talexb I'm after by a few years, but we can still be friends because you live in my hometown ;)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2017-08-18 13:24 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (302 votes). Check out past polls.