Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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 Tokenizer.pm, or add
BEGIN { $INC{"warnings.pm"}="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 "warnings.pm". "warnings.pm" does its work in warnings::import(), called when some code does "use warnings," but since you've told it that "warnings.pm" has already been read, and warnings::import() is undefined, Perl won't call it, and hence won't create the annoyance.


Comment on Re: How can I suppress 'uninitialized' warnings in a CPAN module?
Select or Download Code
Replies are listed 'Best First'.
Re^2: How can I suppress 'uninitialized' warnings in a CPAN module?
by Anonymous Monk on Nov 18, 2013 at 00:03 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (12)
As of 2015-07-30 12:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls