develooper Front page | perl.perl5.porters | Postings from March 2007

Re: Exporter Warning Mystery

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
March 9, 2007 10:06
Subject:
Re: Exporter Warning Mystery
Message ID:
20070309180632.GU5748@plum.flirble.org
On Fri, Mar 09, 2007 at 06:58:36PM +0100, Rafael Garcia-Suarez wrote:
> On 09/03/07, Nicholas Clark <nick@ccl4.org> wrote:
> >Why does it warn if it's reading its libraries from the build tree, but not
> >when they're installed?
> 
> Feature !
> 
> See in gv.c :
> 
>                /* performance hack: if filename is absolute and it's a 
>                standard
>                 * module, don't bother warning */

Yes, I just remembered that I'd read that comment (while watering my plants)
and wondered it if was it.

This part of Exporter.t is currently bogus:

my $warnings;
BEGIN {
    $SIG{__WARN__} = sub { $warnings = join '', @_ };
    package Testing::Unused::Vars;
    @ISA = qw(Exporter);
    @EXPORT = qw(this $TODO that);

    package Foo;
    Testing::Unused::Vars->import;
}

::ok( !$warnings, 'Unused variables can be exported without warning' ) ||
  print "# $warnings\n";


(because the test C<require>s Exporter, rather than C<use>ing it)


Should we fix Exporter not to warn? Rather than relying on "performance hack"
to keep it quiet?

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About