develooper Front page | perl.perl5.porters | Postings from November 1999

[ID 19991112.002] patch: Exporter.pm not reporting path

From:
JD Laub
Date:
November 12, 1999 07:58
Subject:
[ID 19991112.002] patch: Exporter.pm not reporting path
Message ID:
199911121558.IAA08915@mocha.iasi.com

This is a bug report for perl from jdl@access-health.com,
generated with the help of perlbug 1.26 running under perl 5.00503.


-----------------------------------------------------------------

The Exporter does not report a pathname if the module name contains '::'.
Here are two examples; the first works fine, the 2nd shows the problem:

	% perl -MCwd=99 -e0
	Cwd 99 required--this is only version 2.01 (/ora2/jdl/PERL/dest/lib/perl5/5.00503/Cwd.pm) at -e line 0

    % perl -MData::Dumper=99 -e0
    Data::Dumper 99 required--this is only version 2.101 at -e line 0
    BEGIN failed--compilation aborted.

What I would expect for the latter:

    % perl -MData::Dumper=99 -e0
    Data::Dumper 99 required--this is only version 2.101 (/ora2/jdl/PERL/dest/lib/perl5/5.00503/Data/Dumper.pm) at -e line 0
    BEGIN failed--compilation aborted.

Here's the patch to fix it.  It's been tested against hpux & win32.

*** Exporter.pm.old	Sat Dec 12 10:28:58 1998
--- Exporter.pm	Fri Nov 12 08:36:26 1999
***************
*** 217,223 ****
      my $version = ${"${pkg}::VERSION"};
      if (!$version or $version < $wanted) {
  	$version ||= "(undef)";
! 	my $file = $INC{"$pkg.pm"};
  	$file &&= " ($file)";
  	require Carp;
  	Carp::croak("$pkg $wanted required--this is only version $version$file")
--- 217,224 ----
      my $version = ${"${pkg}::VERSION"};
      if (!$version or $version < $wanted) {
  	$version ||= "(undef)";
! 	    # %INC contains slashes, but $pkg contains double-colons.
! 	my $file = (map {s,::,/,g; $INC{$_}} "$pkg.pm")[0];
  	$file &&= " ($file)";
  	require Carp;
  	Carp::croak("$pkg $wanted required--this is only version $version$file")

Cheers...

-----------------------------------------------------------------

---
Site configuration information for perl 5.00503:

Configured by jdl at Fri Nov 12 08:20:36 MST 1999.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
    osname=hpux, osvers=10.20, archname=PA-RISC1.1
    uname='hp-ux mocha b.10.20 e 9000869 433596371 8-user license '
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.7.2.1
    cppflags='-D_HPUX_SOURCE -I/usr/local/include'
    ccflags ='-D_HPUX_SOURCE -I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib
    libs=-lnsl_s -lndbm -ldld -lm -lc -lndir -lcrypt
    libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred '
    cccdlflags='-fpic', lddlflags='-b -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl 5.00503:
    /ora2/jdl/PERL/dest/lib/perl5/5.00503/PA-RISC1.1
    /ora2/jdl/PERL/dest/lib/perl5/5.00503
    /ora2/jdl/PERL/dest/lib/perl5/site_perl/5.005/PA-RISC1.1
    /ora2/jdl/PERL/dest/lib/perl5/site_perl/5.005
    .

---
Environment for perl 5.00503:
    HOME=/home/jdl
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/oracle/734/lib:/usr/lib/X11
    LOGDIR (unset)
    PATH=/ora2/jdl/PERL/dest/bin:/home/jdl/bin:/home/jdl/sbin:/home/jdl/bin.mocha:/usr/local/bin:/usr/ucb:/bin:/sbin:/usr/ucb:/bin:/sbin:/usr/bin:/opt/vim/bin:/etc:/usr/etc:/usr/bin/X11:/home/oracle/bin:.:/usr/sbin:/usr/lib:/usr/vue/bin:/usr/local/share/bin:/opt/softbench/bin:/usr/ccs/bin:/usr/contrib/bin:/opt/ansic/bin:/opt/nettladm/bin:/opt/pd/bin:/usr/contrib/bin/X11:/opt/upgrade/bin:/opt/perf/bin:/opt/CC/bin:/opt/langtools/bin:/opt/imake/bin:/opt/hpnp//bin:/opt/hparray/bin:/opt/pred/bin:/opt/ignite/bin:/opt/aCC/bin:/opt/graphics/OpenGL/debugger/bin:/opt/atria/bin:/opt/atria/bugtrack:/oracle/734/bin
    PERL_BADLANG (unset)
    SHELL=/home/jdl/bin.mocha/zsh



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