On Tue, May 22, 2001 at 01:11:39PM +0100, Mike Guy wrote:
> It has long been a pet hate of mine that one has to write circumlocutions
> like
>
> { package DB; use vars '$single' };
>
> in order to avoid "used once" warnings.
I have mixed feelings on this. Using other variable's packages is
bad, and I'd like it to remain relatively difficult to do so.
However, explicitly declaring that you're going to use someone else's
variable is better than just nabbing the thing directly. And yes, the
tricks necessary to get around the "used only once" warnings are
annoying.
How about this. C< use vars '$OS2::is_aout'; > will only work if that
variable has already been declared/used by the other package.
As an alternative/addition, a seperate pragma. C< use your '$OS2::is_aout' >
I particularly like this as it reduces the scope of vars.pm, its complexity
and what it should do. your.pm can be distributed independently as a CPAN
module, thus the new syntax will be useful before 5.8.0 (something that
makes things like our() not yet entirely useful).
And as a brain fart, perhaps a 'your' keyword? C< your $OS2::is_aout; >
--
Michael G. Schwern <schwern@pobox.com> http://www.pobox.com/~schwern/
Perl6 Quality Assurance <perl-qa@perl.org> Kwalitee Is Job One
<purl> Hey, Schwern! THERE IS A HUGE GAZORGANSPLATTEDFARTMONGERING-
LIGHTENINGBEASTASAURSOPOD BEHIND YOU! RUN, BEFORE IT GAFLUMMOXES YOUR
INNARDLYBITS!
Thread Previous
|
Thread Next