develooper Front page | perl.perl5.porters | Postings from September 2002

Recent changes to Exporter::Heavy break Math::Pari

Thread Next
From:
David Dyck
Date:
September 27, 2002 22:25
Subject:
Recent changes to Exporter::Heavy break Math::Pari
Message ID:
Pine.LNX.4.33.0209272224090.14195-100000@dd.tc.fluke.com

Sorry for the potential duplicate post, I forgot to set the subject
correctly.



It seems like Change 17806 on 2002/08/29 22:56:45
broke Math::Pari and the enclosed test case

Exporter::Heavy no longer reset's it's cache if
 %{"${pkg}::EXPORT"} had been undefined

     my($exports, $export_cache) = (\@{"${pkg}::EXPORT"},
-                                   \%{"${pkg}::EXPORT"});
+                                   $Exporter::Cache{$pkg} ||= {});


Here is a test case that demonstrates how Math::Pari's attempt
to update its @EXPORT_OK is ignored by Exporter::Heavy.

$ cat mp.pl
#!/usr/local/bin/perl -w
use strict;

use Math::Pari 'floor';

eval q( use Math::Pari qw(Pi); print "Pi=",Pi,"\n"; );
if ($@) { warn "# eval reports: $@\n"; }



$ perl mp.pl
# eval reports: "Pi" is not exported by the Math::Pari module
Can't continue after import errors at /usr/local/lib/perl5/site_perl/5.9.0/i686-linux/Math/Pari.pm line 1116
BEGIN failed--compilation aborted at (eval 1) line 1.

In an earlier email Ilya said:
> The raw effect is that @EXPORT_OK may increase between calls to
> Exporter::export().  However, Exporter caches the value.  With older
> Perls it was enough to `undef %EXPORT' to clear the Exporter's cache.
> What one needs to do with the newer ones?

If we add
  $Exporter::Cache{$p} = {};
near the code in Math::Pari::import where it  undef's %EXPORT;
the test case above doesn't fail.

I hope that Exporter could add a member function that
would invalidate the cache, and packages that need
to invalidate the cache could do it after testing with C<can>

Perhaps an even better way would be to re-examine EXPORT_OK
each time for 'new' additions.

You decide what is best...

  David



Summary of my perl5 (revision 5.0 version 9 subversion 0 patch 17933) configuration:
  Platform:
    osname=linux, osvers=2.4.20-pre7, archname=i686-linux
    uname='linux dd 2.4.20-pre7 #1 fri sep 13 08:19:01 pdt 2002 i686 '
    config_args='-Dmksymlinks -Dinstallusrbinperl -Uversiononly -Dusedevel -Doptimize=-O3 -g -de -Dcf_email=dcd@tc.fluke.com'
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 -g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='egcs-2.91.66.1 19990314/Linux (egcs-1.1.2 release)', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lgdbm -ldbm -ldb -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/lib/libc.so.5.4.44, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: DEBUGGING USE_LARGE_FILES
  Locally applied patches:
  	DEVEL17881
  Built under linux
  Compiled at Sep 26 2002 11:43:24
  @INC:
    /usr/local/lib/perl5/5.9.0/i686-linux
    /usr/local/lib/perl5/5.9.0
    /usr/local/lib/perl5/site_perl/5.9.0/i686-linux
    /usr/local/lib/perl5/site_perl/5.9.0
    /usr/local/lib/perl5/site_perl/5.8.0/i686-linux
    /usr/local/lib/perl5/site_perl/5.8.0
    /usr/local/lib/perl5/site_perl/5.7.3
    /usr/local/lib/perl5/site_perl
    .





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