in reply to Re: Multiple Package in one file with equal named variables
in thread Multiple Package in one file with equal named variables

You'll get warnings about "masks earlier declaration", but you intend to do that.
Yes, I do. But I do not like the warnings, as they possibly hide the important ones and you can't find the forest amongst the trees.

And it came to pass that in time the Great God Om spake unto Brutha, the Chosen One: "Psst!"
(Terry Pratchett, Small Gods)

  • Comment on Re^2: Multiple Package in one file with equal named variables

Replies are listed 'Best First'.
Re^3: Multiple Package in one file with equal named variables
by Roy Johnson (Monsignor) on Jan 30, 2006 at 17:06 UTC
    The usual way of dealing with warnings for things that you intend to do is to turn off warnings around the offending statement. Often that's done for a lexical scope, but since you don't want to introduce multiple lexical scopes, you'd do:
    no warnings 'misc'; my @values = (...); use warnings 'misc';
    At this point, you're probably at the point that wrapping each package in its own lexical scope looks like the Right Thing To Do. It is.

    For reference, perldoc perllexwarn shows the various categories of warnings you can turn on and off, and perldoc perldiag lists some of the warning messages and which category they fall into. (I found it odd that the "masks earlier declaration" didn't fall under the "redefine" category, and instead was thrown into "misc".)


    Caution: Contents may have been coded under pressure.