On Apr 19 2007, Nicholas Clark wrote: > On Thu, Apr 19, 2007 at 10:05:30AM +0200, Rafael Garcia-Suarez wrote: > > On 18/04/07, via RT Colin Robertson <perlbug-followup@perl.org> wrote: > > >Running "perl -we 'use Once;'" gives us no warnings, but running "perl > > >-we 'use Once; use Twice;'" gives us: > > > > > >Subroutine Twice::foobar redefined at > > >/usr/local/lib/perl5/5.8.7/Exporter.pm line 65. > > > at Twice.pm line 4 > > > > > >Ideally, there should have been a warning just when compiling Once. > > > > I get a warning with only Once.pm with perl 5.8.8 (and also bleadperl > > and peprl 5.6.2). Not sure what has changed since 5.8.7... > > It might be this one. From perl588delta.pod: > > =head2 no warnings 'category' works correctly with -w > > Previously when running with warnings enabled globally via C<-w>, selective > disabling of specific warning categories would actually turn off all warnings. > This is now fixed; now C<no warnings 'io';> will only turn off warnings in the > C<io> class. Previously it would erroneously turn off all warnings. > > This bug fix may cause some programs to start correctly issuing warnings. > > =cut That seems pretty likely, since Carp::Heavy (ultimately loaded by Exporter) has a C<no warnings "once";> in it. I believe the workaround for this in older perls is to make sure to use warnings before anything else. So for Colin's test, try perl -we 'use warnings; use Once;' And for the in-the-wild case: use warnings; use File::Slurp; use File::Temp; -- Rick Delaney rick@bort.caThread Previous | Thread Next