Front page | perl.perl5.porters |
Postings from October 1999
[ID 19991025.006] Documentation Error For require Operator
From:
Williams, James P
Date:
October 25, 1999 13:47
Subject:
[ID 19991025.006] Documentation Error For require Operator
Message ID:
FF2855070F62D211910F00805FA7BBFF2D6998@USAHOUM8
This is a bug report for perl from
james.p.williams@usahq.unitedspacealliance.com,
generated with the help of perlbug 1.20 running under perl 5.00404.
-----------------------------------------------------------------
[Please enter your report here]
The perlfunc man page provides a sub that illustrates the behavior of the
require operator. The camel book shows a similar version. There is a bug
in
both models of the operator in how the %INC hash is updated. As written,
recursively require'ing the same $filename would cause infinite recursive
calls
to the require sub. This is because %INC is updated only after the
require'd
file is passed to the do operator. The following patch to perlfunc.pod
changes
the model to correctly assume success for the duration of the do operator,
and
agrees with my reading of how require is actually implemented in pp_ctl.c.
Agreed?
Jim Williams
*** /usr/local/lib/perl5/pod/perlfunc.pod Wed Feb 11 14:27:03 1998
--- perlfunc.pod Mon Oct 25 13:58:35 1999
***************
*** 2549,2554 ****
--- 2549,2555 ----
foreach $prefix (@INC) {
$realfilename = "$prefix/$filename";
if (-f $realfilename) {
+ $INC{$filename} = $realfilename;
$result = do $realfilename;
last ITER;
}
***************
*** 2555,2563 ****
}
die "Can't find $filename in \@INC";
}
die $@ if $@;
die "$filename did not return true value" unless $result;
- $INC{$filename} = $realfilename;
$result;
}
--- 2556,2564 ----
}
die "Can't find $filename in \@INC";
}
+ delete $INC{$filename} if $@ || !$result;
die $@ if $@;
die "$filename did not return true value" unless $result;
$result;
}
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Site configuration information for perl 5.00404:
Configured by scotth at Wed Dec 3 09:14:22 PST 1997.
Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
Platform:
osname=irix, osvers=6.5, archname=irix-n32
uname='irix hoshi 6.5 11251326 ip22 '
hint=recommended, useposix=true, d_sigaction=define
bincompat3=y useperlio=define d_sfio=undef
Compiler:
cc='cc -n32 -mips3', optimize='-O3 -mips3', gccversion=
cppflags='-D_BSD_SIGNALS -D_BSD_TYPES -D_BSD_TIME -OPT:Olimit=0:space=ON
-DLANGUAGE_C -DEMBEDMYMALLOC'
ccflags ='-D_BSD_SIGNALS -D_BSD_TYPES -D_BSD_TIME -woff 1009,1110,1184
-OPT:Olimit=0:space=ON -DLANGUAGE_C -DEMBEDMYMALLOC'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
voidflags=15, castflags=0, d_casti32=define, d_castneg=define
intsize=4, alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='cc', ldflags ='-n32'
libpth=/usr/lib32 /lib32
libs=-lm
libc=/usr/lib32/libc.so, so=so
useshrplib=true, libperl=libperl.so.4.4
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=''
cccdlflags=' ', lddlflags='-n32 -mips3 -shared'
Locally applied patches:
---
@INC for perl 5.00404:
/usr/share/lib/perl5/irix-n32/5.00404
/usr/share/lib/perl5
/usr/share/lib/perl5/site_perl/irix-n32
/usr/share/lib/perl5/site_perl
/usr/share/lib/perl5/sgi_perl
.
---
Environment for perl 5.00404:
HOME=/share/williams
LANG=C
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=.:/share/williams/bin:/usr/sbin:/usr/bsd:/sbin:/usr/bin:/bin:/usr/bin/X
11:/ircm/cps/bin:/usr/local/bin:/etc:/usr/etc:/usr/lib:/usr/demos/bin
PERL_BADLANG (unset)
SHELL=/bin/csh
-
[ID 19991025.006] Documentation Error For require Operator
by Williams, James P