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

Re: Exporter Warning Mystery

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
March 10, 2007 04:38
Subject:
Re: Exporter Warning Mystery
Message ID:
20070310123847.GW5748@plum.flirble.org
On Fri, Mar 09, 2007 at 07:11:41PM +0100, Rafael Garcia-Suarez wrote:
> On 09/03/07, Nicholas Clark <nick@ccl4.org> wrote:
> >Should we fix Exporter not to warn? Rather than relying on "performance 
> >hack"
> >to keep it quiet?
> 
> Yes, that would be a bug. And looking at the code, the performance
> hack is really hackish.

The test suite visits it 28 times:

   1387        28                        file = GvFILE(gv);
   1388                                  /* performance hack: if filename is absolute and it's a standard
   1389                                   * module, don't bother warning */
   1390                  #ifdef MACOS_TRADITIONAL
   1391                  # define LIB_COMPONENT ":lib:"
   1392                  #else
   1393                  # define LIB_COMPONENT "/lib/"
   1394                  #endif
   1395        28                        if (file
   1396                                      && PERL_FILE_IS_ABSOLUTE(file)
   1397                                      && (instr(file, LIB_COMPONENT) || instr(file, ".pm")))
   1398                                  {
   1399        28                            continue;
   1400                                  }
   1401        28                        CopLINE_set(PL_curcop, GvLINE(gv));
   1402                  #ifdef USE_ITHREADS
   1403                                  CopFILE(PL_curcop) = (char *)file; /* set for warning */
   1404                  #else
   1405        28                        CopFILEGV(PL_curcop) = gv_fetchfile(file);
   1406                  #endif
   1407        28                        Perl_warner(aTHX_ packWARN(WARN_ONCE),
   1408                                          "Name \"%s::%s\" used only once: possible typo",
   1409                                          HvNAME_get(stash), GvNAME(gv));
   1410                              }
   1411                          }
   1412                      }

http://www.maddingue.net/perlcover/cover1/cover_db/--gv-c.html

It appears to have been added with change 4545

Change 4545 by gsar@onru on 1999/11/11 06:04:20

        another change towards a shareable optree: avoid pointer to filegv
        in COP; revert parts of change#4485 and s/xcv_filegv/xcv_file/
        (CvFILE() may yet come in handy somewhere); adjust compiler doodads
        to suit

http://public.activestate.com/cgi-bin/perlbrowse/p/4545


I'm wondering, should we remove it?

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