From: Perl 5 Porters Date: Sat, 4 Jan 1997 05:44:00 +0000 (+1200) Subject: [inseparable changes from patch from perl5.003_18 to perl5.003_19] X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8ebc5c0145d2e3559bce3073437e6d027dcdffcc;p=p5sagit%2Fp5-mst-13.2.git [inseparable changes from patch from perl5.003_18 to perl5.003_19] CORE LANGUAGE CHANGES Subject: Make method cache invisible to user code From: Chip Salzenberg Files: dump.c gv.c gv.h hv.c op.c perl.c pp_hot.c pp_sys.c sv.c toke.c Subject: Never parse "{m,s,y,tr,q{,q,w,x}}:{,:}" as package or label From: Chip Salzenberg Files: toke.c CORE PORTABILITY Subject: Fix $^X under HP-UX From: Chip Salzenberg Files: hints/hpux.sh toke.c Subject: New hints/hpux.sh Date: Tue, 31 Dec 1996 15:09:32 -0800 From: Jeff Okamoto Files: hints/hpux.sh private-msgid: <199612312309.AA283393772@hpcc123.corp.hp.com> DOCUMENTATION Subject: Perlguts, version 28 Date: Fri, 3 Jan 1997 13:10:46 -0800 From: Jeff Okamoto Files: pod/perlguts.pod private-msgid: <199701032110.AA102535846@hpcc123.corp.hp.com> Subject: Miscellaneous pod patches From: Ralf S. Engelschall Files: pod/Makefile pod/perldebug.pod pod/perlfunc.pod pod/perlguts.pod Subject: expanded flock() docs Date: Fri, 03 Jan 1997 19:31:11 -0500 From: Roderick Schertler Files: pod/perlfunc.pod Msg-ID: <4481.852337871@eeyore.ibcinc.com> (applied based on p5p patch as commit 1fd81fbbe87d964ad1f7dbdce41e36f3781dcf82) Subject: Use Text::Wrap in buildtoc; run buildtoc From: Ulrich Pfeifer Files: pod/buildtoc pod/perltoc.pod Subject: Remove obsolete perlovl.pod From: Chip Salzenberg Files: MANIFEST plan9/mkfile pod/perlovl.pod vms/Makefile vms/descrip.mms OTHER CORE CHANGES Subject: Fix segv when calling named closures From: Chip Salzenberg Files: pp_hot.c Subject: Finish rationalizing "undef value" warnings From: Chip Salzenberg Files: doop.c pp.c sv.c t/op/assignwarn.t Subject: Arrange for all "_ Files: gv.c lib/perl5db.pl Subject: Introduce CVf_NODEBUG flag Date: Wed, 01 Jan 1997 15:42:05 -0500 From: Gurusamy Sarathy Files: cv.h pp_hot.c Msg-ID: <199701012042.PAA25994@aatma.engin.umich.edu> (applied based on p5p patch as commit a3d90dd510fe5a67ed9b80e603493d285c30aa97) Subject: Reword 'may be "0"' warning per Larry; fix its line number From: Chip Salzenberg Files: op.c pod/perldiag.pod Subject: 5.003_18: perl_{con,des}truct fixes Date: Fri, 03 Jan 1997 15:42:04 -0500 From: Doug MacEachern Files: perl.c perl.h pod/perlembed.pod pod/perltoc.pod t/op/sysio.t Msg-ID: <199701032042.PAA06766@postman.osf.org> (applied based on p5p patch as commit 316c7b3d7b47e3143f94c7f8621e854c519d1e87) Subject: Fix lost value from READLINE after TIEHANDLE From: Gurusamy Sarathy Files: pp_hot.c sv.h TESTS Subject: Create t/pragma directory; populate with new and old From: Paul Marquess Files: MANIFEST Makefile.SH t/TEST t/comp/use.t t/lib/locale.t t/op/overload.t t/op/use.t t/pragma/locale.t t/pragma/overload.t t/pragma/strict-refs t/pragma/strict-subs t/pragma/strict-vars t/pragma/strict.t t/pragma/subs.t t/pragma/warn-global t/pragma/warning.t Subject: New tests: comp/colon.t and op/assignwarn.t From: Robin Barker Files: MANIFEST t/comp/colon.t t/op/assignwarn.t --- diff --git a/Changes b/Changes index 7eb79fe..6d49f1c 100644 --- a/Changes +++ b/Changes @@ -9,6 +9,139 @@ releases.) ---------------- +Version 5.003_19 +---------------- + +Lots of internal cleanup in this patch, especially plugged memory +leaks when embedded Perl interpreters shut down and restart. The +method cache is now invisible to user code. And there is a new test +directory, "t/pragma". + +IMHO, this is Beta quality code. + +Here's a list of the more significant changes... + + CORE LANGUAGE CHANGES + + Title: "Make method cache invisible to user code" + From: Chip Salzenberg + Files: dump.c gv.c gv.h hv.c op.c perl.c pp_hot.c pp_sys.c sv.c + toke.c + + Title: "Never parse "{m,s,y,tr,q{,q,w,x}}:{,:}" as package or label" + From: Chip Salzenberg + Files: toke.c + + CORE PORTABILITY + + Title: "Fix $^X under HP-UX" + From: Chip Salzenberg + Files: hints/hpux.sh toke.c + + Title: "New hints/hpux.sh" + From: Jeff Okamoto + Msg-ID: <199612312309.AA283393772@hpcc123.corp.hp.com> + Date: Tue, 31 Dec 1996 15:09:32 -0800 + Files: hints/hpux.sh + + OTHER CORE CHANGES + + Title: "Fix segv when calling named closures" + From: Chip Salzenberg + Files: pp_hot.c + + Title: "Finish rationalizing "undef value" warnings" + From: Chip Salzenberg + Files: doop.c pp.c sv.c t/op/assignwarn.t + + Title: "Arrange for all "_ + Files: gv.c lib/perl5db.pl + + Title: "Introduce CVf_NODEBUG flag" + From: Gurusamy Sarathy + Msg-ID: <199701012042.PAA25994@aatma.engin.umich.edu> + Date: Wed, 01 Jan 1997 15:42:05 -0500 + Files: cv.h pp_hot.c + + Title: "Reword 'may be "0"' warning per Larry; fix its line number" + From: Chip Salzenberg + Files: op.c pod/perldiag.pod + + Title: "5.003_18: perl_{con,des}truct fixes" + From: Doug MacEachern + Msg-ID: <199701032042.PAA06766@postman.osf.org> + Date: Fri, 03 Jan 1997 15:42:04 -0500 + Files: perl.c perl.h pod/perlembed.pod pod/perltoc.pod t/op/sysio.t + + Title: "Fix lost value from READLINE after TIEHANDLE" + From: Gurusamy Sarathy + Files: pp_hot.c sv.h + + Title: "Free memory of large lexical variables when leaving scope" + From: Chip Salzenberg + Files: scope.c + + TESTS + + Title: "Create t/pragma directory; populate with new and old" + From: pmarquess@bfsec.bt.co.uk (Paul Marquess) + Files: MANIFEST Makefile.SH t/TEST t/comp/use.t t/lib/locale.t + t/op/overload.t t/op/use.t t/pragma/locale.t t/pragma/overload.t + t/pragma/strict-refs t/pragma/strict-subs t/pragma/strict-vars + t/pragma/strict.t t/pragma/subs.t t/pragma/warn-global + t/pragma/warning.t + + Title: "New tests: comp/colon.t and op/assignwarn.t" + From: Robin Barker + Files: MANIFEST t/comp/colon.t t/op/assignwarn.t + + LIBRARY AND EXTENSIONS + + Title: "Make libs clean under '-w'" + From: Jarkko Hietaniemi + Files: lib/AutoSplit.pm lib/Devel/SelfStubber.pm lib/Env.pm + lib/Math/Complex.pm lib/Pod/Functions.pm lib/Search/Dict.pm + lib/SelfLoader.pm lib/Term/Complete.pm lib/chat2.pl + lib/complete.pl lib/diagnostics.pm lib/ftp.pl lib/termcap.pl + lib/validate.pl + + DOCUMENTATION + + Title: "Perlguts, version 28" + From: Jeff Okamoto + Msg-ID: <199701032110.AA102535846@hpcc123.corp.hp.com> + Date: Fri, 3 Jan 1997 13:10:46 -0800 + Files: pod/perlguts.pod + + Title: "Re: perldelta, take 3" + From: Tim Bunce + Msg-ID: <9701031748.AA15335@toad.ig.co.uk> + Date: Fri, 3 Jan 1997 17:48:46 +0000 + Files: pod/perlnews.pod + + Title: "Miscellaneous pod patches" + From: Ralf S. Engelschall + Files: pod/Makefile pod/perldebug.pod pod/perlfunc.pod + pod/perlguts.pod + + Title: "expanded flock() docs" + From: Roderick Schertler + Msg-ID: <4481.852337871@eeyore.ibcinc.com> + Date: Fri, 03 Jan 1997 19:31:11 -0500 + Files: pod/perlfunc.pod + + Title: "Use Text::Wrap in buildtoc; run buildtoc" + From: Ulrich Pfeifer + Files: pod/buildtoc pod/perltoc.pod + + Title: "Remove obsolete perlovl.pod" + From: Chip Salzenberg + Files: MANIFEST plan9/mkfile pod/perlovl.pod vms/Makefile + vms/descrip.mms + + +---------------- Version 5.003_18 ---------------- diff --git a/MANIFEST b/MANIFEST index 8926a24..4d840b5 100644 --- a/MANIFEST +++ b/MANIFEST @@ -506,7 +506,6 @@ pod/perlmod.pod Module info pod/perlnews.pod News of changes since last version pod/perlobj.pod Object info pod/perlop.pod Operator info -pod/perlovl.pod Overloading info pod/perlpod.pod Pod info pod/perlre.pod Regular expression info pod/perlref.pod References info @@ -560,6 +559,7 @@ t/cmd/subval.t See if subroutine values work t/cmd/switch.t See if switch optimizations work t/cmd/while.t See if while loops work t/comp/cmdopt.t See if command optimization works +t/comp/colon.t See if colons are parsed correctly t/comp/cpp.aux main file for cpp.t t/comp/cpp.t See if C preprocessor works t/comp/decl.t See if declarations work @@ -568,6 +568,7 @@ t/comp/package.t See if packages work t/comp/redef.t See if we get correct warnings on redefined subs t/comp/script.t See if script invokation works t/comp/term.t See if more terms work +t/comp/use.t See if pragmas work t/harness Finer diagnostics from test suite t/io/argv.t See if ARGV stuff works t/io/dup.t See if >& works right @@ -609,7 +610,6 @@ t/lib/io_taint.t See if the untaint method from IO works t/lib/io_tell.t See if seek()/tell()-related methods from IO work t/lib/io_udp.t See if UDP socket-related methods from IO work t/lib/io_xs.t See if XSUB methods from IO work -t/lib/locale.t See if locale support (i18n and l10n) works t/lib/ndbm.t See if NDBM_File works t/lib/odbm.t See if ODBM_File works t/lib/opcode.t See if Opcode works @@ -631,6 +631,7 @@ t/lib/textwrap.t See if Text::Wrap works t/lib/timelocal.t See if Time::Local works t/op/append.t See if . works t/op/array.t See if array operations work +t/op/assignwarn.t See if OP= operators warn correctly for undef targets t/op/auto.t See if autoincrement et all work t/op/bop.t See if bitops work t/op/chop.t See if chop works @@ -660,7 +661,6 @@ t/op/mkdir.t See if mkdir works t/op/my.t See if lexical scoping works t/op/oct.t See if oct and hex work t/op/ord.t See if ord works -t/op/overload.t See if operator overload works t/op/pack.t See if pack and unpack work t/op/pat.t See if esoteric patterns work t/op/push.t See if push and pop work @@ -687,9 +687,17 @@ t/op/tie.t See if tie/untie functions work t/op/time.t See if time functions work t/op/undef.t See if undef works t/op/unshift.t See if unshift works -t/op/use.t See if use works t/op/vec.t See if vectors work t/op/write.t See if write works +t/pragma/locale.t See if locale support (i18n and l10n) works +t/pragma/overload.t See if operator overloading works +t/pragma/strict-refs Tests of "use strict 'refs'" for strict.t +t/pragma/strict-subs Tests of "use strict 'subs'" for strict.t +t/pragma/strict-vars Tests of "use strict 'vars'" for strict.t +t/pragma/strict.t See if strictures work +t/pragma/subs.t See if subroutine pseudo-importation works +t/pragma/warn-global Tests of global warnings for warning.t +t/pragma/warning.t See if warning controls work taint.c Tainting code toke.c The tokener universal.c The default UNIVERSAL package methods diff --git a/Makefile.SH b/Makefile.SH index a336d7d..57acde5 100755 --- a/Makefile.SH +++ b/Makefile.SH @@ -478,7 +478,7 @@ minitest: miniperl @echo "You may see some irrelevant test failures if you have been unable" @echo "to build lib/Config.pm." - cd t && (rm -f perl$(EXE_EXT); $(LNS) ../miniperl$(EXE_EXT) perl$(EXE_EXT)) \ - && ./perl TEST base/*.t comp/*.t cmd/*.t io/*.t op/*.t .clist diff --git a/cv.h b/cv.h index d94fb45..57e8142 100644 --- a/cv.h +++ b/cv.h @@ -48,6 +48,8 @@ struct xpvcv { #define CVf_ANON 0x04 /* CvGV() can't be trusted */ #define CVf_OLDSTYLE 0x08 #define CVf_UNIQUE 0x10 /* can't be cloned */ +#define CVf_NODEBUG 0x20 /* no DB::sub indirection for this CV + (esp. useful for special XSUBs) */ #define CvCLONE(cv) (CvFLAGS(cv) & CVf_CLONE) #define CvCLONE_on(cv) (CvFLAGS(cv) |= CVf_CLONE) @@ -68,3 +70,7 @@ struct xpvcv { #define CvUNIQUE(cv) (CvFLAGS(cv) & CVf_UNIQUE) #define CvUNIQUE_on(cv) (CvFLAGS(cv) |= CVf_UNIQUE) #define CvUNIQUE_off(cv) (CvFLAGS(cv) &= ~CVf_UNIQUE) + +#define CvNODEBUG(cv) (CvFLAGS(cv) & CVf_NODEBUG) +#define CvNODEBUG_on(cv) (CvFLAGS(cv) |= CVf_NODEBUG) +#define CvNODEBUG_off(cv) (CvFLAGS(cv) &= ~CVf_NODEBUG) diff --git a/doop.c b/doop.c index 33726bf..2dccbb9 100644 --- a/doop.c +++ b/doop.c @@ -535,8 +535,8 @@ SV *right; char *lsave; char *rsave; - if (sv == left && !SvOK(sv) && !SvGMAGICAL(sv) && SvTYPE(sv) <= SVt_PVMG) - sv_setpvn(sv, "", 0); /* avoid warning on &= etc. */ + if (optype == OP_BIT_OR && sv == left && !SvOK(sv) && !SvGMAGICAL(sv)) + sv_setpvn(sv, "", 0); /* avoid undef warning on |= */ lsave = lc = SvPV(left, leftlen); rsave = rc = SvPV(right, rightlen); len = leftlen < rightlen ? leftlen : rightlen; diff --git a/dump.c b/dump.c index c0749b8..7aed230 100644 --- a/dump.c +++ b/dump.c @@ -50,7 +50,7 @@ HV* stash; for (entry = HvARRAY(stash)[i]; entry; entry = HeNEXT(entry)) { GV *gv = (GV*)HeVAL(entry); HV *hv; - if (GvCV(gv)) + if (GvCVu(gv)) dump_sub(gv); if (GvFORM(gv)) dump_form(gv); diff --git a/gv.c b/gv.c index 45b6aec..5ffa11b 100644 --- a/gv.c +++ b/gv.c @@ -59,12 +59,16 @@ gv_fetchfile(name) char *name; { char tmpbuf[1200]; + STRLEN tmplen; GV *gv; - sprintf(tmpbuf,"::_<%s", name); - gv = gv_fetchpv(tmpbuf, TRUE, SVt_PVGV); + sprintf(tmpbuf, "_<%s", name); + tmplen = strlen(tmpbuf); + gv = *(GV**)hv_fetch(defstash, tmpbuf, tmplen, TRUE); + if (!isGV(gv)) + gv_init(gv, defstash, tmpbuf, tmplen, FALSE); sv_setpv(GvSV(gv), name); - if (*name == '/' && (instr(name,"/lib/") || instr(name,".pm"))) + if (*name == '/' && (instr(name, "/lib/") || instr(name, ".pm"))) GvMULTI_on(gv); if (perldb) hv_magic(GvHVn(gv_AVadd(gv)), gv, 'L'); @@ -272,11 +276,12 @@ char* name; if (strEQ(name,"import")) gv = (GV*)&sv_yes; else if (strNE(name, "AUTOLOAD")) { - gv = gv_fetchmeth(stash, "AUTOLOAD", 8, 0); - if (gv && (cv = GvCV(gv))) { /* One more chance... */ + if (gv = gv_fetchmeth(stash, "AUTOLOAD", 8, 0)) { + /* One more chance... */ SV *tmpstr = sv_2mortal(newSVpv(HvNAME(stash),0)); sv_catpvn(tmpstr,"::", 2); sv_catpvn(tmpstr, name, nend - name); + cv = GvCV(gv); sv_setsv(GvSV(CvGV(cv)), tmpstr); SvTAINTED_off(GvSV(CvGV(cv))); } @@ -458,7 +463,7 @@ I32 sv_type; sv_type == SVt_PVAV ? '@' : sv_type == SVt_PVHV ? '%' : '$', name); - if (GvCV(*gvp)) + if (GvCVu(*gvp)) warn("(Did you mean &%s instead?)\n", name); stash = 0; } @@ -923,12 +928,12 @@ HV* stash; croak("Not a subroutine reference in overload table"); return FALSE; case SVt_PVCV: - cv = (CV*)sv; - break; + cv = (CV*)sv; + break; case SVt_PVGV: - if (!(cv = GvCV((GV*)sv))) - cv = sv_2cv(sv, &stash, &gv, TRUE); - break; + if (!(cv = GvCVu((GV*)sv))) + cv = sv_2cv(sv, &stash, &gv, TRUE); + break; } if (cv) filled=1; else { diff --git a/gv.h b/gv.h index 3e81cba..c713f4e 100644 --- a/gv.h +++ b/gv.h @@ -63,6 +63,7 @@ HV *GvHVn(); #define GvCV(gv) (GvGP(gv)->gp_cv) #define GvCVGEN(gv) (GvGP(gv)->gp_cvgen) +#define GvCVu(gv) (GvGP(gv)->gp_cvgen ? Nullcv : GvGP(gv)->gp_cv) #define GvLASTEXPR(gv) (GvGP(gv)->gp_lastexpr) diff --git a/hints/hpux.sh b/hints/hpux.sh index 3ac43ff..ded6d4f 100644 --- a/hints/hpux.sh +++ b/hints/hpux.sh @@ -3,12 +3,13 @@ # This file is based on # hints/hpux_9.sh, Perl Configure hints file for Hewlett Packard HP-UX 9.x # Use Configure -Dcc=gcc to use gcc. -# From: Jeff Okamoto +# From: Jeff Okamoto # and # hints/hpux_10.sh, Perl Configure hints file for Hewlett Packard HP-UX 10.x # From: Giles Lean -# This version: December 4, 1996 +# This version: December 27, 1996 +# Current maintainer: Jeff Okamoto # Use Configure -Dcc=gcc to use gcc. # Use Configure -Dprefix=/usr/local to install in /usr/local. @@ -51,8 +52,9 @@ xxuname=`uname -r` if echo $xxuname | $contains '10' then # This system is running 10.0 - xxcpu=`printf %#x \`getconf CPU_VERSION\`` - xxcontext=`grep "$xxcpu" /usr/include/sys/unistd.h` + xxcpu1=`getconf CPU_VERSION` + xxcpu2=`printf %#x ${xxcpu1}` + xxcontext=`grep "$xxcpu2" /usr/include/sys/unistd.h` if echo "$xxcontext" | $contains 'PA-RISC1.1' then archname='PA-RISC1.1' @@ -109,7 +111,12 @@ ccdlflags="-Wl,-E -Wl,-B,deferred $ccdlflags" usemymalloc='y' alignbytes=8 -selecttype='int *' +selecttype='int *' + +# For no good reason, HP-UX sets argv[0] to the name of a script +# executed with #!, which makes $^X wrong. This macro enables a +# workaround. +toke_cflags='ccflags="$ccflags -DARG_ZERO_IS_SCRIPT"' # If your compile complains about FLT_MIN, uncomment the next line # POSIX_cflags='ccflags="$ccflags -DFLT_MIN=1.17549435E-38"' @@ -117,7 +124,7 @@ selecttype='int *' # Comment this out if you don't want to follow the SVR4 filesystem layout # that HP-UX 10.0 uses case "$prefix" in -'') prefix='/opt/perl5' ;; +'') prefix='/opt/perl5.003' ;; esac # Date: Fri, 6 Sep 96 23:15:31 CDT diff --git a/hv.c b/hv.c index 3208b56..e73266b 100644 --- a/hv.c +++ b/hv.c @@ -752,7 +752,7 @@ I32 shared; { if (!hent) return; - if (SvTYPE(HeVAL(hent)) == SVt_PVGV && GvCV(HeVAL(hent))) + if (SvTYPE(HeVAL(hent)) == SVt_PVGV && GvCVu(HeVAL(hent))) sub_generation++; /* May be deletion of method? */ SvREFCNT_dec(HeVAL(hent)); if (HeKLEN(hent) == HEf_SVKEY) { diff --git a/lib/IPC/Open3.pm b/lib/IPC/Open3.pm index 5d85458..794893b 100644 --- a/lib/IPC/Open3.pm +++ b/lib/IPC/Open3.pm @@ -157,27 +157,30 @@ sub _open3 { } if ($dup_wtr) { - open(STDIN, "<&$dad_wtr") if (fileno(STDIN) != fileno($dad_wtr)); + xopen \*STDIN, "<&$dad_wtr" if fileno(STDIN) != fileno($dad_wtr); } else { - close($dad_wtr); - open(STDIN, "<&$kid_rdr"); + xclose $dad_wtr; + xopen \*STDIN, "<&$kid_rdr"; + xclose $kid_rdr; } if ($dup_rdr) { - open(STDOUT, ">&$dad_rdr") if (fileno(STDOUT) != fileno($dad_rdr)); + xopen \*STDOUT, ">&$dad_rdr" if fileno(STDOUT) != fileno($dad_rdr); } else { - close($dad_rdr); - open(STDOUT, ">&$kid_wtr"); + xclose $dad_rdr; + xopen \*STDOUT, ">&$kid_wtr"; + xclose $kid_wtr; } if ($dad_rdr ne $dad_err) { if ($dup_err) { - open(STDERR, ">&$dad_err") - if (fileno(STDERR) != fileno($dad_err)); + xopen \*STDERR, ">&$dad_err" + if fileno(STDERR) != fileno($dad_err); } else { - close($dad_err); - open(STDERR, ">&$kid_err"); + xclose $dad_err; + xopen \*STDERR, ">&$kid_err"; + xclose $kid_err; } } else { - open(STDERR, ">&STDOUT") if (fileno(STDERR) != fileno(STDOUT)); + xopen \*STDERR, ">&STDOUT" if fileno(STDERR) != fileno(STDOUT); } local($")=(" "); exec @cmd diff --git a/lib/Text/Abbrev.pm b/lib/Text/Abbrev.pm index 893f3b1..ae6797c 100644 --- a/lib/Text/Abbrev.pm +++ b/lib/Text/Abbrev.pm @@ -54,10 +54,11 @@ sub abbrev { my $abbrev = shift(@extra); my $len = 1; my $cmp; - foreach $cmp (@cmp) { + WORD: foreach $cmp (@cmp) { next if $cmp eq $name; while (substr($cmp,0,$len) eq $abbrev) { - $abbrev .= shift(@extra); + last WORD unless @extra; + $abbrev .= shift(@extra); ++$len; } } diff --git a/lib/importenv.pl b/lib/importenv.pl index d56f326..c28ffd0 100644 --- a/lib/importenv.pl +++ b/lib/importenv.pl @@ -8,7 +8,7 @@ local($tmp,$key) = ''; -foreach $key (keys(ENV)) { +foreach $key (keys(%ENV)) { $tmp .= "\$$key = \$ENV{'$key'};" if $key =~ /^[A-Za-z]\w*$/; } eval $tmp; diff --git a/lib/perl5db.pl b/lib/perl5db.pl index 1e96613..fce7757 100644 --- a/lib/perl5db.pl +++ b/lib/perl5db.pl @@ -2,7 +2,7 @@ package DB; # Debugger for Perl 5.00x; perl5db.pl patch level: -$VERSION = 0.98; +$VERSION = 0.9801; $header = "perl5db.pl patch level $VERSION"; # Enhanced by ilya@math.ohio-state.edu (Ilya Zakharevich) @@ -354,7 +354,7 @@ sub DB { $filename_ini = $filename; $usercontext = '($@, $!, $,, $/, $\, $^W) = @saved;' . "package $package;"; # this won't let them modify, alas - local(*dbline) = "::_<$filename"; + local(*dbline) = $main::{'_<' . $filename}; $max = $#dbline; if (($stop,$action) = split(/\0/,$dbline{$line})) { if ($stop eq '1') { @@ -499,7 +499,7 @@ sub DB { print $OUT "No file matching `$file' is loaded.\n"; next CMD; } elsif ($file ne $filename) { - *dbline = "::_<$file"; + *dbline = $main::{'_<' . $file}; $max = $#dbline; $filename = $file; $start = 1; @@ -515,7 +515,7 @@ sub DB { $subrange = pop @pieces; $file = join(':', @pieces); if ($file ne $filename) { - *dbline = "::_<$file"; + *dbline = $main::{'_<' . $file}; $max = $#dbline; $filename = $file; } @@ -532,7 +532,7 @@ sub DB { $incr = -1; # for backward motion. $start = $line; $filename = $filename_ini; - *dbline = "::_<$filename"; + *dbline = $main::{'_<' . $filename}; $max = $#dbline; print $LINEINFO $position; next CMD }; @@ -585,7 +585,7 @@ sub DB { print $OUT "Deleting all breakpoints...\n"; my $file; for $file (keys %had_breakpoints) { - local *dbline = "::_<$file"; + local *dbline = $main::{'_<' . $file}; my $max = $#dbline; my $was; @@ -606,7 +606,7 @@ sub DB { $cmd =~ /^L$/ && do { my $file; for $file (keys %had_breakpoints) { - local *dbline = "::_<$file"; + local *dbline = $main::{'_<' . $file}; my $max = $#dbline; my $was; @@ -694,7 +694,7 @@ sub DB { $i += 0; if ($i) { $filename = $file; - *dbline = "::_<$filename"; + *dbline = $main::{'_<' . $filename}; $had_breakpoints{$filename} = 1; $max = $#dbline; ++$i while $dbline[$i] == 0 && $i < $max; @@ -721,7 +721,7 @@ sub DB { $cmd =~ /^A$/ && do { my $file; for $file (keys %had_breakpoints) { - local *dbline = "::_<$file"; + local *dbline = $main::{'_<' . $file}; my $max = $#dbline; my $was; @@ -789,7 +789,7 @@ sub DB { $i += 0; if ($i) { $filename = $file; - *dbline = "::_<$filename"; + *dbline = $main::{'_<' . $filename}; $had_breakpoints{$filename}++; $max = $#dbline; ++$i while $dbline[$i] == 0 && $i < $max; @@ -843,7 +843,7 @@ sub DB { my @hard; for (0 .. $#had_breakpoints) { my $file = $had_breakpoints[$_]; - *dbline = "::_<$file"; + *dbline = $main::{'_<' . $file}; next unless %dbline or %{$postponed_file{$file}}; (push @hard, $file), next if $file =~ /^\(eval \d+\)$/; @@ -854,7 +854,7 @@ sub DB { } for (@hard) { # Yes, really-really... # Find the subroutines in this eval - *dbline = "::_<$_"; + *dbline = $main::{'_<' . $_}; my ($quoted, $sub, %subs, $line) = quotemeta $_; for $sub (keys %sub) { next unless $sub{$sub} =~ /^$quoted:(\d+)-(\d+)$/; @@ -1147,7 +1147,7 @@ sub postponed_sub { my ($file,$i) = (find_sub($subname) =~ /^(.*):(\d+)-.*$/); $i += $offset; if ($i) { - local *dbline = "::_<$file"; + local *dbline = $main::{'_<' . $file}; local $^W = 0; # != 0 is magical below $had_breakpoints{$file}++; my $max = $#dbline; diff --git a/op.c b/op.c index ac7b1a6..327ea8a 100644 --- a/op.c +++ b/op.c @@ -104,9 +104,9 @@ OP *op; if (type != OP_AELEM && type != OP_HELEM) { sprintf(tokenbuf, "Can't use subscript on %s", op_desc[type]); yyerror(tokenbuf); - if (type == OP_RV2HV || type == OP_ENTERSUB) + if (type == OP_ENTERSUB || type == OP_RV2HV || type == OP_PADHV) warn("(Did you mean $ or @ instead of %c?)\n", - type == OP_RV2HV ? '%' : '&'); + type == OP_ENTERSUB ? '&' : '%'); } } @@ -2463,8 +2463,13 @@ OP* other; warnop = k1->op_type; break; } - if (warnop) - warn("Value of %s may be \"0\"; use \"defined\"", op_desc[warnop]); + if (warnop) { + line_t oldline = curcop->cop_line; + curcop->cop_line = copline; + warn("Value of %s construct can be \"0\"; test with defined()", + op_desc[warnop]); + curcop->cop_line = oldline; + } } if (!other) @@ -2794,13 +2799,16 @@ CV *cv; SvREFCNT_dec(CvOUTSIDE(cv)); CvOUTSIDE(cv) = Nullcv; if (CvPADLIST(cv)) { - I32 i = AvFILL(CvPADLIST(cv)); - while (i >= 0) { - SV** svp = av_fetch(CvPADLIST(cv), i--, FALSE); - if (svp) - SvREFCNT_dec(*svp); + /* may be during global destruction */ + if (SvREFCNT(CvPADLIST(cv))) { + I32 i = AvFILL(CvPADLIST(cv)); + while (i >= 0) { + SV** svp = av_fetch(CvPADLIST(cv), i--, FALSE); + if (svp) + SvREFCNT_dec(*svp); + } + SvREFCNT_dec((SV*)CvPADLIST(cv)); } - SvREFCNT_dec((SV*)CvPADLIST(cv)); CvPADLIST(cv) = Nullav; } } @@ -3001,8 +3009,10 @@ OP *block; char *s; I32 ix; - if (op) + if (op) { + SAVEFREEOP(op); sub_generation++; + } if (cv = GvCV(gv)) { if (GvCVGEN(gv)) { /* just a cached method */ @@ -3064,7 +3074,6 @@ OP *block; } if (!block) { CvROOT(cv) = 0; - op_free(op); copline = NOLINE; LEAVE_SCOPE(floor); return cv; @@ -3154,7 +3163,6 @@ OP *block; GvCV(gv) = 0; /* Will remember in SVOP instead. */ CvANON_on(cv); } - op_free(op); copline = NOLINE; LEAVE_SCOPE(floor); return cv; @@ -3470,7 +3478,8 @@ OP *op; if (op->op_flags & OPf_KIDS) { OP* newop; OP* kid; - op = modkids(ck_fun(op), op->op_type); + OPCODE type = op->op_type; + op = modkids(ck_fun(op), type); kid = cUNOP->op_first; newop = kUNOP->op_first->op_sibling; if (newop && @@ -3909,14 +3918,16 @@ OP * ck_lfun(op) OP *op; { - return modkids(ck_fun(op), op->op_type); + OPCODE type = op->op_type; + return modkids(ck_fun(op), type); } OP * ck_rfun(op) OP *op; { - return refkids(ck_fun(op), op->op_type); + OPCODE type = op->op_type; + return refkids(ck_fun(op), type); } OP * @@ -4212,7 +4223,7 @@ OP *op; null(cvop); /* disable rv2cv */ tmpop = (SVOP*)((UNOP*)cvop)->op_first; if (tmpop->op_type == OP_GV) { - cv = GvCV(tmpop->op_sv); + cv = GvCVu(tmpop->op_sv); if (cv && SvPOK(cv) && !(op->op_private & OPpENTERSUB_AMPER)) proto = SvPV((SV*)cv,na); } diff --git a/patchlevel.h b/patchlevel.h index ccdc725..9e19359 100644 --- a/patchlevel.h +++ b/patchlevel.h @@ -1,5 +1,5 @@ #define PATCHLEVEL 3 -#define SUBVERSION 18 +#define SUBVERSION 19 /* local_patches -- list of locally applied less-than-subversion patches. diff --git a/perl.c b/perl.c index 9b3a506..36e4795 100644 --- a/perl.c +++ b/perl.c @@ -34,6 +34,29 @@ dEXTCONST char rcsid[] = "perl.c\nPatch level: ###\n"; #endif #endif +#define I_REINIT \ + STMT_START { \ + chopset = " \n-"; \ + copline = NOLINE; \ + curcop = &compiling; \ + curcopdb = NULL; \ + cxstack_ix = -1; \ + cxstack_max = 128; \ + dbargs = 0; \ + dlmax = 128; \ + laststatval = -1; \ + laststype = OP_STAT; \ + maxscream = -1; \ + maxsysfd = MAXSYSFD; \ + statname = Nullsv; \ + tmps_floor = -1; \ + tmps_ix = -1; \ + op_mask = NULL; \ + dlmax = 128; \ + laststatval = -1; \ + laststype = OP_STAT; \ + } STMT_END + static void find_beginning _((void)); static void forbid_setid _((char *)); static void incpush _((char *)); @@ -105,19 +128,11 @@ register PerlInterpreter *sv_interp; } #ifdef MULTIPLICITY - chopset = " \n-"; - copline = NOLINE; - curcop = &compiling; - dbargs = 0; - dlmax = 128; - laststatval = -1; - laststype = OP_STAT; - maxscream = -1; - maxsysfd = MAXSYSFD; - rsfp = Nullfp; - statname = Nullsv; - tmps_floor = -1; - perl_destruct_level = 1; + I_REINIT; + perl_destruct_level = 1; +#else + if(perl_destruct_level > 0) + I_REINIT; #endif init_ids(); @@ -206,24 +221,125 @@ register PerlInterpreter *sv_interp; /* loosen bonds of global variables */ - setdefout(Nullgv); + if(rsfp) { + (void)PerlIO_close(rsfp); + rsfp = Nullfp; + } + + /* Filters for program text */ + SvREFCNT_dec(rsfp_filters); + rsfp_filters = Nullav; + + /* switches */ + preprocess = FALSE; + minus_n = FALSE; + minus_p = FALSE; + minus_l = FALSE; + minus_a = FALSE; + minus_F = FALSE; + doswitches = FALSE; + dowarn = FALSE; + doextract = FALSE; + sawampersand = FALSE; /* must save all match strings */ + sawstudy = FALSE; /* do fbm_instr on all strings */ + sawvec = FALSE; + unsafe = FALSE; + + Safefree(inplace); + inplace = Nullch; + + Safefree(e_tmpname); + e_tmpname = Nullch; + + if (e_fp) { + PerlIO_close(e_fp); + e_fp = Nullfp; + } + + /* magical thingies */ + + Safefree(ofs); /* $, */ + ofs = Nullch; - sv_free(nrs); + Safefree(ors); /* $\ */ + ors = Nullch; + + SvREFCNT_dec(nrs); /* $\ helper */ nrs = Nullsv; - sv_free(lastscream); - lastscream = Nullsv; + multiline = 0; /* $* */ - sv_free(statname); + SvREFCNT_dec(statname); statname = Nullsv; statgv = Nullgv; - laststatval = -1; - sv_free((SV*)beginav); + /* defgv, aka *_ should be taken care of elsewhere */ + +#if 0 /* just about all regexp stuff, seems to be ok */ + + /* shortcuts to regexp stuff */ + leftgv = Nullgv; + ampergv = Nullgv; + + SAVEFREEOP(curpm); + SAVEFREEOP(oldlastpm); /* for saving regexp context during debugger */ + + regprecomp = NULL; /* uncompiled string. */ + regparse = NULL; /* Input-scan pointer. */ + regxend = NULL; /* End of input for compile */ + regnpar = 0; /* () count. */ + regcode = NULL; /* Code-emit pointer; ®dummy = don't. */ + regsize = 0; /* Code size. */ + regnaughty = 0; /* How bad is this pattern? */ + regsawback = 0; /* Did we see \1, ...? */ + + reginput = NULL; /* String-input pointer. */ + regbol = NULL; /* Beginning of input, for ^ check. */ + regeol = NULL; /* End of input, for $ check. */ + regstartp = (char **)NULL; /* Pointer to startp array. */ + regendp = (char **)NULL; /* Ditto for endp. */ + reglastparen = 0; /* Similarly for lastparen. */ + regtill = NULL; /* How far we are required to go. */ + regflags = 0; /* are we folding, multilining? */ + regprev = (char)NULL; /* char before regbol, \n if none */ + +#endif /* if 0 */ + + /* clean up after study() */ + SvREFCNT_dec(lastscream); + lastscream = Nullsv; + Safefree(screamfirst); + screamfirst = 0; + Safefree(screamnext); + screamnext = 0; + + /* startup and shutdown function lists */ + SvREFCNT_dec(beginav); + SvREFCNT_dec(endav); beginav = Nullav; - sv_free((SV*)endav); endav = Nullav; + /* pid-to-status mappings for waitpid */ + SvREFCNT_dec(pidstatus); + pidstatus = Nullhv; + + /* temp stack during pp_sort() */ + SvREFCNT_dec(sortstack); + sortstack = Nullav; + + /* shortcuts just get cleared */ + envgv = Nullgv; + siggv = Nullgv; + incgv = Nullgv; + errgv = Nullgv; + argvgv = Nullgv; + argvoutgv = Nullgv; + stdingv = Nullgv; + last_in_gv = Nullgv; + + /* reset so print() ends up where we expect */ + setdefout(Nullgv); + /* Prepare to destruct main symbol table. */ hv = defstash; @@ -765,13 +881,13 @@ char* name; I32 create; { GV* gv = gv_fetchpv(name, create, SVt_PVCV); - if (create && !GvCV(gv)) + if (create && !GvCVu(gv)) return newSUB(start_subparse(), newSVOP(OP_CONST, 0, newSVpv(name,0)), Nullop, Nullop); if (gv) - return GvCV(gv); + return GvCVu(gv); return Nullcv; } diff --git a/perl.h b/perl.h index f048d73..d816785 100644 --- a/perl.h +++ b/perl.h @@ -1663,7 +1663,7 @@ IEXT char * Ie_tmpname; IEXT PerlIO * Ie_fp; IEXT U32 Iperldb; /* This value may be raised by extensions for testing purposes */ -IEXT int Iperl_destruct_level IINIT(1); /* 0=none, 1=full, 2=full with checks */ +IEXT int Iperl_destruct_level IINIT(0); /* 0=none, 1=full, 2=full with checks */ /* magical thingies */ IEXT Time_t Ibasetime; /* $^T */ diff --git a/plan9/mkfile b/plan9/mkfile index 938b8e6..e3102f5 100644 --- a/plan9/mkfile +++ b/plan9/mkfile @@ -20,7 +20,7 @@ perlshr = $archlib/CORE/libperlshr.a installman1dir = /sys/man/1 installman3dir = /sys/man/2 -podnames = perl perlbook perlbot perlcall perldata perldebug perldiag perldsc perlembed perlform perlfunc perlguts perlipc perllol perlmod perlobj perlop perlovl perlpod perlre perlref perlrun perlsec perlstyle perlsub perlsyn perltie perltoc perltrap perlvar perlxs perlxstut +podnames = perl perlbook perlbot perlcall perldata perldebug perldiag perldsc perlembed perlform perlfunc perlguts perlipc perllol perlmod perlobj perlop perlpod perlre perlref perlrun perlsec perlstyle perlsub perlsyn perltie perltoc perltrap perlvar perlxs perlxstut libpods = ${podnames:%=pod/%.pod} diff --git a/pod/Makefile b/pod/Makefile index 9012b57..cd01028 100644 --- a/pod/Makefile +++ b/pod/Makefile @@ -3,157 +3,153 @@ CONVERTERS = pod2html pod2latex pod2man pod2text checkpods all: $(CONVERTERS) man PERL = ../miniperl -POD = \ +POD = \ perl.pod \ - perlapio.pod \ - perlbook.pod \ - perlbot.pod \ - perlcall.pod \ - perldata.pod \ - perldebug.pod \ - perldiag.pod \ - perldsc.pod \ - perlembed.pod \ - perlform.pod \ - perlfunc.pod \ - perlguts.pod \ - perlipc.pod \ - perllocale.pod \ - perllol.pod \ - perlmod.pod \ perlnews.pod \ - perlobj.pod \ + perldata.pod \ + perlsyn.pod \ perlop.pod \ - perlovl.pod \ - perlpod.pod \ perlre.pod \ - perlref.pod \ perlrun.pod \ - perlsec.pod \ - perlstyle.pod \ + perlfunc.pod \ + perlvar.pod \ perlsub.pod \ - perlsyn.pod \ - perltie.pod \ - perltoc.pod \ + perlmod.pod \ + perlform.pod \ + perllocale.pod \ + perlref.pod \ + perldsc.pod \ + perllol.pod \ perltoot.pod \ + perlobj.pod \ + perltie.pod \ + perlbot.pod \ + perlipc.pod \ + perldebug.pod \ + perldiag.pod \ + perlsec.pod \ perltrap.pod \ - perlvar.pod \ + perlstyle.pod \ + perlpod.pod \ + perlbook.pod \ + perlembed.pod \ + perlapio.pod \ perlxs.pod \ - perlxstut.pod + perlxstut.pod \ + perlguts.pod \ + perlcall.pod \ + perltoc.pod -MAN = \ +MAN = \ perl.man \ - perlapio.man \ - perlbook.man \ - perlbot.man \ - perlcall.man \ - perldata.man \ - perldebug.man \ - perldiag.man \ - perldsc.man \ - perlembed.man \ - perlform.man \ - perlfunc.man \ - perlguts.man \ - perlipc.man \ - perllocale.man \ - perllol.man \ - perlmod.man \ perlnews.man \ - perlobj.man \ + perldata.man \ + perlsyn.man \ perlop.man \ - perlovl.man \ - perlpod.man \ perlre.man \ - perlref.man \ perlrun.man \ - perlsec.man \ - perlstyle.man \ + perlfunc.man \ + perlvar.man \ perlsub.man \ - perlsyn.man \ - perltie.man \ - perltoc.man \ + perlmod.man \ + perlform.man \ + perllocale.man \ + perlref.man \ + perldsc.man \ + perllol.man \ perltoot.man \ + perlobj.man \ + perltie.man \ + perlbot.man \ + perlipc.man \ + perldebug.man \ + perldiag.man \ + perlsec.man \ perltrap.man \ - perlvar.man \ + perlstyle.man \ + perlpod.man \ + perlbook.man \ + perlembed.man \ + perlapio.man \ perlxs.man \ - perlxstut.man + perlxstut.man \ + perlguts.man \ + perlcall.man \ + perltoc.man -HTML = \ +HTML = \ perl.html \ - perlapio.html \ - perlbook.html \ - perlbot.html \ - perlcall.html \ - perldata.html \ - perldebug.html \ - perldiag.html \ - perldsc.html \ - perlembed.html \ - perlform.html \ - perlfunc.html \ - perlguts.html \ - perlipc.html \ - perllocale.html \ - perllol.html \ - perlmod.html \ perlnews.html \ - perlobj.html \ + perldata.html \ + perlsyn.html \ perlop.html \ - perlovl.html \ - perlpod.html \ perlre.html \ - perlref.html \ perlrun.html \ - perlsec.html \ - perlstyle.html \ + perlfunc.html \ + perlvar.html \ perlsub.html \ - perlsyn.html \ - perltie.html \ - perltoc.html \ + perlmod.html \ + perlform.html \ + perllocale.html \ + perlref.html \ + perldsc.html \ + perllol.html \ perltoot.html \ + perlobj.html \ + perltie.html \ + perlbot.html \ + perlipc.html \ + perldebug.html \ + perldiag.html \ + perlsec.html \ perltrap.html \ - perlvar.html \ + perlstyle.html \ + perlpod.html \ + perlbook.html \ + perlembed.html \ + perlapio.html \ perlxs.html \ - perlxstut.html + perlxstut.html \ + perlguts.html \ + perlcall.html \ + perltoc.html -TEX = \ +TEX = \ perl.tex \ - perlapio.tex \ - perlbook.tex \ - perlbot.tex \ - perlcall.tex \ - perldata.tex \ - perldebug.tex \ - perldiag.tex \ - perldsc.tex \ - perlembed.tex \ - perlform.tex \ - perlfunc.tex \ - perlguts.tex \ - perlipc.tex \ - perllocale.tex \ - perllol.tex \ - perlmod.tex \ perlnews.tex \ - perlobj.tex \ + perldata.tex \ + perlsyn.tex \ perlop.tex \ - perlovl.tex \ - perlpod.tex \ perlre.tex \ - perlref.tex \ perlrun.tex \ - perlsec.tex \ - perlstyle.tex \ + perlfunc.tex \ + perlvar.tex \ perlsub.tex \ - perlsyn.tex \ - perltie.tex \ - perltoc.tex \ + perlmod.tex \ + perlform.tex \ + perllocale.tex \ + perlref.tex \ + perldsc.tex \ + perllol.tex \ perltoot.tex \ + perlobj.tex \ + perltie.tex \ + perlbot.tex \ + perlipc.tex \ + perldebug.tex \ + perldiag.tex \ + perlsec.tex \ perltrap.tex \ - perlvar.tex \ + perlstyle.tex \ + perlpod.tex \ + perlbook.tex \ + perlembed.tex \ + perlapio.tex \ perlxs.tex \ - perlxstut.tex + perlxstut.tex \ + perlguts.tex \ + perlcall.tex \ + perltoc.tex man: pod2man $(MAN) @@ -164,6 +160,9 @@ html: pod2html tex: pod2latex $(TEX) +toc: + $(PERL) -I../lib buildtoc >perltoc.pod + .SUFFIXES: .pm .pod .man .pm.man: pod2man @@ -190,6 +189,7 @@ tex: pod2latex $(TEX) clean: rm -f $(MAN) $(HTML) $(TEX) + rm -f *.aux *.log realclean: clean rm -f $(CONVERTERS) diff --git a/pod/buildtoc b/pod/buildtoc index daf26c1..30fa9ee 100644 --- a/pod/buildtoc +++ b/pod/buildtoc @@ -1,21 +1,23 @@ use File::Find; use Cwd; +use Text::Wrap; -@pods = qw{ - perl - perldata perlsyn perlop perlre perlrun perlfunc perlvar - perlsub perlmod perlform - perlref perldsc perllol perlobj perltie perlbot perlipc - perldebug perldiag perlsec perltrap perlstyle - perlpod perlbook +sub output ($); + +@pods = qw( + perl perlnews perldata perlsyn perlop perlre perlrun perlfunc + perlvar perlsub perlmod perlform perllocale perlref perldsc + perllol perltoot perlobj perltie perlbot perlipc perldebug + perldiag perlsec perltrap perlstyle perlpod perlbook perlembed perlapio perlxs perlxstut perlguts perlcall - }; -for (@pods) { s/$/.pod/ } + ); + +for (@pods) { s/$/.pod/ } $/ = ''; @ARGV = @pods; -($_= < qw(../lib ../ext); + sub getpods { - if (/\.p(od|m)$/) { - my $tmp; + if (/\.p(od|m)$/) { # Skip .pm files that have corresponding .pod files, and Functions.pm. - return if (($tmp = $_) =~ s/\.pm$/.pod/ && -f $tmp); - return if ($_ eq '../lib/Pod/Functions.pm');####Used only by pod itself - + return if /(.*)\.pm$/ && -f "$1.pod"; my $file = $File::Find::name; + return if $file eq '../lib/Pod/Functions.pm'; # Used only by pod itself + die "tut $name" if $file =~ /TUT/; unless (open (F, "< $_\0")) { warn "bogus <$file>: $!"; system "ls", "-l", $file; - } else { + } + else { my $line; while ($line = ) { if ($line =~ /^=head1\s+NAME\b/) { push @modpods, $file; #warn "GOOD $file\n"; return; - } - } + } + } warn "EVIL $file\n"; } } @@ -71,14 +75,14 @@ for (@modpods) { if ($done{$name}++) { # warn "already did $_\n"; next; - } + } push @modules, $_; push @modname, $name; - } -} + } +} + +($_= <FE, with the help of oodles + Larry Wall EFE, with the help of oodles of other folks. EOPOD2B -print; - +output $_; +output "\n"; # flush $LINE exit; sub podset { @@ -141,36 +145,30 @@ sub podset { while(<>) { if (s/^=head1 (NAME)\s*/=head2 /) { $pod = path2modname($ARGV); - sub path2modname { - local $_ = shift; - s/\.p(m|od)$//; - s-.*?/(lib|ext)/--; - s-/-::-g; - s/(\w+)::\1/$1/; - return $_; - } - unitem(); unhead2(); - print "\n \n\n=head2 "; + unitem(); + unhead2(); + output "\n \n\n=head2 "; $_ = <>; if ( /^\s*$pod\b/ ) { - print; + s/$pod\.pm/$pod/; # '.pm' in NAME !? + output $_; } else { s/^/$pod, /; - print; - } + output $_; + } next; } if (s/^=head1 (.*)/=item $1/) { unitem(); unhead2(); - print; nl(); next; - } + output $_; nl(); next; + } if (s/^=head2 (.*)/=item $1/) { unitem(); - print "=over\n\n" unless $inhead2; + output "=over\n\n" unless $inhead2; $inhead2 = 1; - print; nl(); next; + output $_; nl(); next; - } + } if (s/^=item (.*)\n/$1/) { next if $pod eq 'perldiag'; s/^\s*\*\s*$// && next; @@ -179,31 +177,62 @@ sub podset { next if /^[\d.]+$/; next if $pod eq 'perlmod' && /^ftp:/; ##print "=over\n\n" unless $initem; - print ", " if $initem; + output ", " if $initem; $initem = 1; s/\.$//; - print; next; - } - } + s/^-X\b/-I/; + output $_; next; + } + } +} -} +sub path2modname { + local $_ = shift; + s/\.p(m|od)$//; + s-.*?/(lib|ext)/--; + s-/-::-g; + s/(\w+)::\1/$1/; + return $_; +} sub unhead2 { if ($inhead2) { - print "\n\n=back\n\n"; - } - $inhead2 = 0; - $initem = 0; -} + output "\n\n=back\n\n"; + } + $inhead2 = 0; + $initem = 0; +} sub unitem { if ($initem) { - print "\n\n"; + output "\n\n"; ##print "\n\n=back\n\n"; - } + } $initem = 0; -} +} sub nl { - print "\n"; -} + output "\n"; +} + +my $NEWLINE; # how many newlines have we seen recently +my $LINE; # what remains to be printed + +sub output ($) { + for (split /(\n)/, shift) { + if ($_ eq "\n") { + if ($LINE) { + print wrap('', '', $LINE); + $LINE = ''; + } + if ($NEWLINE < 2) { + print; + $NEWLINE++; + } + } + elsif (/\S/ && length) { + $LINE .= $_; + $NEWLINE = 0; + } + } +} diff --git a/pod/perldebug.pod b/pod/perldebug.pod index 5d67ba4..77502f2 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -251,29 +251,11 @@ Delete all installed breakpoints. Set an action to be done before the line is executed. The sequence of steps taken by the debugger is -=over 3 - -=item 1 - -check for a breakpoint at this line - -=item 2 - -print the line if necessary (tracing) - -=item 3 - -do any actions associated with that line - -=item 4 - -prompt user if at a breakpoint or in single-step - -=item 5 - -evaluate line - -=back + 1. check for a breakpoint at this line + 2. print the line if necessary (tracing) + 3. do any actions associated with that line + 4. prompt user if at a breakpoint or in single-step + 5. evaluate line For example, this will print out C<$foo> every time line 53 is passed: @@ -452,6 +434,8 @@ corresponds to F, say, by issuing a command like See L<"Debugger Internals"> below for more details. +=over 12 + =item E [ command ] Set an action (Perl command) to happen before every debugger prompt. diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 6e4a3cf..a9bdb9b 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -2363,12 +2363,12 @@ L for more on this. (W) A copy of the object returned from C (or C) was still valid when C was called. -=item Value of %s may be "0"; use "defined" +=item Value of %s construct can be "0"; test with defined() (W) In a conditional expression, you used , <*> (glob), or -C as a boolean value. Each of these operators may return a +C as a boolean value. Each of these constructs can return a value of "0"; that would make the conditional expression false, which -is probably not what you intended. So, when using these operators in +is probably not what you intended. When using these constructs in conditional expressions, test their values with the C operator. =item Variable "%s" is not exported diff --git a/pod/perlembed.pod b/pod/perlembed.pod index 30c6e0a..e55ee63 100644 --- a/pod/perlembed.pod +++ b/pod/perlembed.pod @@ -51,6 +51,8 @@ L L +L + L This documentation is UNIX specific. @@ -126,7 +128,6 @@ In a sense, perl (the C program) is a good example of embedding Perl from the source distribution. Here's a bastardized, non-portable version of I containing the essentials of embedding: - #include #include /* from the Perl distribution */ #include /* from the Perl distribution */ @@ -173,12 +174,12 @@ calling I. =head2 Calling a Perl subroutine from your C program -To call individual Perl subroutines, you'll need to remove the call to -I and replace it with a call to I. +To call individual Perl subroutines, you can use any of the B +functions documented in the L man page. +In this example we'll use I. That's shown below, in a program I'll call I. - #include #include #include @@ -186,13 +187,16 @@ That's shown below, in a program I'll call I. int main(int argc, char **argv, char **env) { + char *args[] = { NULL }; my_perl = perl_alloc(); perl_construct(my_perl); perl_parse(my_perl, NULL, argc, argv, NULL); - /*** This replaces perl_run() ***/ - perl_call_argv("showtime", G_DISCARD | G_NOARGS, argv); + /*** skipping perl_run() ***/ + + perl_call_argv("showtime", G_DISCARD | G_NOARGS, args); + perl_destruct(my_perl); perl_free(my_perl); } @@ -220,8 +224,15 @@ yielding the number of seconds that elapsed between January 1, 1970 (the beginning of the UNIX epoch), and the moment I began writing this sentence. -If you want to pass some arguments to the Perl subroutine, or -you want to access the return value, you'll need to manipulate the +Note that in this particular case we are not required to call I, +however, in general it's considered good practice to ensure proper +initialization of library code including execution of all object C +methods and package C blocks. + +If you want to pass some arguments to the Perl subroutine, you may add +strings to the C terminated C list passed to I. +In order to pass arguments of another data type and/or examine return values +of the subroutine you'll need to manipulate the Perl stack, demonstrated in the last section of this document: L @@ -235,15 +246,14 @@ flag to L. Arguably, this is the only routine you'll ever need to execute snippets of Perl code from within your C program. Your string can be as long as you wish; it can contain multiple statements; it can -use L or L to include external Perl -files. +include L, L and L to +include external Perl files. Our I lets us evaluate individual Perl strings, and then extract variables for coercion into C types. The following program, I, executes three Perl strings, extracting an C from the first, a C from the second, and a C from the third. - #include #include #include @@ -263,7 +273,7 @@ the first, a C from the second, and a C from the third. perl_construct( my_perl ); perl_parse(my_perl, NULL, 3, embedding, NULL); - + perl_run(my_perl); /** Treat $a as an integer **/ perl_eval("$a = 3; $a **= 2"); printf("a = %d\n", SvIV(perl_get_sv("a", FALSE))); @@ -320,7 +330,6 @@ returning the number of matches found. Here's a sample program, I, that uses all three (long lines have been wrapped here): - #include #include #include static PerlInterpreter *my_perl; @@ -339,7 +348,7 @@ been wrapped here): char *command; command = malloc(sizeof(char) * strlen(string) + strlen(pattern) + 37); sprintf(command, "$string = '%s'; $return = $string =~ %s", - string, pattern); + string, pattern); perl_eval(command); free(command); return SvIV(perl_get_sv("return", FALSE)); @@ -357,11 +366,11 @@ been wrapped here): STRLEN length; command = malloc(sizeof(char) * strlen(*string) + strlen(pattern) + 35); sprintf(command, "$string = '%s'; $ret = ($string =~ %s)", - *string, pattern); - perl_eval(command); - free(command); - *string = SvPV(perl_get_sv("string", FALSE), length); - return SvIV(perl_get_sv("ret", FALSE)); + *string, pattern); + perl_eval(command); + free(command); + *string = SvPV(perl_get_sv("string", FALSE), length); + return SvIV(perl_get_sv("ret", FALSE)); } /** matches(string, pattern, matches) ** @@ -380,7 +389,7 @@ been wrapped here): int i; command = malloc(sizeof(char) * strlen(string) + strlen(pattern) + 38); sprintf(command, "$string = '%s'; @array = ($string =~ %s)", - string, pattern); + string, pattern); perl_eval(command); free(command); array = perl_get_av("array", FALSE); @@ -401,6 +410,8 @@ been wrapped here): my_perl = perl_alloc(); perl_construct( my_perl ); perl_parse(my_perl, NULL, 3, embedding, NULL); + perl_run(my_perl); + text = (char *) malloc(sizeof(char) * 486); /** A long string follows! **/ sprintf(text, "%s", "When he is at a convenience store and the bill \ comes to some amount like 76 cents, Maynard is aware that there is \ @@ -432,7 +443,7 @@ been wrapped here): num_matches = substitute(&text, "s/[aeiou]//gi"); if (num_matches) { printf("substitute: s/[aeiou]//gi...%d substitutions made.\n", - num_matches); + num_matches); printf("Now text is: %s\n\n", text); } /** Attempt a substitution **/ @@ -496,7 +507,6 @@ I that contains all the perlguts necessary to push the two arguments into I and to pop the return value out. Take a deep breath... - #include #include #include @@ -532,6 +542,7 @@ deep breath... sprintf(my_argv[1], "power.pl"); perl_parse(my_perl, NULL, argc, my_argv, NULL); + perl_run(my_perl); PerlPower(3, 4); /*** Compute 3 ** 4 ***/ @@ -613,7 +624,7 @@ reduce symbol table growth. my ($stem, $leaf); no strict 'refs'; - $pkg = "main::$pkg\::"; # expand to full symbol table name + $pkg = "main::$pkg\::"; # expand to full symbol table name ($stem, $leaf) = $pkg =~ m/(.*::)(\w+::)$/; my $stem_symtab = *{$stem}{HASH}; @@ -629,28 +640,28 @@ reduce symbol table growth. && $Cache{$package}{mtime} <= $mtime) { - # we have compiled this subroutine already, - # it has not been updated on disk, nothing left to do - print STDERR "already compiled $package->handler\n"; + # we have compiled this subroutine already, + # it has not been updated on disk, nothing left to do + print STDERR "already compiled $package->handler\n"; } else { - local *FH; - open FH, $filename or die "open '$filename' $!"; - local($/) = undef; - my $sub = ; - close FH; + local *FH; + open FH, $filename or die "open '$filename' $!"; + local($/) = undef; + my $sub = ; + close FH; - #wrap the code into a subroutine inside our unique package - my $eval = qq{package $package; sub handler { $sub; }}; - { - # hide our variables within this block - my($r,$filename,$mtime,$package,$sub); - eval $eval; - } - die $@ if $@; + #wrap the code into a subroutine inside our unique package + my $eval = qq{package $package; sub handler { $sub; }}; + { + # hide our variables within this block + my($filename,$mtime,$package,$sub); + eval $eval; + } + die $@ if $@; - #cache it unless we're cleaning out each time - $Cache{$package}{mtime} = $mtime unless $delete; + #cache it unless we're cleaning out each time + $Cache{$package}{mtime} = $mtime unless $delete; } eval {$package->handler;}; @@ -686,27 +697,27 @@ reduce symbol table growth. int exitstatus = 0; if((perl = perl_alloc()) == NULL) { - fprintf(stderr, "no memory!"); - exit(1); + fprintf(stderr, "no memory!"); + exit(1); } perl_construct(perl); exitstatus = perl_parse(perl, NULL, 2, embedding, NULL); if(!exitstatus) { - exitstatus = perl_run(perl); + exitstatus = perl_run(perl); - while(printf("Enter file name: ") && gets(filename)) { + while(printf("Enter file name: ") && gets(filename)) { - /* call the subroutine, passing it the filename as an argument */ - args[0] = filename; - perl_call_argv("Embed::Persistent::eval_file", - G_DISCARD | G_EVAL, args); + /* call the subroutine, passing it the filename as an argument */ + args[0] = filename; + perl_call_argv("Embed::Persistent::eval_file", + G_DISCARD | G_EVAL, args); - /* check $@ */ - if(SvTRUE(GvSV(errgv))) - fprintf(stderr, "eval error: %s\n", SvPV(GvSV(errgv),na)); - } + /* check $@ */ + if(SvTRUE(GvSV(errgv))) + fprintf(stderr, "eval error: %s\n", SvPV(GvSV(errgv),na)); + } } perl_destruct_level = 0; @@ -740,6 +751,104 @@ Now run: foo says: hello Enter file name: ^C +=head2 Maintaining multiple interpreter instances + +The previous examples have gone through several steps to startup, use and +shutdown an embedded Perl interpreter. Certain applications may require +more than one instance of an interpreter to be created during the lifespan +of a single process. Such an application may take different approaches in +it's use of interpreter objects. For example, a particular transaction may +want to create an interpreter instance, then release any resources associated +with the object once the transaction is completed. When a single process +does this once, resources are released upon exit of the program and the next +time it starts, the interpreter's global state is fresh. + +In the same process, the program must take care to ensure that these +actions take place before constructing a new interpreter. By default, the +global variable C is set to C<0> since extra cleaning +is not needed when a program constructs a single interpreter, such as the +perl executable itself in C or some such. + +You can tell Perl to make everything squeeky clean by setting +C to C<1>. + + perl_destruct_level = 1; /* perl global variable */ + while(1) { + ... + /* reset global variables here with perl_destruct_level = 1 */ + perl_contruct(my_perl); + ... + /* clean and reset _everything_ during perl_destruct */ + perl_destruct(my_perl); /* ah, nice and fresh */ + perl_free(my_perl); + ... + /* let's go do it again! */ + } + +Now, when I is called, the interpreter's syntax parsetree +and symbol tables are cleaned out, along with reseting global variables. + +So, we've seen how to startup and shutdown an interpreter more than once +in the same process, but there was only one instance in existance at any +one time. Hmm, wonder if we can have more than one interpreter instance +running at the _same_ time? +Indeed this is possible, however when you build Perl, you must compile with +C<-DMULTIPLICITY>. + +It's a little tricky for the Perl runtime to handle multiple interpreters, +introducing some overhead that most programs with a single interpreter don't +get burdened with. When you compile with C<-DMULTIPLICITY>, by default, +C is set to C<1> for each interpreter. + +Let's give it a try: + + + #include + #include + + + /* we're going to embed two interpreters */ + /* we're going to embed two interpreters */ + + + #define SAY_HELLO "-e", "print qq(Hi, I'm $^X\n)" + + + int main(int argc, char **argv, char **env) + { + PerlInterpreter + *one_perl = perl_alloc(), + *two_perl = perl_alloc(); + char *one_args[] = { "one_perl", SAY_HELLO }; + char *two_args[] = { "two_perl", SAY_HELLO }; + + perl_construct(one_perl); + perl_construct(two_perl); + + perl_parse(one_perl, NULL, 3, one_args, (char **)NULL); + perl_parse(two_perl, NULL, 3, two_args, (char **)NULL); + + perl_run(one_perl); + perl_run(two_perl); + + perl_destruct(one_perl); + perl_destruct(two_perl); + + perl_free(one_perl); + perl_free(two_perl); + } + + +Compile as usual: + + % cc -o multiplicity multiplicity.c `perl -MExtUtils::Embed -e ccopts -e ldopts` + +Run it, Run it: + + % multiplicity + Hi, I'm one_perl + Hi, I'm two_perl + =head2 Using Perl modules, which themselves use C libraries, from your C program If you've played with the examples above and tried to embed a script diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index c39dd29..62a1965 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -56,9 +56,7 @@ Remember the following rule: =over 8 -=item - -I +=item I =back @@ -1029,14 +1027,35 @@ value is taken as the name of the filehandle. =item flock FILEHANDLE,OPERATION -Calls flock(2) on FILEHANDLE. See L for definition of -OPERATION. Returns TRUE for success, FALSE on failure. Will produce a -fatal error if used on a machine that doesn't implement either flock(2) or -fcntl(2). The fcntl(2) system call will be automatically used if flock(2) -is missing from your system. This makes flock() the portable file locking -strategy, although it will lock only entire files, not records. Note also -that some versions of flock() cannot lock things over the network; you -would need to use the more system-specific fcntl() for that. +Calls flock(2), or an emulation of it, on FILEHANDLE. Returns TRUE for +success, FALSE on failure. Will produce a fatal error if used on a +machine that doesn't implement flock(2), fcntl(2) locking, or lockf(3). +flock() is Perl's portable file locking interface, although it will lock +only entire files, not records. + +OPERATION is one of LOCK_SH, LOCK_EX, or LOCK_UN, possibly combined with +LOCK_NB. These constants are traditionally valued 1, 2, 8 and 4, but +you can use the symbolic names if you pull them in with an explicit +request to the Fcntl module. The names can be requested as a group with +the :flock tag (or they can be requested individually, of course). +LOCK_SH requests a shared lock, LOCK_EX requests an exclusive lock, and +LOCK_UN releases a previously requested lock. If LOCK_NB is added to +LOCK_SH or LOCK_EX then flock() will return immediately rather than +blocking waiting for the lock (check the return status to see if you got +it). + +Note that the emulation built with lockf(3) doesn't provide shared +locks, and it requires that FILEHANDLE be open with write intent. These +are the semantics that lockf(3) implements. Most (all?) systems +implement lockf(3) in terms of fcntl(2) locking, though, so the +differing semantics shouldn't bite too many people. + +Note also that some versions of flock() cannot lock things over the +network; you would need to use the more system-specific fcntl() for +that. If you like you can force Perl to ignore your system's flock(2) +function, and so provide its own fcntl(2)-based emulation, by passing +the switch C<-Ud_flock> to the F program when you configure +perl. Here's a mailbox appender for BSD systems. diff --git a/pod/perlguts.pod b/pod/perlguts.pod index a7fd912..a3ae465 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -90,7 +90,7 @@ which will determine if more memory needs to be allocated. If so, it will call the function C. Note that C can only increase, not decrease, the allocated memory of an SV and that it does not automatically add a byte for the a trailing NUL (perl's own string functions typically do -SvGROW(sv, len + 1)). +C). If you have an SV and want to know what kind of data Perl thinks is stored in it, you can use the following macros to check the type of SV you have. @@ -312,7 +312,7 @@ by using the following: This returns NULL if the variable does not exist. -The hash algorithm is defined in the PERL_HASH(hash, key, klen) macro: +The hash algorithm is defined in the C macro: i = klen; hash = 0; @@ -384,26 +384,24 @@ for information on converting class names into stashes. /* Still under construction */ Upgrades rv to reference if not already one. Creates new SV for rv to -point to. -If classname is non-null, the SV is blessed into the specified class. -SV is returned. +point to. If C is non-null, the SV is blessed into the specified +class. SV is returned. SV* newSVrv(SV* rv, char* classname); -Copies integer or double into an SV whose reference is rv. SV is blessed -if classname is non-null. +Copies integer or double into an SV whose reference is C. SV is blessed +if C is non-null. SV* sv_setref_iv(SV* rv, char* classname, IV iv); SV* sv_setref_nv(SV* rv, char* classname, NV iv); Copies the pointer value (I) into an SV whose -reference is rv. SV is blessed if classname is non-null. +reference is rv. SV is blessed if C is non-null. SV* sv_setref_pv(SV* rv, char* classname, PV iv); -Copies string into an SV whose reference is rv. -Set length to 0 to let Perl calculate the string length. -SV is blessed if classname is non-null. +Copies string into an SV whose reference is C. Set length to 0 to let +Perl calculate the string length. SV is blessed if C is non-null. SV* sv_setref_pvn(SV* rv, char* classname, PV iv, int length); @@ -917,7 +915,7 @@ For a complete description of the PerlIO abstraction, consult L. =head2 Scratchpads -=head3 Putting a C value on Perl stack +=head2 Putting a C value on Perl stack A lot of opcodes (this is an elementary operation in the internal perl stack machine) put an SV* on the stack. However, as an optimization @@ -934,7 +932,7 @@ The macro to put this target on stack is C, and it is directly used in some opcodes, as well as indirectly in zillions of others, which use it via C<(X)PUSH[pni]>. -=head3 Scratchpads +=head2 Scratchpads The question remains on when the SV's which are Is for opcodes are created. The answer is that they are created when the current unit -- @@ -952,7 +950,7 @@ The correspondence between OP's and Is is not 1-to-1. Different OP's in the compile tree of the unit can use the same target, if this would not conflict with the expected life of the temporary. -=head3 Scratchpads and recursions +=head2 Scratchpads and recursions In fact it is not 100% true that a compiled unit contains a pointer to the scratchpad AV. In fact it contains a pointer to an AV of @@ -1535,6 +1533,7 @@ Creates a new SV for the RV, C, to point to. If C is not an RV then it will be upgraded to one. If C is non-null then the new SV will be blessed in the specified package. The new SV is returned and its reference count is 1. + SV* newSVrv _((SV* rv, char* classname)); =item newSVsv @@ -2590,4 +2589,4 @@ API Listing by Dean Roehrich . =head1 DATE -Version 27: 1996/12/24 +Version 28: 1996/12/27 diff --git a/pod/perlsec.pod b/pod/perlsec.pod index 69de859..2324b8a 100644 --- a/pod/perlsec.pod +++ b/pod/perlsec.pod @@ -44,6 +44,9 @@ For example: $arg = shift; # $arg is tainted $hid = $arg, 'bar'; # $hid is also tainted $line = <>; # Tainted + $line = ; # Also tainted + open FOO, "/home/me/bar" or die $!; + $line = ; # Still tainted $path = $ENV{'PATH'}; # Tainted, but see below $data = 'abc'; # Not tainted diff --git a/pod/perltoc.pod b/pod/perltoc.pod index 8cac0fa..96cf9f9 100644 --- a/pod/perltoc.pod +++ b/pod/perltoc.pod @@ -6,220 +6,231 @@ perltoc - perl documentation table of contents =head1 DESCRIPTION This page provides a brief table of contents for the rest of the Perl -documentation set. It is meant to be scanned quickly or grepped +documentation set. It is meant to be bescanned quickly or grepped through to locate the proper section you're looking for. =head1 BASIC DOCUMENTATION - - - =head2 perl - Practical Extraction and Report Language =item SYNOPSIS - =item DESCRIPTION - Many usability enhancements, Simplified grammar, Lexical scoping, Arbitrarily nested data structures, Modularity and reusability, -Object-oriented programming, Embeddable and Extensible, POSIX -compliant, Package constructors and destructors, Multiple simultaneous -DBM implementations, Subroutine definitions may now be autoloaded, -Regular expression enhancements +Object-oriented programming, Embeddable and Extensible, POSIX compliant, +Package constructors and destructors, Multiple simultaneous DBM +implementations, Subroutine definitions may now be autoloaded, Regular +expression enhancements, Innumerable Unbundled Modules, Compilability =item ENVIRONMENT - -HOME, LOGDIR, PATH, PERL5LIB, PERL5DB, PERLLIB +HOME, LOGDIR, PATH, PERL5LIB, PERL5DB, PERL_DESTRUCT_LEVEL, PERLLIB =item AUTHOR - =item FILES - =item SEE ALSO - =item DIAGNOSTICS - =item BUGS - =item NOTES +=head2 perlnews - what's new for perl5.004 +=item DESCRIPTION +=item Supported Environments +=item Core Changes -=head2 perldata - Perl data types +=over -=item DESCRIPTION +=item Compilation Option: Binary Compatibility With 5.003 +=item New Opcode Module and Revised Safe Module -=over +=item Internal Change: FileHandle Deprecated -=item Variable names +=item Internal Change: PerlIO internal IO abstraction interface. +=item New and Changed Built-in Variables -=item Context +$^E, $^H, $^M +=item New and Changed Built-in Functions -=item Scalar values +delete on slices, flock, keys as an lvalue, my() in Control Structures, +unpack() and pack(), use VERSION, use Module VERSION LIST, +prototype(FUNCTION), $_ as Default +=item New Built-in Methods -=item Scalar value constructors +isa(CLASS), can(METHOD), VERSION( [NEED] ), class(), is_instance() +=item TIEHANDLE Now Supported -=item List value constructors +TIEHANDLE classname, LIST, PRINT this, LIST, READLINE this, DESTROY this + +=back + +=item Pragmata +use blib, use locale, use ops -=item Typeglobs and FileHandles +=item Modules +=over + +=item Module Information Summary +=item IO +=item Math::Complex + +=item Overridden Built-ins =back +=item Efficiency Enhancements +=item Documentation Changes +L, L, L, L, L, +L -=head2 perlsyn - Perl syntax +=item New Diagnostics -=item DESCRIPTION +"my" variable %s masks earlier declaration in same scope, Allocation too +large: %lx, Allocation too large, Attempt to free non-existent shared +string, Attempt to use reference as lvalue in substr, Unsupported function +fork, Ill-formed logical name |%s| in prime_env_iter, Integer overflow in +hex number, Integer overflow in octal number, Null picture in formline, +Offset outside string, Out of memory!, Out of memory during request for %s, +Possible attempt to put comments in qw() list, Possible attempt to separate +words with commas, untie attempted while %d inner references still exist, +Got an error from DosAllocMem:, Malformed PERLLIB_PREFIX, PERL_SH_DIR too +long, Process terminated by SIG%s +=item BUGS -=over +=item SEE ALSO -=item Declarations +=item HISTORY +=head2 perldata - Perl data types -=item Simple statements +=item DESCRIPTION +=over -=item Compound statements +=item Variable names +=item Context -=item Loop Control +=item Scalar values +=item Scalar value constructors -=item For Loops +=item List value constructors +=item Typeglobs and Filehandles -=item Foreach Loops +=back +=head2 perlsyn - Perl syntax -=item Basic BLOCKs and Switch Statements +=item DESCRIPTION +=over -=item Goto +=item Declarations +=item Simple statements -=item PODs: Embedded Documentation +=item Compound statements +=item Loop Control +=item For Loops +=item Foreach Loops -=back +=item Basic BLOCKs and Switch Statements +=item Goto +=item PODs: Embedded Documentation +=back =head2 perlop - Perl operators and precedence =item SYNOPSIS - =item DESCRIPTION - =over =item Terms and List Operators (Leftward) - =item The Arrow Operator - =item Auto-increment and Auto-decrement - =item Exponentiation - =item Symbolic Unary Operators - =item Binding Operators - =item Multiplicative Operators - =item Additive Operators - =item Shift Operators - =item Named Unary Operators - =item Relational Operators - =item Equality Operators - =item Bitwise And - =item Bitwise Or and Exclusive Or - =item C-style Logical And - =item C-style Logical Or - =item Range Operator - =item Conditional Operator - =item Assignment Operators - =item Comma Operator - =item List Operators (Rightward) - =item Logical Not - =item Logical And - =item Logical or and Exclusive Or - =item C Operators Missing From Perl - unary &, unary *, (TYPE) =item Quote and Quote-like Operators - -=item Regexp Quote-like Operators - +=item Regexp Quote-Like Operators ?PATTERN?, m/PATTERN/gimosx, /PATTERN/gimosx, q/STRING/, C<'STRING'>, qq/STRING/, "STRING", qx/STRING/, `STRING`, qw/STRING/, @@ -228,2937 +239,3254 @@ y/SEARCHLIST/REPLACEMENTLIST/cds =item I/O Operators - =item Constant Folding - =item Integer Arithmetic - - - =back - - - =head2 perlre - Perl regular expressions =item DESCRIPTION - i, m, s, x =over =item Regular Expressions - (?#text), (?:regexp), (?=regexp), (?!regexp), (?imsx) =item Backtracking - =item Version 8 Regular Expressions - =item WARNING on \1 vs $1 - - - =back - - - =head2 perlrun - how to execute the Perl interpreter =item SYNOPSIS - =item DESCRIPTION - =over =item Switches - -B<-0>I, B<-a>, B<-c>, B<-d>, B<-d:foo>, B<-D>I, -B<-D>I, B<-e> I, B<-F>I, B<-i>I, -B<-I>I, B<-l>I, B<-m>I, B<-M>I, -B<-n>, B<-p>, B<-P>, B<-s>, B<-S>, B<-T>, B<-u>, B<-U>, B<-v>, B<-V>, -B<-V:name>, B<-w>, B<-x> I - - +B<-0>[I], B<-a>, B<-c>, B<-d>, B<-d:>I, B<-D>I, +B<-D>I, B<-e> I, B<-F>I, B<-h>, +B<-i>[I], B<-I>I, B<-l>[I], +B<-m>[B<->]I, B<-M>[B<->]I, B<-M>[B<->]I<'module ...'>, +B<-[mM]>[B<->]I, B<-n>, B<-p>, B<-P>, B<-s>, B<-S>, +B<-T>, B<-u>, B<-U>, B<-v>, B<-V>, B<-V:>I, B<-w>, B<-x> I =back - - - =head2 perlfunc - Perl builtin functions =item DESCRIPTION - - + I =over =item Perl Functions by Category - -Functions for SCALARs or strings, Regular expressions and pattern -matching, Numeric functions, Functions for real @ARRAYs, Functions for -list data, Functions for real %HASHes, Input and output functions, -Functions for fixed length data or records, Functions for filehandles, -files, or directories, Keywords related to the control flow of your -perl program, Keywords related to scoping, Miscellaneous functions, -Functions for processes and process groups, Keywords related to perl -modules, Keywords related to classes and object-orientedness, Low-level -socket functions, System V interprocess communication functions, -Fetching user and group info, Fetching network info, Time-related -functions +Functions for SCALARs or strings, Regular expressions and pattern matching, +Numeric functions, Functions for real @ARRAYs, Functions for list data, +Functions for real %HASHes, Input and output functions, Functions for fixed +length data or records, Functions for filehandles, files, or directories, +Keywords related to the control flow of your perl program, Keywords related +to scoping, Miscellaneous functions, Functions for processes and process +groups, Keywords related to perl modules, Keywords related to classes and +object-orientedness, Low-level socket functions, System V interprocess +communication functions, Fetching user and group info, Fetching network +info, Time-related functions, Functions new in perl5, Functions obsoleted +in perl5 =item Alphabetical Listing of Perl Functions - --I FILEHANDLE, -I EXPR, -I, abs VALUE, accept NEWSOCKET,GENERICSOCKET, -alarm SECONDS, atan2 Y,X, bind SOCKET,NAME, binmode FILEHANDLE, bless -REF,CLASSNAME, bless REF, caller EXPR, caller, chdir EXPR, chmod LIST, -chomp VARIABLE, chomp LIST, chomp, chop VARIABLE, chop LIST, chop, -chown LIST, chr NUMBER, chroot FILENAME, close FILEHANDLE, closedir -DIRHANDLE, connect SOCKET,NAME, continue BLOCK, cos EXPR, crypt -PLAINTEXT,SALT, dbmclose ASSOC_ARRAY, dbmopen ASSOC,DBNAME,MODE, -defined EXPR, delete EXPR, die LIST, do BLOCK, do SUBROUTINE(LIST), do -EXPR, dump LABEL, each ASSOC_ARRAY, eof FILEHANDLE, eof (), eof, eval -EXPR, eval BLOCK, exec LIST, exists EXPR, exit EXPR, exp EXPR, fcntl -FILEHANDLE,FUNCTION,SCALAR, fileno FILEHANDLE, flock +-I FILEHANDLE, -I EXPR, -I, abs VALUE, abs, accept +NEWSOCKET,GENERICSOCKET, alarm SECONDS, alarm, atan2 Y,X, bind SOCKET,NAME, +binmode FILEHANDLE, bless REF,CLASSNAME, bless REF, caller EXPR, caller, +chdir EXPR, chmod LIST, chomp VARIABLE, chomp LIST, chomp, chop VARIABLE, +chop LIST, chop, chown LIST, chr NUMBER, chr, chroot FILENAME, chroot, +close FILEHANDLE, closedir DIRHANDLE, connect SOCKET,NAME, continue BLOCK, +cos EXPR, crypt PLAINTEXT,SALT, dbmclose ASSOC_ARRAY, dbmopen +ASSOC,DBNAME,MODE, defined EXPR, defined, delete EXPR, die LIST, do BLOCK, +do SUBROUTINE(LIST), do EXPR, dump LABEL, each ASSOC_ARRAY, eof FILEHANDLE, +eof (), eof, eval EXPR, eval BLOCK, exec LIST, exists EXPR, exit EXPR, exp +EXPR, exp, fcntl FILEHANDLE,FUNCTION,SCALAR, fileno FILEHANDLE, flock FILEHANDLE,OPERATION, fork, format, formline PICTURE, LIST, getc FILEHANDLE, getc, getlogin, getpeername SOCKET, getpgrp PID, getppid, -getpriority WHICH,WHO, getpwnam NAME, getgrnam NAME, gethostbyname -NAME, getnetbyname NAME, getprotobyname NAME, getpwuid UID, getgrgid -GID, getservb - - +getpriority WHICH,WHO, getpwnam NAME, getgrnam NAME, gethostbyname NAME, +getnetbyname NAME, getprotobyname NAME, getpwuid UID, getgrgid GID, +getservbyname NAME,PROTO, gethostbyaddr ADDR,ADDRTYPE, getnetbyaddr +ADDR,ADDRTYPE, getprotobynumber NUMBER, getservbyport PORT,PROTO, getpwent, +getgrent, gethostent, getnetent, getprotoent, getservent, setpwent, +setgrent, sethostent STAYOPEN, setnetent STAYOPEN, setprotoent STAYOPEN, +setservent STAYOPEN, endpwent, endgrent, endhostent, endnetent, +endprotoent, endservent, getsockname SOCKET, getsockopt +SOCKET,LEVEL,OPTNAME, glob EXPR, gmtime EXPR, goto LABEL, goto EXPR, goto +&NAME, grep BLOCK LIST, grep EXPR,LIST, hex EXPR, hex, import, index +STR,SUBSTR,POSITION, index STR,SUBSTR, int EXPR, int, ioctl +FILEHANDLE,FUNCTION,SCALAR, join EXPR,LIST, keys ASSOC_ARRAY, kill LIST, +last LABEL, last, lc EXPR, lc, lcfirst EXPR, lcfirst, length EXPR, length, +link OLDFILE,NEWFILE, listen SOCKET,QUEUESIZE, local EXPR, localtime EXPR, +log EXPR, log, lstat FILEHANDLE, lstat EXPR, lstat, m//, map BLOCK LIST, +map EXPR,LIST, mkdir FILENAME,MODE, msgctl ID,CMD,ARG, msgget KEY,FLAGS, +msgsnd ID,MSG,FLAGS, msgrcv ID,VAR,SIZE,TYPE,FLAGS, my EXPR, next LABEL, +next, no Module LIST, oct EXPR, oct, open FILEHANDLE,EXPR, open FILEHANDLE, +opendir DIRHANDLE,EXPR, ord EXPR, ord, pack TEMPLATE,LIST, package +NAMESPACE, pipe READHANDLE,WRITEHANDLE, pop ARRAY, pos SCALAR, pos, print +FILEHANDLE LIST, print LIST, print, printf FILEHANDLE FORMAT, LIST, printf +FORMAT, LIST, prototype FUNCTION, push ARRAY,LIST, q/STRING/, qq/STRING/, +qx/STRING/, qw/STRING/, quotemeta EXPR, quotemeta, rand EXPR, rand, read +FILEHANDLE,SCALAR,LENGTH,OFFSET, read FILEHANDLE,SCALAR,LENGTH, readdir +DIRHANDLE, readlink EXPR, readlink, recv SOCKET,SCALAR,LEN,FLAGS, redo +LABEL, redo, ref EXPR, ref, rename OLDNAME,NEWNAME, require EXPR, require, +reset EXPR, reset, return LIST, reverse LIST, rewinddir DIRHANDLE, rindex +STR,SUBSTR,POSITION, rindex STR,SUBSTR, rmdir FILENAME, rmdir, s///, scalar +EXPR, seek FILEHANDLE,POSITION,WHENCE, seekdir DIRHANDLE,POS, select +FILEHANDLE, select, select RBITS,WBITS,EBITS,TIMEOUT, semctl +ID,SEMNUM,CMD,ARG, semget KEY,NSEMS,FLAGS, semop KEY,OPSTRING, send +SOCKET,MSG,FLAGS,TO, send SOCKET,MSG,FLAGS, setpgrp PID,PGRP, setpriority +WHICH,WHO,PRIORITY, setsockopt SOCKET,LEVEL,OPTNAME,OPTVAL, shift ARRAY, +shift, shmctl ID,CMD,ARG, shmget KEY,SIZE,FLAGS, shmread ID,VAR,POS,SIZE, +shmwrite ID,STRING,POS,SIZE, shutdown SOCKET,HOW, sin EXPR, sin, sleep +EXPR, sleep, socket SOCKET,DOMAIN,TYPE,PROTOCOL, socketpair +SOCKET1,SOCKET2,DOMAIN,TYPE,PROTOCOL, sort SUBNAME LIST, sort BLOCK LIST, +sort LIST, splice ARRAY,OFFSET,LENGTH,LIST, splice ARRAY,OFFSET,LENGTH, +splice ARRAY,OFFSET, split /PATTERN/,EXPR,LIMIT, split /PATTERN/,EXPR, +split /PATTERN/, split, sprintf FORMAT, LIST, sqrt EXPR, sqrt, srand EXPR, +stat FILEHANDLE, stat EXPR, stat, study SCALAR, study, sub BLOCK, sub NAME, +sub NAME BLOCK, substr EXPR,OFFSET,LEN, substr EXPR,OFFSET, symlink +OLDFILE,NEWFILE, syscall LIST, sysopen FILEHANDLE,FILENAME,MODE, sysopen +FILEHANDLE,FILENAME,MODE,PERMS, sysread FILEHANDLE,SCALAR,LENGTH,OFFSET, +sysread FILEHANDLE,SCALAR,LENGTH, system LIST, syswrite +FILEHANDLE,SCALAR,LENGTH,OFFSET, syswrite FILEHANDLE,SCALAR,LENGTH, tell +FILEHANDLE, tell, telldir DIRHANDLE, tie VARIABLE,CLASSNAME,LIST, tied +VARIABLE, time, times, tr///, truncate FILEHANDLE,LENGTH, truncate +EXPR,LENGTH, uc EXPR, uc, ucfirst EXPR, ucfirst, umask EXPR, umask, undef +EXPR, undef, unlink LIST, unlink, unpack TEMPLATE,EXPR, untie VARIABLE, +unshift ARRAY,LIST, use Module LIST, use Module, use Module VERSION LIST, +use VERSION, utime LIST, values ASSOC_ARRAY, vec EXPR,OFFSET,BITS, wait, +waitpid PID,FLAGS, wantarray, warn LIST, write FILEHANDLE, write EXPR, +write, y/// =back - - - =head2 perlvar - Perl predefined variables =item DESCRIPTION - =over =item Predefined Names - -$ARG, $_, $>, $MATCH, $&, $PREMATCH, $`, $POSTMATCH, $', -$LAST_PAREN_MATCH, $+, $MULTILINE_MATCHING, $*, input_line_number -HANDLE EXPR, $INPUT_LINE_NUMBER, $NR, $, input_record_separator HANDLE -EXPR, $INPUT_RECORD_SEPARATOR, $RS, $/, autoflush HANDLE EXPR, -$OUTPUT_AUTOFLUSH, $|, output_field_separator HANDLE EXPR, -$OUTPUT_FIELD_SEPARATOR, $OFS, $,, output_record_separator HANDLE EXPR, -$OUTPUT_RECORD_SEPARATOR, $ORS, $\, $LIST_SEPARATOR, $", -$SUBSCRIPT_SEPARATOR, $SUBSEP, $;, $OFMT, $#, format_page_number HANDLE -EXPR, $FORMAT_PAGE_NUMBER, $%, format_lines_per_page HANDLE EXPR, -$FORMAT_LINES_PER_PAGE, $=, format_lines_left HANDLE EXPR, -$FORMAT_LINES_LEFT, $-, format_name HANDLE EXPR, $FORMAT_NAME, $~, -format_top_name HANDLE EXPR, $FORMAT_TOP_NAME, $^, -format_line_break_characters HANDLE EXPR, -$FORMAT_LINE_BREAK_CHARACTERS, $:, format_formfeed HANDLE EXPR, -$FORMAT_FORMFEED, $^L, $ACCUMULATOR, $^A, $CHILD_ERROR, $?, $OS_ERROR, -$ERRNO, $!, $EVAL_ERROR, $@, $PROCESS_ID, $PID, $$, $REAL_USER_ID, -$UID, $<, - - +$ARG, $_, $EIE, $MATCH, $&, $PREMATCH, $`, $POSTMATCH, $', +$LAST_PAREN_MATCH, $+, $MULTILINE_MATCHING, $*, input_line_number HANDLE +EXPR, $INPUT_LINE_NUMBER, $NR, $, input_record_separator HANDLE EXPR, +$INPUT_RECORD_SEPARATOR, $RS, $/, autoflush HANDLE EXPR, $OUTPUT_AUTOFLUSH, +$|, output_field_separator HANDLE EXPR, $OUTPUT_FIELD_SEPARATOR, $OFS, $,, +output_record_separator HANDLE EXPR, $OUTPUT_RECORD_SEPARATOR, $ORS, $\, +$LIST_SEPARATOR, $", $SUBSCRIPT_SEPARATOR, $SUBSEP, $;, $OFMT, $#, +format_page_number HANDLE EXPR, $FORMAT_PAGE_NUMBER, $%, +format_lines_per_page HANDLE EXPR, $FORMAT_LINES_PER_PAGE, $=, +format_lines_left HANDLE EXPR, $FORMAT_LINES_LEFT, $-, format_name HANDLE +EXPR, $FORMAT_NAME, $~, format_top_name HANDLE EXPR, $FORMAT_TOP_NAME, $^, +format_line_break_characters HANDLE EXPR, $FORMAT_LINE_BREAK_CHARACTERS, +$:, format_formfeed HANDLE EXPR, $FORMAT_FORMFEED, $^L, $ACCUMULATOR, $^A, +$CHILD_ERROR, $?, $OS_ERROR, $ERRNO, $!, $EXTENDED_OS_ERROR, $^E, +$EVAL_ERROR, $@, $PROCESS_ID, $PID, $$, $REAL_USER_ID, $UID, $<, +$EFFECTIVE_USER_ID, $EUID, $>, $REAL_GROUP_ID, $GID, $(, +$EFFECTIVE_GROUP_ID, $EGID, $), $PROGRAM_NAME, $0, $[, $PERL_VERSION, $], +$DEBUGGING, $^D, $SYSTEM_FD_MAX, $^F, $^H, $INPLACE_EDIT, $^I, $OSNAME, +$^O, $PERLDB, $^P, $BASETIME, $^T, $WARNING, $^W, $EXECUTABLE_NAME, $^X, +$ARGV, @ARGV, @INC, %INC, $ENV{expr}, $SIG{expr} =back - - - =head2 perlsub - Perl subroutines =item SYNOPSIS - =item DESCRIPTION - =over =item Private Variables via my() - =item Temporary Values via local() - =item Passing Symbol Table Entries (typeglobs) - =item Pass by Reference - =item Prototypes - =item Overriding Builtin Functions - =item Autoloading - - - =back =item SEE ALSO - - - - =head2 perlmod - Perl modules (packages) =item DESCRIPTION - =over =item Packages - =item Symbol Tables - =item Package Constructors and Destructors - =item Perl Classes - =item Perl Modules - - - =back =item NOTE - =item THE PERL MODULE LIBRARY - =over =item Pragmatic Modules - -diagnostics, integer, less, overload, sigtrap, strict, subs +blib, diagnostics, integer, less, lib, locale, ops, overload, sigtrap, +strict, subs, vars =item Standard Modules - -AnyDBM_File, AutoLoader, AutoSplit, Benchmark, Carp, Config, Cwd, -DB_File, Devel::SelfStubber, DynaLoader, English, Env, Exporter, -ExtUtils::Liblist, ExtUtils::MakeMaker, ExtUtils::Manifest, -ExtUtils::Mkbootstrap, ExtUtils::Miniperl, Fcntl, File::Basename, -File::CheckTree, File::Find, FileHandle, File::Path, Getopt::Long, -Getopt::Std, I18N::Collate, IPC::Open2, IPC::Open3, Net::Ping, POSIX, -SelfLoader, Safe, Socket, Test::Harness, Text::Abbrev +AnyDBM_File, AutoLoader, AutoSplit, Benchmark, CPAN, CPAN::FirstTime, +CPAN::Nox, Carp, Class::Template, Config, Cwd, DB_File, Devel::SelfStubber, +DirHandle, DynaLoader, English, Env, Exporter, ExtUtils::Embed, +ExtUtils::Install, ExtUtils::Liblist, ExtUtils::MM_OS2, ExtUtils::MM_Unix, +ExtUtils::MM_VMS, ExtUtils::MakeMaker, ExtUtils::Manifest, +ExtUtils::Mkbootstrap, ExtUtils::Mksymlists, ExtUtils::testlib, Fatal, +Fcntl, File::Basename, File::CheckTree, File::Compare, File::Copy, +File::Find, File::Path, File::stat, FileCache, FileHandle, FindBin, +GDBM_File, Getopt::Long, Getopt::Std, I18N::Collate, IO, IO::File, +IO::Handle, IO::Pipe, IO::Seekable, IO::Select, IO::Socket, IPC::Open2, +IPC::Open3, Math::BigFloat, Math::BigInt, Math::Complex, NDBM_File, +Net::Ping, Net::hostent, Net::netent, Net::protoent, Net::servent, Opcode, +Pod::Text, POSIX, SDBM_File, Safe, Search::Dict, SelectSaver, SelfLoader, +Shell, Socket, Symbol, Sys::Hostname, Sys::Syslog, Term::Cap, +Term::Complete, Term::ReadLine, Test::Harness, Text::Abbrev, +Text::ParseWords, Text::Soundex, Text::Tabs, Text::Wrap, Tie::Hash, +Tie::RefHash, Tie::Scalar, Tie::SubstrHash, Time::Local, Time::gmtime, +Time::localtime, Time::tm, UNIVERSAL, User::grent, User::pwent =item Extension Modules - - - =back =item CPAN - -Language Extensions and Documentation Tools, Development Support, -Operating System Interfaces, Networking, Device Control (modems) and -InterProcess Communication, Data Types and Data Type Utilities, -Database Interfaces, User Interfaces, Interfaces to / Emulations of -Other Programming Languages, File Names, File Systems and File Locking -(see also File Handles), String Processing, Language Text Processing, -Parsing and Searching, Option, Argument, Parameter and Configuration -File Processing, Internationalization and Locale, Authentication, -Security and Encryption, World Wide Web, HTML, HTTP, CGI, MIME, Server -and Daemon Utilities, Archiving and Compression, Images, Pixmap and -Bitmap Manipulation, Drawing and Graphing, Mail and Usenet News, -Control Flow Utilities (callbacks and exceptions etc), File Handle and -Input/Output Stream Utilities, Miscellaneous Modules - -=item Modules: Creation, Use and Abuse - +Language Extensions and Documentation Tools, Development Support, Operating +System Interfaces, Networking, Device Control (modems) and InterProcess +Communication, Data Types and Data Type Utilities, Database Interfaces, +User Interfaces, Interfaces to / Emulations of Other Programming Languages, +File Names, File Systems and File Locking (see also File Handles), String +Processing, Language Text Processing, Parsing, and Searching, Option, +Argument, Parameter, and Configuration File Processing, +Internationalization and Locale, Authentication, Security, and Encryption, +World Wide Web, HTML, HTTP, CGI, MIME, Server and Daemon Utilities, +Archiving and Compression, Images, Pixmap and Bitmap Manipulation, Drawing, +and Graphing, Mail and Usenet News, Control Flow Utilities (callbacks and +exceptions etc), File Handle and Input/Output Stream Utilities, +Miscellaneous Modules + +=item Modules: Creation, Use, and Abuse =over =item Guidelines for Module Creation - Do similar modules already exist in some form?, Try to design the new -module to be easy to extend and reuse, Some simple style guidelines, -Select what to export, Select a name for the module, Have you got it -right?, README and other Additional Files, A description of the -module/package/extension etc, A copyright notice - see below, -Prerequisites - what else you may need to have, How to build it - -possible changes to Makefile.PL etc, How to install it, Recent changes -in this release, especially incompatibilities, Changes / enhancements -you plan to make in the future, Adding a Copyright Notice, Give the -module a version/issue/release number, How to release and distribute a -module, Take care when changing a released module +module to be easy to extend and reuse, Some simple style guidelines, Select +what to export, Select a name for the module, Have you got it right?, +README and other Additional Files, A description of the +module/package/extension etc, A copyright notice - see below, Prerequisites +- what else you may need to have, How to build it - possible changes to +Makefile.PL etc, How to install it, Recent changes in this release, +especially incompatibilities, Changes / enhancements you plan to make in +the future, Adding a Copyright Notice, Give the module a +version/issue/release number, How to release and distribute a module, Take +care when changing a released module =item Guidelines for Converting Perl 4 Library Scripts into Modules - There is no requirement to convert anything, Consider the implications, -Make the most of the opportunity, The pl2pm utility will get you -started, Adds the standard Module prologue lines, Converts package -specifiers from ' to ::, Converts die(...) to croak(...), Several other -minor changes +Make the most of the opportunity, The pl2pm utility will get you started, +Adds the standard Module prologue lines, Converts package specifiers from ' +to ::, Converts die(...) to croak(...), Several other minor changes =item Guidelines for Reusing Application Code - Complete applications rarely belong in the Perl Module Library, Many -applications contain some perl code which could be reused, Break-out -the reusable code into one or more separate module files, Take the -opportunity to reconsider and redesign the interfaces, In some cases -the 'application' can then be reduced to a small - - +applications contain some perl code which could be reused, Break-out the +reusable code into one or more separate module files, Take the opportunity +to reconsider and redesign the interfaces, In some cases the 'application' +can then be reduced to a small =back - - - -=head2 perlref - Perl references and nested data structures +=head2 perlform - Perl formats =item DESCRIPTION - =over -=item Symbolic references +=item Format Variables +=back -=item Not-so-symbolic references +=item NOTES +=over +=item Footers +=item Accessing Formatting Internals =back -=item WARNING - +=item WARNINGS -=item SEE ALSO +=head2 perllocale - Perl locale handling (internationalization and +localization) +=item DESCRIPTION +=item PREPARING TO USE LOCALES +=item USING LOCALES +=over -=head2 perldsc - Perl Data Structures Cookbook +=item The use locale pragma -=item DESCRIPTION +=item The setlocale function +=item The localeconv function -arrays of arrays, hashes of arrays, arrays of hashes, hashes of hashes, -more elaborate constructs, recursive and self-referential data -structures, objects +=back -=item REFERENCES +=item LOCALE CATEGORIES +=over -=item COMMON MISTAKES +=item Category LC_COLLATE: Collation +=item Category LC_CTYPE: Character Types -=item CAVEAT ON PRECEDENCE +=item Category LC_NUMERIC: Numeric Formatting +=item Category LC_MONETARY: Formatting of monetary amounts -=item WHY YOU SHOULD ALWAYS C +=item LC_TIME +=item Other categories -=item DEBUGGING +=back +=item SECURITY -=item CODE EXAMPLES +B (C, C, C, C and C):, +B (with C<\l>, C<\L>, C<\u> or <\U>), +B (C):, B (C):, +B (sprintf()):, B (printf() and write()):, B (lc(), +lcfirst(), uc(), ucfirst()):, B +(localeconv(), strcoll(),strftime(), strxfrm()):, B (isalnum(), isalpha(), isdigit(),isgraph(), islower(), isprint(), +ispunct(), isspace(), isupper(), +isxdigit()): +=item ENVIRONMENT -=item LISTS OF LISTS +PERL_BADLANG, LC_ALL, LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, +LC_TIME, LANG +=item NOTES =over -=item Declaration of a LIST OF LISTS - +=item Backward compatibility -=item Generation of a LIST OF LISTS +=item I18N:Collate obsolete +=item Sort speed and memory use impacts -=item Access and Printing of a LIST OF LISTS +=item write() and LC_NUMERIC +=item Freely available locale definitions +=item I18n and l10n +=item An imperfect standard =back -=item HASHES OF LISTS - +=item BUGS =over -=item Declaration of a HASH OF LISTS - +=item Broken systems -=item Generation of a HASH OF LISTS +=back +=item SEE ALSO -=item Access and Printing of a HASH OF LISTS +=item HISTORY +=head2 perlref - Perl references and nested data structures +=item DESCRIPTION +=over -=back +=item Symbolic references -=item LISTS OF HASHES +=item Not-so-symbolic references +=back -=over +=item WARNING -=item Declaration of a LIST OF HASHES +=item SEE ALSO +=head2 perldsc - Perl Data Structures Cookbook -=item Generation of a LIST OF HASHES +=item DESCRIPTION +arrays of arrays, hashes of arrays, arrays of hashes, hashes of hashes, +more elaborate constructs, recursive and self-referential data structures, +objects -=item Access and Printing of a LIST OF HASHES +=item REFERENCES +=item COMMON MISTAKES +=item CAVEAT ON PRECEDENCE +=item WHY YOU SHOULD ALWAYS C -=back +=item DEBUGGING -=item HASHES OF HASHES +=item CODE EXAMPLES +=item LISTS OF LISTS =over -=item Declaration of a HASH OF HASHES +=item Declaration of a LIST OF LISTS +=item Generation of a LIST OF LISTS -=item Generation of a HASH OF HASHES +=item Access and Printing of a LIST OF LISTS +=back -=item Access and Printing of a HASH OF HASHES +=item HASHES OF LISTS + +=over +=item Declaration of a HASH OF LISTS +=item Generation of a HASH OF LISTS +=item Access and Printing of a HASH OF LISTS =back -=item MORE ELABORATE RECORDS - +=item LISTS OF HASHES =over -=item Declaration of MORE ELABORATE RECORDS +=item Declaration of a LIST OF HASHES +=item Generation of a LIST OF HASHES -=item Declaration of a HASH OF COMPLEX RECORDS +=item Access and Printing of a LIST OF HASHES +=back -=item Generation of a HASH OF COMPLEX RECORDS +=item HASHES OF HASHES + +=over +=item Declaration of a HASH OF HASHES +=item Generation of a HASH OF HASHES +=item Access and Printing of a HASH OF HASHES =back -=item Database Ties +=item MORE ELABORATE RECORDS +=over -=item SEE ALSO +=item Declaration of MORE ELABORATE RECORDS +=item Declaration of a HASH OF COMPLEX RECORDS -=item AUTHOR +=item Generation of a HASH OF COMPLEX RECORDS +=back +=item Database Ties +=item SEE ALSO +=item AUTHOR =head2 perllol, perlLoL - Manipulating Lists of Lists in Perl =item DESCRIPTION - =item Declaration and Access of Lists of Lists - =item Growing Your Own - =item Access and Printing - =item Slices - =item SEE ALSO - =item AUTHOR +=head2 perltoot - Tom's object-oriented tutorial for perl +=item DESCRIPTION +=item Creating a Class +=over -=head2 perlobj - Perl objects +=item Object Representation -=item DESCRIPTION +=item Class Interface + +=item Constructors and Instance Methods + +=item Planning for the Future: Better Constructors + +=item Destructors +=item Other Object Methods + +=back + +=item Class Data =over -=item An Object is Simply a Reference +=item Accessing Class Data +=item Debugging Methods -=item A Class is Simply a Package +=item Class Destructors +=item Documenting the Interface -=item A Method is Simply a Subroutine +=back +=item Aggregation -=item Method Invocation +=item Inheritance +=over -=item Default UNIVERSAL methods +=item Overridden Methods -isa(CLASS), can(METHOD), VERSION([VERSION]), class(), is_instance() +=item Multiple Inheritance +=item UNIVERSAL: The Root of All Objects -=item Destructors +=back +=item Alternate Object Representations -=item WARNING +=over +=item Arrays as Objects -=item Summary +=item Closures as Objects + +=back +=item AUTOLOAD: Proxy Methods -=item Two-Phased Garbage Collection +=over + +=item Autoloaded Data Methods + +=item Inherited Autoloaded Data Methods + +=back + +=item Metaclassical Tools +=over + +=item Class::Template +=item Data Members as Variables + +=item NOTES +=item Object Terminology =back =item SEE ALSO +=item COPYRIGHT + +=over + +=item Acknowledgments + +=back + +=head2 perlobj - Perl objects + +=item DESCRIPTION + +=over + +=item An Object is Simply a Reference + +=item A Class is Simply a Package + +=item A Method is Simply a Subroutine + +=item Method Invocation + +=item Default UNIVERSAL methods + +isa(CLASS), can(METHOD), VERSION( [NEED] ), class(), is_instance() + +=item Destructors + +=item WARNING + +=item Summary +=item Two-Phased Garbage Collection +=back +=item SEE ALSO =head2 perltie - how to hide an object class in a simple variable =item SYNOPSIS - =item DESCRIPTION - =over =item Tying Scalars - TIESCALAR classname, LIST, FETCH this, STORE this, value, DESTROY this =item Tying Arrays - TIEARRAY classname, LIST, FETCH this, index, STORE this, index, value, DESTROY this =item Tying Hashes - -USER, HOME, CLOBBER, LIST, TIEHASH classname, LIST, FETCH this, key, -STORE this, key, value, DELETE this, key, CLEAR this, EXISTS this, key, -FIRSTKEY this, NEXTKEY this, lastkey, DESTROY this +USER, HOME, CLOBBER, LIST, TIEHASH classname, LIST, FETCH this, key, STORE +this, key, value, DELETE this, key, CLEAR this, EXISTS this, key, FIRSTKEY +this, NEXTKEY this, lastkey, DESTROY this =item Tying FileHandles - - +TIEHANDLE classname, LIST, PRINT this, LIST, READLINE this, DESTROY this =back =item SEE ALSO - =item BUGS - =item AUTHOR - - - - =head2 perlbot - Bag'o Object Tricks (the BOT) =item DESCRIPTION - =item OO SCALING TIPS - =item INSTANCE VARIABLES - =item SCALAR INSTANCE VARIABLES - =item INSTANCE VARIABLE INHERITANCE - =item OBJECT RELATIONSHIPS - =item OVERRIDING SUPERCLASS METHODS - =item USING RELATIONSHIP WITH SDBM - =item THINKING OF CODE REUSE - =item CLASS CONTEXT AND THE OBJECT - =item INHERITING A CONSTRUCTOR - =item DELEGATION +=head2 perlipc - Perl interprocess communication (signals, fifos, pipes, +safe subprocesses, sockets, and semaphores) +=item DESCRIPTION +=item Signals +=item Named Pipes -=head2 perldebug - Perl debugging +=item Using open() for IPC -=item DESCRIPTION +=over +=item Safe Pipe Opens -=item The Perl Debugger +=item Bidirectional Communication +=back + +=item Sockets: Client/Server Communication =over -=item Debugger Commands +=item Internet TCP Clients and Servers +=item Unix-Domain TCP Clients and Servers -h [command], p expr, x expr, V [pkg [vars]], X [vars], T, s [expr], n, -ECRE, c [line], l, l min+incr, l min-max, l line, l subname, --, w [line], f filename, /pattern/, ?pattern?, L, S [[!]pattern], t, t -expr, b [line] [condition], b subname [condition], d [line], D, a -[line] command, A, O [opt[=val]] [opt"val"] [opt?].., recallCommand, -ShellBang, pager, arrayDepth, hashDepth, compactDump, veryCompact, -globPrint, DumpDBFiles, DumpPackages, quote, HighBit, undefPrint, -tkRunning, signalLevel, warnLevel. dieLevel, E command, E -command, ! number, ! -number, ! pattern, !! cmd, H -number, q or ^D, -R, |dbcmd, ||dbcmd, = [alias value], command, p expr +=item UDP: Message Passing +=back -=item Debugger Customization +=item SysV IPC +=item WARNING -=item Readline Support +=item NOTES +=item BUGS -=item Editor Support for Debugging +=item AUTHOR +=item SEE ALSO -=item The Perl Profiler +=head2 perldebug - Perl debugging +=item DESCRIPTION -=item Debugger Internals +=item The Perl Debugger -TTY, noTTY, ReadLine, NonStop, LineInfo +=over +=item Debugger Commands -=item Other resources +h [command], p expr, x expr, V [pkg [vars]], X [vars], T, s [expr], n, +ECRE, c [line|sub], l, l min+incr, l min-max, l line, l subname, -, +w [line], f filename, /pattern/, ?pattern?, L, S [[!]pattern], t, t expr, b +[line] [condition], b subname [condition], b postpone subname [condition], +b load filename, d [line], D, a [line] command, A, O [opt[=val]] [opt"val"] +[opt?].., recallCommand, ShellBang, pager, tkRunning, signalLevel, +warnLevel, dieLevel, AutoTrace, LineInfo, C, C, +C, arrayDepth, hashDepth, compactDump, veryCompact, globPrint, +DumpDBFiles, DumpPackages, quote, HighBit, undefPrint, C, noTTY, +C, C, C, E [ command ], EE command, +E command, EE command, { [ command ], {{ command, ! number, ! +-number, ! pattern, !! cmd, H -number, q or ^D, R, |dbcmd, ||dbcmd, = +[alias value], command, p expr +=item Debugger Customization +=item Readline Support +=item Editor Support for Debugging -=back +=item The Perl Profiler -=item BUGS +=item Debugger support in perl +=item Debugger Internals +=item Other resources +=back +=item BUGS =head2 perldiag - various Perl diagnostics =item DESCRIPTION - - - - -=head2 perlform - Perl formats +=head2 perlsec - Perl security =item DESCRIPTION - =over =item Laundering and Detecting Tainted Data - =item Cleaning Up Your Path - =item Security Bugs - =back -=item NOTES +=head2 perltrap - Perl traps for the unwary +=item DESCRIPTION =over -=item Footers - +=item Awk Traps -=item Accessing Formatting Internals +=item C Traps +=item Sed Traps +=item Shell Traps +=item Perl Traps -=back +=item Perl4 to Perl5 Traps -=item WARNING +Discontinuance, Deprecation, and BugFix traps, Parsing Traps, Numerical +Traps, General data type traps, Context Traps - scalar, list contexts, +Precedence Traps, General Regular Expression Traps using s///, etc, +Subroutine, Signal, Sorting Traps, OS Traps, DBM Traps, Unclassified Traps +=item Discontinuance, Deprecation, and BugFix traps +Discontinuance, Deprecation, BugFix, Discontinuance, Discontinuance, +Discontinuance, BugFix, Discontinuance, Discontinuance, BugFix, +Discontinuance, Deprecation, Discontinuance +=item Parsing Traps +Parsing, Parsing, Parsing -=head2 perlipc - Perl interprocess communication (signals, fifos, -pipes, safe subprocesses, sockets, and semaphores) +=item Numerical Traps -=item DESCRIPTION +Numerical, Numerical, Numerical +=item General data type traps -=item Signals +(Arrays), (Arrays), (Hashes), (Globs), (Scalar String), (Constants), +(Scalars), (Variable Suicide) +=item Context Traps - scalar, list contexts -=item Named Pipes +(list context), (scalar context), (scalar context), (list, builtin) +=item Precedence Traps -=item Using open() for IPC +Precedence, Precedence, Precedence, Precedence, Precedence, Precedence, +Precedence +=item General Regular Expression Traps using s///, etc. -=over +Regular Expression, Regular Expression, Regular Expression, Regular +Expression, Regular Expression, Regular Expression, Regular Expression -=item Safe Pipe Opens +=item Subroutine, Signal, Sorting Traps +(Signals), (Sort Subroutine), warn() won't let you specify a filehandle -=item Bidirectional Communication +=item OS Traps +(SysV), (SysV) +=item Interpolation Traps +Interpolation, Interpolation, Interpolation, Interpolation, Interpolation, +Interpolation, Interpolation, Interpolation, Interpolation -=back +=item DBM Traps -=item Sockets: Client/Server Communication +DBM, DBM +=item Unclassified Traps -=over +Unclassified -=item Internet TCP Clients and Servers +=back +=head2 perlstyle - Perl style guide -=item Unix-Domain TCP Clients and Servers +=item DESCRIPTION +=head2 perlpod - plain old documentation -=item UDP: Message Passing +=item DESCRIPTION +=item Embedding Pods in Perl Modules +=item Common Pod Pitfalls +=item SEE ALSO -=back +=item AUTHOR -=item SysV IPC +=head2 perlbook - Perl book information +=item DESCRIPTION -=item WARNING +=head2 perlembed - how to embed perl in your C program +=item DESCRIPTION -=item NOTES +=over +=item PREAMBLE -=item BUGS +B, B, B, B, B +=item ROADMAP -=item AUTHOR +=item Compiling your C program +=item Adding a Perl interpreter to your C program -=item SEE ALSO +=item Calling a Perl subroutine from your C program +=item Evaluating a Perl statement from your C program +=item Performing Perl pattern matches and substitutions from your C program +=item Fiddling with the Perl stack from your C program +=item Maintaining a persistent interpreter -=head2 perlsec - Perl security +=item Maintaining multiple interpreter instances -=item DESCRIPTION +=item Using Perl modules, which themselves use C libraries, from your C +program +=back +=item MORAL +=item AUTHOR +=head2 perlapio, perlio - perl's IO abstraction interface. -=head2 perltrap - Perl traps for the unwary +=item SYNOPSIS =item DESCRIPTION +B, B, B, B, +B, B, +B, B, +B, B, +B, B, B, +B, B, B, +B, B, B, +B, B, B, +B, B, B, +B, B =over -=item Awk Traps +=item Co-existence with stdio +B, B, +B, B, B, +B, B, B, +B, B, +B, B, B, +B, B -=item C Traps +=back +=head2 perlxs - XS language reference manual -=item Sed Traps +=item DESCRIPTION - -=item Shell Traps - - -=item Perl Traps - - -=item Perl4 Traps - - - - -=back - - - - -=head2 perlstyle - Perl style guide - -=item DESCRIPTION - - - - - -=head2 perlxs - XS language reference manual - -=item DESCRIPTION - - -=over +=over =item Introduction - =item On The Road - =item The Anatomy of an XSUB - =item The Argument Stack - =item The RETVAL Variable - =item The MODULE Keyword - =item The PACKAGE Keyword - =item The PREFIX Keyword - =item The OUTPUT: Keyword - =item The CODE: Keyword - =item The INIT: Keyword - =item The NO_INIT Keyword - =item Initializing Function Parameters - =item Default Parameter Values - =item The PREINIT: Keyword +=item The SCOPE: Keyword =item The INPUT: Keyword - =item Variable-length Parameter Lists - =item The PPCODE: Keyword - =item Returning Undef And Empty Lists - =item The REQUIRE: Keyword - =item The CLEANUP: Keyword - =item The BOOT: Keyword - =item The VERSIONCHECK: Keyword - =item The PROTOTYPES: Keyword - =item The PROTOTYPE: Keyword - =item The ALIAS: Keyword - =item The INCLUDE: Keyword - =item The CASE: Keyword - =item The & Unary Operator - =item Inserting Comments and C Preprocessor Directives - =item Using XS With C++ - =item Interface Strategy - =item Perl Objects And C Structures - =item The Typemap - - - =back =item EXAMPLES - =item XS VERSION - =item AUTHOR - - - - -=head2 perlxstut, perlXStut - Tutorial for XSUB's +=head2 perlxstut, perlXStut - Tutorial for XSUBs =item DESCRIPTION - =over =item VERSION CAVEAT - =item DYNAMIC VERSUS STATIC - =item EXAMPLE 1 - =item EXAMPLE 2 - =item WHAT HAS GONE ON? +=item WRITING GOOD TEST SCRIPTS =item EXAMPLE 3 - =item WHAT'S NEW HERE? - =item INPUT AND OUTPUT PARAMETERS - =item THE XSUBPP COMPILER - =item THE TYPEMAP FILE - =item WARNING +=item EXAMPLE 4 -=item SPECIFYING ARGUMENTS TO XSUBPP +=item WHAT HAS HAPPENED HERE? +=item SPECIFYING ARGUMENTS TO XSUBPP =item THE ARGUMENT STACK - =item EXTENDING YOUR EXTENSION - =item DOCUMENTING YOUR EXTENSION - =item INSTALLING YOUR EXTENSION - =item SEE ALSO - =item Author - =item Last Changed - - - =back - - - =head2 perlguts - Perl's Internal Functions =item DESCRIPTION +=over =item Datatypes - -=over - =item What is an "IV"? - =item Working with SV's - =item What's Really Stored in an SV? - =item Working with AV's - =item Working with HV's - =item References - =item Blessed References and Class Objects - - - -=back - =item Creating New Variables +=item Reference Counts and Mortality -=item XSUB's and the Argument Stack - - -=item Mortality - - -=item Stashes - +=item Stashes and Globs =item Magic - -=over - =item Assigning Magic - =item Magic Virtual Tables - =item Finding Magic - - - -=back - =item Double-Typed SV's +=item XSUB's and the Argument Stack =item Calling Perl Routines from within C Programs - =item Memory Allocation +=item PerlIO -=item API LISTING - +=item Scratchpads -AvFILL, av_clear, av_extend, av_fetch, av_len, av_make, av_pop, -av_push, av_shift, av_store, av_undef, av_unshift, CLASS, Copy, croak, -CvSTASH, DBsingle, DBsub, dMARK, dORIGMARK, dSP, dXSARGS, ENTER, -EXTEND, FREETMPS, G_ARRAY, G_DISCARD, G_EVAL, GIMME, G_NOARGS, -G_SCALAR, gv_stashpv, gv_stashsv, GvSV, he_free, hv_clear, hv_delete, -hv_exists, hv_fetch, hv_iterinit, hv_iterkey, hv_iternext, -hv_iternextsv, hv_iterval, hv_magic, HvNAME, hv_store, hv_undef, -isALNUM, isALPHA, isDIGIT, isLOWER, isSPACE, isUPPER, items, LEAVE, -MARK, mg_clear, mg_copy, mg_find, mg_free, mg_get, mg_len, mg_magical, -mg_set, Move, na, New, Newc, Newz, newAV, newHV, newRV, newSV, newSViv, -newSVnv, newSVpv, newSVrv, newSVsv, newXS, newXSproto, Nullav, Nullch, -Nullcv, Nullhv, Nullsv, ORIGMARK, perl_alloc, perl_call_argv, -perl_call_method, perl_call_pv, perl_call_sv, perl_construct, -perl_destruct, perl_eval_sv, perl_free, perl_get_av, perl_get_cv, -perl_get_hv, perl_get_sv, perl_parse, perl_require_pv, perl_run, POPi, -POPl, POPp, POPn, POPs, +=item Putting a C value on Perl stack -=item AUTHOR +=item Scratchpads +=item Scratchpads and recursions -=item DATE +=item API LISTING +AvFILL, av_clear, av_extend, av_fetch, av_len, av_make, av_pop, av_push, +av_shift, av_store, av_undef, av_unshift, CLASS, Copy, croak, CvSTASH, +DBsingle, DBsub, DBtrace, dMARK, dORIGMARK, dowarn, dSP, dXSARGS, dXSI32, +dXSI32, ENTER, EXTEND, FREETMPS, G_ARRAY, G_DISCARD, G_EVAL, GIMME, +G_NOARGS, G_SCALAR, gv_fetchmeth, gv_fetchmethod, gv_stashpv, gv_stashsv, +GvSV, he_free, hv_clear, hv_delete, hv_exists, hv_fetch, hv_iterinit, +hv_iterkey, hv_iternext, hv_iternextsv, hv_iterval, hv_magic, HvNAME, +hv_store, hv_undef, isALNUM, isALPHA, isDIGIT, isLOWER, isSPACE, isUPPER, +items, ix, LEAVE, MARK, mg_clear, mg_copy, mg_find, mg_free, mg_get, +mg_len, mg_magical, mg_set, Move, na, New, Newc, Newz, newAV, newHV, +newRV_inc, newRV_noinc, newSV, newSViv, newSVnv, newSVpv, newSVrv, newSVsv, +newXS, newXSproto, Nullav, Nullch, Nullcv, Nullhv, Nullsv, ORIGMARK, +perl_alloc, perl_call_argv, perl_call_method, perl_call_pv, perl_call_sv, +perl_construct, perl_destruct, perl_eval_sv, perl_free, perl_get_av, +perl_get_cv, perl_get_hv, perl_get_sv, perl_parse, perl_require_pv, +perl_run, POPi, POPl, POPp, POPn, POPs, PUSHMARK, PUSHi, PUSHn, PUSHp, +PUSHs, PUTBACK, Renew, Renewc, RETVAL, safefree, safemalloc, saferealloc, +savepv, savepvn, SAVETMPS, SP, SPAGAIN, ST, strEQ, strGE, strGT, strLE, +strLT, strNE, strnEQ, strnNE, sv_2mortal, sv_bless, sv_catpv, sv_catpvn, +sv_catsv, sv_cmp, sv_cmp, SvCUR, SvCUR_set, sv_dec, sv_dec, SvEND, sv_eq, +SvGROW, sv_grow, sv_inc, SvIOK, SvIOK_off, SvIOK_on, SvIOK_only, +SvIOK_only, SvIOKp, sv_isa, SvIV, sv_isobject, SvIVX, SvLEN, sv_len, +sv_len, sv_magic, sv_mortalcopy, SvOK, sv_newmortal, sv_no, SvNIOK, +SvNIOK_off, SvNIOKp, SvNOK, SvNOK_off, SvNOK_on, SvNOK_only, SvNOK_only, +SvNOKp, SvNV, SvNVX, SvPOK, SvPOK_off, SvPOK_on, SvPOK_only, SvPOK_only, +SvPOKp, SvPV, SvPVX, SvREFCNT, SvREFCNT_dec, SvREFCNT_inc, SvROK, +SvROK_off, SvROK_on, SvRV, sv_setiv, sv_setnv, sv_setpv, sv_setpvn, +sv_setref_iv, sv_setref_nv, sv_setref_pv, sv_setref_pvn, sv_setsv, SvSTASH, +SVt_IV, SVt_PV, SVt_PVAV, SVt_PVCV, SVt_PVHV, SVt_PVMG, SVt_NV, SvTRUE, +SvTYPE, svtype, SvUPGRADE, sv_upgrade, sv_undef, sv_unref, sv_usepvn, +sv_yes, THIS, toLOWER, toUPPER, warn, XPUSHi, XPUSHn, XPUSHp, XPUSHs, XS, +XSRETURN, XSRETURN_EMPTY, XSRETURN_IV, XSRETURN_NO, XSRETURN_NV, +XSRETURN_PV, XSRETURN_UNDEF, XSRETURN_YES, XST_mIV, XST_mNV, XST_mNO, +XST_mPV, XST_mUNDEF, XST_mYES, XS_VERSION, XS_VERSION_BOOTCHECK, Zero +=back +=item EDITOR +=item DATE =head2 perlcall - Perl calling conventions from C =item DESCRIPTION - An Error Handler, An Event Driven Program =item THE PERL_CALL FUNCTIONS - -B, B, B, -B +B, B, B, B =item FLAG VALUES - =over =item G_SCALAR - =item G_ARRAY - =item G_DISCARD - =item G_NOARGS - -=item G_EVAL - +=item G_EVAL =item G_KEEPERR - -=item Determining the Context - - - +=item Determining the Context =back =item KNOWN PROBLEMS - =item EXAMPLES - =over =item No Parameters, Nothing returned - =item Passing Parameters - =item Returning a Scalar - =item Returning a list of values - =item Returning a list in a scalar context - =item Returning Data from Perl via the parameter list - =item Using G_EVAL - =item Using G_KEEPERR - =item Using perl_call_sv - =item Using perl_call_argv - =item Using perl_call_method - =item Using GIMME - =item Using Perl to dispose of temporaries - =item Strategies for storing Callback Context Information - 1. Ignore the problem - Allow only 1 callback, 2. Create a sequence of callbacks - hard wired limit, 3. Use a parameter to map to the Perl callback =item Alternate Stack Manipulation - - - =back =item SEE ALSO - =item AUTHOR - =item DATE +=head1 PRAGMA DOCUMENTATION +=head2 blib - Use MakeMaker's uninstalled version of a package +=item SYNOPSIS +=item DESCRIPTION -=head2 perlembed - how to embed perl in your C program +=item BUGS -=item DESCRIPTION +=item AUTHOR +=head2 diagnostics - Perl compiler pragma to force verbose warning +diagnostics -=over +=item SYNOPSIS -=item PREAMBLE +=item DESCRIPTION +=over -B, B, B, B, B +=item The C Pragma -=item ROADMAP +=item The I Program +=back -=item Compiling your C program +=item EXAMPLES +=item INTERNALS -=item Adding a Perl interpreter to your C program +=item BUGS +=item AUTHOR -=item Calling a Perl subroutine from your C program +=head2 integer - Perl pragma to compute arithmetic in integer instead of +double +=item SYNOPSIS -=item Evaluating a Perl statement from your C program +=item DESCRIPTION +=head2 less - perl pragma to request less of something from the compiler -=item Performing Perl pattern matches and substitutions from your C -program +=item SYNOPSIS +=item DESCRIPTION +=head2 lib - manipulate @INC at compile time +=item SYNOPSIS -=back +=item DESCRIPTION -=item MORAL +=over + +=item ADDING DIRECTORIES TO @INC +=item DELETING DIRECTORIES FROM @INC -=item AUTHOR +=item RESTORING ORIGINAL @INC +=back +=item SEE ALSO +=item AUTHOR +=head2 locale - Perl pragma to use and avoid POSIX locales for built-in +operations -=head2 perlpod - plain old documentation +=item SYNOPSIS =item DESCRIPTION +=head2 ops - Perl pragma to restrict unsafe operations when compiling -=item Embedding Pods in Perl Modules +=item SYNOPSIS +=item DESCRIPTION =item SEE ALSO +=head2 overload - Package for overloading perl operations -=item AUTHOR +=item SYNOPSIS +=item CAVEAT SCRIPTOR +=item DESCRIPTION +=over +=item Declaration of overloaded functions -=head2 perlbook - Perl book information +=item Calling Conventions for Binary Operations -=item DESCRIPTION +FALSE, TRUE, C +=item Calling Conventions for Unary Operations +=item Overloadable Operations +I, I, I, +I, I, I, I +=back -=head1 PRAGMA DOCUMENTATION +=item SPECIAL SYMBOLS FOR C +=over +=item Last Resort +=item Fallback -=head2 diagnostics - Perl compiler pragma to force verbose warning -diagnostics +C, TRUE, defined, but FALSE -=item SYNOPSIS +=item Copy Constructor +B -=item DESCRIPTION +=back +=item MAGIC AUTOGENERATION -=over +I, I, +I, C, I, I, +I, I, I -=item The C Pragma +=item WARNING +=item Run-time Overloading -=item The I Program +=item Public functions +overload::StrVal(arg), overload::Overloaded(arg), overload::Method(obj,op) +=item IMPLEMENTATION +=item AUTHOR -=back +=item DIAGNOSTICS -=item EXAMPLES +=item BUGS +=head2 sigtrap - Perl pragma to enable simple signal handling -=item INTERNALS - +=item SYNOPSIS -=item BUGS +=item DESCRIPTION +=item OPTIONS -=item AUTHOR +=over +=item SIGNAL HANDLERS +B, B, B I +=item SIGNAL LISTS +B, B, B -=head2 integer - Perl pragma to compute arithmetic in integer instead -of double +=item OTHER -=item SYNOPSIS +B, B, I, I +=back -=item DESCRIPTION +=item EXAMPLES +=head2 strict - Perl pragma to restrict unsafe constructs +=item SYNOPSIS +=item DESCRIPTION +C, C, C -=head2 less - perl pragma to request less of something from the -compiler +=head2 subs - Perl pragma to predeclare sub names =item SYNOPSIS - =item DESCRIPTION +=head2 vars - Perl pragma to predeclare global variable names +=item SYNOPSIS +=item DESCRIPTION +=head1 MODULE DOCUMENTATION -=head2 lib - manipulate @INC at compile time +=head2 AnyDBM_File - provide framework for multiple DBMs =item SYNOPSIS - =item DESCRIPTION - =over -=item ADDING DIRECTORIES TO @INC +=item DBM Comparisons +[0], [1], [2], [3] -=item DELETING DIRECTORIES FROM @INC +=back +=item SEE ALSO -=item RESTORING ORIGINAL @INC +=head2 AutoLoader - load functions only on demand +=item SYNOPSIS +=item DESCRIPTION +=over -=back +=item __END__ -=item SEE ALSO +=item Loading Stubs +=item Package Lexicals -=item AUTHOR +=item AutoLoader vs. SelfLoader +=back +=item CAVEAT +=head2 AutoSplit - split a package for autoloading +=item SYNOPSIS -=head2 overload - Package for overloading perl operations +=item DESCRIPTION -=item SYNOPSIS +=item CAVEATS +=item DIAGNOSTICS -=item CAVEAT SCRIPTOR +=head2 Benchmark - benchmark running times of code +=item SYNOPSIS =item DESCRIPTION - =over -=item Declaration of overloaded functions - +=item Methods -=item Calling Conventions for Binary Operations +new, debug +=item Standard Exports -FALSE, TRUE, C +timeit(COUNT, CODE), timethis, timethese, timediff, timestr -=item Calling Conventions for Unary Operations +=item Optional Exports +=back -=item Overloadable Operations +=item NOTES +=item INHERITANCE -I, I, I, -I, I, I, I +=item CAVEATS +=item AUTHORS +=item MODIFICATION HISTORY -=back +=head2 CPAN - query, download and build perl modules from CPAN sites -=item SPECIAL SYMBOLS FOR C +=item SYNOPSIS +=item DESCRIPTION =over -=item Last Resort - - -=item Fallback +=item Interactive Mode +Searching for authors, bundles, distribution files and modules, make, test, +install, clean modules or distributions -C, TRUE, defined, but FALSE +=item CPAN::Shell -=item Copy Constructor +=item ProgrammerE<39>s interface +=item Cache Manager -B +=item Bundles +=item autobundle +=item recompile =back -=item MAGIC AUTOGENERATION +=item CONFIGURATION +o conf Escalar optionE, o conf Escalar optionE +EvalueE, o conf Elist optionE, o conf Elist optionE +[shift|pop], o conf Elist optionE [unshift|push|splice] +ElistE -I, I, -I, C, I, -I, I, I - -=item WARNING - - -=item Run-time Overloading +=item SECURITY +=item EXPORT -=item Public functions - +=item Debugging -overload::StrVal(arg), overload::Overloaded(arg), -C +=over -=item IMPLEMENTATION +=item Prerequisites +=back =item AUTHOR +=item SEE ALSO -=item DIAGNOSTICS - - -=item BUGS - - - - - -=head2 sigtrap - Perl pragma to enable stack back-trace on unexpected -signals +=head2 CPAN::FirstTime - Utility for CPAN::Config file Initialization =item SYNOPSIS - =item DESCRIPTION - - - - -=head2 strict - Perl pragma to restrict unsafe constructs +=head2 CPANox, CPAN::Nox - Wrapper around CPAN.pm without using any XS +module =item SYNOPSIS - =item DESCRIPTION +=item SEE ALSO -C, C, C - +=head2 Carp, carp - warn of errors (from perspective of caller) +=item SYNOPSIS +=item DESCRIPTION -=head2 subs - Perl pragma to pre-declare sub names +=head2 Class::Template - struct/member template builder =item SYNOPSIS - =item DESCRIPTION +=item EXAMPLES +Example 1, Example 2 +=item NOTES - -=head2 vars - Perl pragma to pre-declare global variable names +=head2 Config - access Perl configuration information =item SYNOPSIS - =item DESCRIPTION +myconfig(), config_sh(), config_vars(@names) +=item EXAMPLE +=item WARNING +=item NOTE -=head1 MODULE DOCUMENTATION - +=head2 Cwd, getcwd - get pathname of current working directory +=item SYNOPSIS +=item DESCRIPTION -=head2 AnyDBM_File - provide framework for multiple DBMs +=head2 DB_File - Perl5 access to Berkeley DB =item SYNOPSIS - =item DESCRIPTION +B, B, B =over -=item DBM Comparisons - +=item How does DB_File interface to Berkeley DB? -[0], [1], [2], [3] +=item Opening a Berkeley DB Database File +=item Default Parameters +=item In Memory Databases =back -=item SEE ALSO +=item DB_HASH +=over +=item A Simple Example. +=back +=item DB_BTREE -=head2 AutoLoader - load functions only on demand +=over -=item SYNOPSIS +=item Changing the BTREE sort order +=item Handling duplicate keys -=item DESCRIPTION +=item The get_dup method. +=item Matching Partial Keys +=back +=item DB_RECNO +=over -=head2 AutoSplit - split a package for autoloading +=item The bval option -=item SYNOPSIS +=item A Simple Example +=item Extra Methods -=item DESCRIPTION +B<$X-Epush(list) ;>, B<$value = $X-Epop ;>, B<$X-Eshift>, +B<$X-Eunshift(list) ;>, B<$X-Elength> +=item Another Example +=back +=item THE API INTERFACE +B<$status = $X-Eget($key, $value [, $flags]) ;>, B<$status = +$X-Eput($key, $value [, $flags]) ;>, B<$status = $X-Edel($key [, +$flags]) ;>, B<$status = $X-Efd ;>, B<$status = $X-Eseq($key, +$value, $flags) ;>, B<$status = $X-Esync([$flags]) ;> -=head2 Benchmark - benchmark running times of code +=item HINTS AND TIPS -=item SYNOPSIS +=over + +=item Locking Databases +=item Sharing databases with C applications -=item DESCRIPTION +=back +=item COMMON QUESTIONS =over -=item Methods +=item Why is there Perl source in my database? +=item How do I store complex data structures with DB_File? -new, debug +=item What does "Invalid Argument" mean? -=item Standard Exports +=item What does "Bareword 'DB_File' not allowed" mean? +=back -C, timethis, timethese, timediff, timestr +=item HISTORY -=item Optional Exports +=item BUGS +=item AVAILABILITY +=item SEE ALSO +=item AUTHOR -=back +=head2 Devel::SelfStubber - generate stubs for a SelfLoading module -=item NOTES +=item SYNOPSIS +=item DESCRIPTION -=item INHERITANCE +=head2 DirHandle - supply object methods for directory handles +=item SYNOPSIS -=item CAVEATS +=item DESCRIPTION +=head2 DynaLoader - Dynamically load C libraries into Perl code -=item AUTHORS +=item SYNOPSIS +=item DESCRIPTION -=item MODIFICATION HISTORY +@dl_library_path, @dl_resolve_using, @dl_require_symbols, dl_error(), +$dl_debug, dl_findfile(), dl_expandspec(), dl_load_file(), +dl_find_symbol(), dl_undef_symbols(), dl_install_xsub(), bootstrap() +=item AUTHOR +=head2 English - use nice English (or awk) names for ugly punctuation +variables +=item SYNOPSIS +=item DESCRIPTION -=head2 Carp, carp - warn of errors (from perspective of caller) +=head2 Env - perl module that imports environment variables =item SYNOPSIS - =item DESCRIPTION +=item AUTHOR +=head2 Exporter - Implements default import method for modules +=item SYNOPSIS +=item DESCRIPTION -=head2 Cwd, getcwd - get pathname of current working directory - -=item SYNOPSIS +=over +=item Selecting What To Export -=item DESCRIPTION +=item Specialised Import Lists +=item Module Version Checking +=item Managing Unknown Symbols +=item Tag Handling Utility Functions +=back -=head2 DB_File - Perl5 access to Berkeley DB +=head2 ExtUtils::Embed - Utilities for embedding Perl in C/C++ applications =item SYNOPSIS - =item DESCRIPTION +=item @EXPORT -DB_HASH, DB_BTREE, DB_RECNO +=item FUNCTIONS -=over +xsinit(), Examples, ldopts(), Examples, perl_inc(), ccflags(), ccdlflags(), +ccopts(), xsi_header(), xsi_protos(@modules), xsi_body(@modules) -=item How does DB_File interface to Berkeley DB? +=item EXAMPLES +=item SEE ALSO -=item Differences with Berkeley DB +=item AUTHOR +=head2 ExtUtils::Install - install files from here to there -=item RECNO +=item SYNOPSIS +=item DESCRIPTION -=item In Memory Databases +=head2 ExtUtils::Liblist - determine libraries to use and how to use them +=item SYNOPSIS -=item Using the Berkeley DB Interface Directly +=item DESCRIPTION +For static extensions, For dynamic extensions, For dynamic extensions -get, put, del, fd, seq, sync +=over +=item EXTRALIBS +=item LDLOADLIBS and LD_RUN_PATH -=back +=item BSLOADLIBS -=item EXAMPLES +=back +=item PORTABILITY =over -=item Using HASH +=item VMS implementation +=back -=item Using BTREE +=item SEE ALSO +=head2 ExtUtils::MM_OS2 - methods to override UN*X behaviour in +ExtUtils::MakeMaker -=item Using RECNO +=item SYNOPSIS +=item DESCRIPTION -=item Locking Databases +=head2 ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker +=item SYNOPSIS +=item DESCRIPTION +=item METHODS -=back +=over -=item HISTORY +=item Preloaded methods +canonpath, catdir, catfile, curdir, rootdir, updir -=item WARNINGS +=item SelfLoaded methods +c_o (o), cflags (o), clean (o), const_cccmd (o), const_config (o), +const_loadlibs (o), constants (o), depend (o), dir_target (o), dist (o), +dist_basics (o), dist_ci (o), dist_core (o), dist_dir (o), dist_test (o), +dlsyms (o), dynamic (o), dynamic_bs (o), dynamic_lib (o), exescan, +extliblist, file_name_is_absolute, find_perl + +=item Methods to actually produce chunks of text for the Makefile + +force (o), guess_name, has_link_code, init_dirscan, init_main, init_others, +install (o), installbin (o), libscan (o), linkext (o), lsdir, macro (o), +makeaperl (o), makefile (o), manifypods (o), maybe_command, +maybe_command_in_dirs, needs_linking (o), nicetext, parse_version, pasthru +(o), path, perl_script, perldepend (o), pm_to_blib, post_constants (o), +post_initialize (o), postamble (o), prefixify, processPL (o), realclean +(o), replace_manpage_separator, static (o), static_lib (o), staticmake (o), +subdir_x (o), subdirs (o), test (o), test_via_harness (o), test_via_script +(o), tool_autosplit (o), tools_other (o), tool_xsubpp (o), top_targets (o), +writedoc, xs_c (o), xs_o (o) -=item BUGS +=back +=item SEE ALSO -=item AVAILABILITY +=head2 ExtUtils::MM_VMS - methods to override UN*X behaviour in +ExtUtils::MakeMaker +=item SYNOPSIS -=item SEE ALSO +=item DESCRIPTION +=over -=item AUTHOR +=item Methods always loaded +eliminate_macros, fixpath, catdir, catfile, wraplist, curdir (override), +rootdir (override), updir (override) +=item SelfLoaded methods +guess_name (override), find_perl (override), path (override), maybe_command +(override), maybe_command_in_dirs (override), perl_script (override), +file_name_is_absolute (override), replace_manpage_separator, init_others +(override), constants (override), cflags (override), const_cccmd +(override), pm_to_blib (override), tool_autosplit (override), tool_sxubpp +(override), xsubpp_version (override), tools_other (override), dist +(override), c_o (override), xs_c (override), xs_o (override), top_targets +(override), dlsyms (override), dynamic_lib (override), dynamic_bs +(override), static_lib (override), manifypods (override), processPL +(override), installbin (override), subdir_x (override), clean (override), +realclean (override), dist_basics (override), dist_core (override), +dist_dir (override), dist_test (override), install (override), perldepend +(override), makefile (override), test (override), test_via_harness +(override), test_via_script (override), makeaperl (override), nicetext +(override) +=back -=head2 Devel::SelfStubber - generate stubs for a SelfLoading module +=head2 ExtUtils::MakeMaker - create an extension Makefile =item SYNOPSIS - =item DESCRIPTION +=over +=item How To Write A Makefile.PL +=item Default Makefile Behaviour +=item make test -=head2 DirHandle - supply object methods for directory handles - -=item SYNOPSIS +=item make testdb +=item make install -=item DESCRIPTION +=item PREFIX and LIB attribute +=item AFS users +=item Static Linking of a new Perl Binary +=item Determination of Perl Library and Installation Locations +=item Which architecture dependent directory? -=head2 DynaLoader - Dynamically load C libraries into Perl code +=item Using Attributes and Parameters -=item SYNOPSIS +C, CONFIG, CONFIGURE, DEFINE, DIR, DISTNAME, DL_FUNCS, DL_VARS, +EXCLUDE_EXT, EXE_FILES, NO_VC, FIRST_MAKEFILE, FULLPERL, H, INC, +INCLUDE_EXT, INSTALLARCHLIB, INSTALLBIN, INSTALLDIRS, INSTALLMAN1DIR, +INSTALLMAN3DIR, INSTALLPRIVLIB, INSTALLSCRIPT, INSTALLSITELIB, +INSTALLSITEARCH, INST_ARCHLIB, INST_BIN, INST_EXE, INST_LIB, INST_MAN1DIR, +INST_MAN3DIR, INST_SCRIPT, LDFROM, LIBPERL_A, LIB, LIBS, LINKTYPE, +MAKEAPERL, MAKEFILE, MAN1PODS, MAN3PODS, MAP_TARGET, MYEXTLIB, NAME, +NEEDS_LINKING, NOECHO, NORECURS, OBJECT, OPTIMIZE, PERL, PERLMAINCC, +PERL_ARCHLIB, PERL_LIB, PERL_SRC, PL_FILES, PM, PMLIBDIRS, PREFIX, +PREREQ_PM, SKIP, TYPEMAPS, VERSION, VERSION_FROM, XS, XSOPT, XSPROTOARG, +XS_VERSION +=item Additional lowercase attributes -=item DESCRIPTION +clean, depend, dist, dynamic_lib, installpm, linkext, macro, realclean, +tool_autosplit +=item Overriding MakeMaker Methods -@dl_library_path, @dl_resolve_using, @dl_require_symbols, dl_error(), -$dl_debug, dl_findfile(), dl_expandspec(), dl_load_file(), -dl_find_symbol(), dl_undef_symbols(), dl_install_xsub(), bootstrap() +=item Hintsfile support -=item AUTHOR +=item Distribution Support + make distcheck, make skipcheck, make distclean, make manifest, + make distdir, make tardist, make dist, make uutardist, make +shdist, make zipdist, make ci +=back +=item SEE ALSO +=item AUTHORS -=head2 English - use nice English (or awk) names for ugly punctuation -variables +=head2 ExtUtils::Manifest - utilities to write and check a MANIFEST file =item SYNOPSIS - =item DESCRIPTION +=item MANIFEST.SKIP +=item EXPORT_OK +=item GLOBAL VARIABLES +=item DIAGNOSTICS -=head2 Env - perl module that imports environment variables - -=item SYNOPSIS - - -=item DESCRIPTION +C I, C I, C I<$!>, +C I +=item SEE ALSO =item AUTHOR +=head2 ExtUtils::Miniperl, writemain - write the C code for perlmain.c +=item SYNOPSIS +=item DESCRIPTION +=item SEE ALSO -=head2 Exporter - Implements default import method for modules +=head2 ExtUtils::Mkbootstrap - make a bootstrap file for use by DynaLoader =item SYNOPSIS - =item DESCRIPTION +=head2 ExtUtils::Mksymlists - write linker options files for dynamic +extension -=over +=item SYNOPSIS -=item Selecting What To Export +=item DESCRIPTION +NAME, DL_FUNCS, DL_VARS, FILE, FUNCLIST, DLBASE -=item Specialised Import Lists +=item AUTHOR +=item REVISION -=item Module Version Checking +=head2 ExtUtils::testlib - add blib/* directories to @INC +=item SYNOPSIS -=item Managing Unknown Symbols +=item DESCRIPTION +=head2 Fatal - replace functions with equivalents which succeed or die -=item Tag Handling Utility Functions +=item SYNOPSIS +=item DESCRIPTION +=item AUTHOR +=head2 Fcntl - load the C Fcntl.h defines -=back +=item SYNOPSIS +=item DESCRIPTION +=item NOTE +=item EXPORTED SYMBOLS -=head2 ExtUtils::Install - install files from here to there +=head2 File::Basename, fileparse - split a pathname into pieces =item SYNOPSIS - =item DESCRIPTION +fileparse_set_fstype, fileparse +=item EXAMPLES +C, C - -=head2 ExtUtils::Liblist - determine libraries to use and how to use -them +=head2 File::CheckTree, validate - run many filetest checks on a tree =item SYNOPSIS - =item DESCRIPTION +=head2 File::Compare - Compare files or filehandles -For static extensions, For dynamic extensions, For dynamic extensions +=item SYNOPSIS -=over +=item DESCRIPTION -=item EXTRALIBS +=item RETURN +=item AUTHOR -=item LDLOADLIBS and LD_RUN_PATH +=head2 File::Copy - Copy files or filehandles +=item SYNOPSIS -=item BSLOADLIBS +=item DESCRIPTION +=over +=item Special behavior if C is defined (VMS and OS/2) +rmscopy($from,$to[,$date_flag]) =back -=item PORTABILITY - +=item RETURN -=item SEE ALSO +=item AUTHOR +=head2 File::Find, find - traverse a file tree +=item SYNOPSIS +=item DESCRIPTION +=head2 File::Path - create or remove a series of directories -=head2 ExtUtils::MM_OS2 - methods to override UN*X behaviour in -ExtUtils::MakeMaker +=item SYNOPSIS =item DESCRIPTION +=item AUTHORS +=item REVISION - - -=head2 ExtUtils::MM_Unix - methods used by ExtUtils::MakeMaker +=head2 File::stat - by-name interface to Perl's built-in stat() functions =item SYNOPSIS - =item DESCRIPTION +=item NOTE -=item METHODS - +=item AUTHOR -=over +=head2 FileCache - keep more files open than the system permits -=item Preloaded methods +=item SYNOPSIS +=item DESCRIPTION -catdir, catfile, nicetext, libscan, exescan, lsdir, path, -replace_manpage_separator, file_name_is_absolute, prefixify, -maybe_command_in_dirs, maybe_command, perl_script +=item BUGS -=item SelfLoaded methods +=head2 FileHandle - supply object methods for filehandles +=item SYNOPSIS -guess_name, init_main, init_dirscan, init_others, find_perl +=item DESCRIPTION -=item Methods to produce chunks of text for the Makefile +$fh->print, $fh->printf, $fh->getline, $fh->getlines +=item SEE ALSO -post_initialize, const_config, constants, const_loadlibs, const_cccmd, -tool_autosplit, tool_xsubpp, tools_other, dist, macro, depend, -post_constants, pasthru, c_o, xs_c, xs_o, top_targets, linkext, dlsyms, -dynamic, dynamic_bs, dynamic_lib, static, static_lib, installpm, -installpm_x, manifypods, processPL, installbin, subdirs, subdir_x, -clean, realclean, dist_basics, dist_core, dist_dir, dist_test, dist_ci, -install, force, perldepend, makefile, staticmake, test, -test_via_harness, test_via_script, postamble, makeaperl, extliblist, -dir_target, needs_linking, has_link_code, writedoc +=head2 FindBin - Locate directory of original perl script +=item SYNOPSIS +=item DESCRIPTION -=back +=item EXPORTABLE VARIABLES -=item SEE ALSO +=item KNOWN BUGS +=item AUTHORS +=item COPYRIGHT +=item REVISION +=head2 GDBM_File - Perl5 access to the gdbm library. -=head2 ExtUtils::MM_VMS - methods to override UN*X behaviour in -ExtUtils::MakeMaker +=item SYNOPSIS =item DESCRIPTION +=item AVAILABILITY +=item BUGS +=item SEE ALSO - -=head2 ExtUtils::MakeMaker - create an extension Makefile +=head2 Getopt::Long, GetOptions - extended processing of command line +options =item SYNOPSIS - =item DESCRIPTION +EnoneE, !, =s, :s, =i, :i, =f, :f =over -=item Hintsfile support - - -=item What's new in version 5 of MakeMaker +=item Linkage specification +=item Aliases and abbreviations -=item Incompatibilities between MakeMaker 5.00 and 4.23 +=item Non-option call-back routine +=item Option starters -=item Default Makefile Behaviour +=item Return value +=back -=item make test +=item COMPATIBILITY +=item EXAMPLES -=item make install +=item CONFIGURATION VARIABLES +$Getopt::Long::autoabbrev, $Getopt::Long::getopt_compat, +$Getopt::Long::order, $Getopt::Long::bundling, $Getopt::Long::ignorecase, +$Getopt::Long::passthrough, $Getopt::Long::VERSION, $Getopt::Long::error, +$Getopt::Long::debug -=item PREFIX attribute +=head2 Getopt::Std, getopt - Process single-character switches with switch +clustering +=item SYNOPSIS -=item AFS users +=item DESCRIPTION +=head2 I18N::Collate - compare 8-bit scalar data according to the current +locale -=item Static Linking of a new Perl Binary +=item SYNOPSIS +=item DESCRIPTION -=item Determination of Perl Library and Installation Locations +=head2 IO - load various IO modules +=item SYNOPSIS -=item Useful Default Makefile Macros +=item DESCRIPTION +=head2 IO::File - supply object methods for filehandles -=item Using Attributes and Parameters +=item SYNOPSIS +=item DESCRIPTION -C, CONFIG, CONFIGURE, DEFINE, DIR, DISTNAME, DL_FUNCS, DL_VARS, -EXE_FILES, FIRST_MAKEFILE, FULLPERL, H, INC, INSTALLARCHLIB, -INSTALLBIN, INSTALLDIRS, INSTALLMAN1DIR, INSTALLMAN3DIR, -INSTALLPRIVLIB, INSTALLSITELIB, INSTALLSITEARCH, INST_ARCHLIB, -INST_EXE, INST_LIB, INST_MAN1DIR, INST_MAN3DIR, LDFROM, LIBPERL_A, -LIBS, LINKTYPE, MAKEAPERL, MAKEFILE, MAN1PODS, MAN3PODS, MAP_TARGET, -MYEXTLIB, NAME, NEEDS_LINKING, NOECHO, NORECURS, OBJECT, PERL, -PERLMAINCC, PERL_ARCHLIB, PERL_LIB, PERL_SRC, PL_FILES, PM, PMLIBDIRS, -PREFIX, PREREQ, SKIP, TYPEMAPS, VERSION, VERSION_FROM, XS, XSOPT, -XSPROTOARG, XS_VERSION +=item CONSTRUCTOR -=item Additional lowercase attributes +new ([ ARGS ] ) +=item METHODS -clean, depend, dist, dynamic_lib, installpm, linkext, macro, realclean, -tool_autosplit +open( FILENAME [,MODE [,PERMS]] ) -=item Overriding MakeMaker Methods +=item SEE ALSO +=item HISTORY -=item Distribution Support +=head2 IO::Handle - supply object methods for I/O handles +=item SYNOPSIS - make distcheck, make skipcheck, make distclean, make - manifest, make distdir, make tardist, make dist, make - uutardist, make shdist, make ci +=item DESCRIPTION +=item CONSTRUCTOR +new (), new_from_fd ( FD, MODE ) -=back +=item METHODS -=item AUTHORS +$fh->getline, $fh->getlines, $fh->fdopen ( FD, MODE ), $fh->write ( BUF, +LEN [, OFFSET }\] ), $fh->opened, $fh->untaint +=item NOTE -=item MODIFICATION HISTORY +=item SEE ALSO +=item BUGS -=item TODO +=item HISTORY +=head2 IO::Pipe, IO::pipe - supply object methods for pipes +=item SYNOPSIS +=item DESCRIPTION +=item CONSTRCUTOR -=head2 ExtUtils::Manifest - utilities to write and check a MANIFEST -file +new ( [READER, WRITER] ) -=item SYNOPSIS +=item METHODS +reader ([ARGS]), writer ([ARGS]), handles () -=item DESCRIPTION +=item SEE ALSO +=item AUTHOR -=item MANIFEST.SKIP +=item COPYRIGHT +=head2 IO::Seekable - supply seek based methods for I/O objects -=item EXPORT_OK +=item SYNOPSIS +=item DESCRIPTION -=item GLOBAL VARIABLES +=item SEE ALSO +=item HISTORY -=item DIAGNOSTICS +=head2 IO::Select - OO interface to the select system call +=item SYNOPSIS -C I, C I, C -I<$!>, C I +=item DESCRIPTION -=item SEE ALSO +=item CONSTRUCTOR +new ( [ HANDLES ] ) -=item AUTHOR +=item METHODS +add ( HANDLES ), remove ( HANDLES ), exists ( HANDLE ), handles, can_read ( +[ TIMEOUT ] ), can_write ( [ TIMEOUT ] ), has_error ( [ TIMEOUT ] ), count +(), bits(), bits(), select ( READ, WRITE, ERROR [, TIMEOUT ] ) +=item EXAMPLE +=item AUTHOR +=item COPYRIGHT -=head2 ExtUtils::Mkbootstrap - make a bootstrap file for use by -DynaLoader +=head2 IO::Socket - Object interface to socket communications =item SYNOPSIS - =item DESCRIPTION +=item CONSTRUCTOR +new ( [ARGS] ) +=item METHODS +accept([PKG]), timeout([VAL]), sockopt(OPT [, VAL]), sockdomain, socktype, +protocol -=head2 ExtUtils::Mksymlists - write linker options files for dynamic -extension - -=item SYNOPSIS +=item SUB-CLASSES +=over -=item DESCRIPTION +=item IO::Socket::INET +=item METHODS -NAME, DL_FUNCS, DL_VARS, FILE, FUNCLIST, DLBASE +sockaddr (), sockport (), sockhost (), peeraddr (), peerport (), peerhost +() -=item AUTHOR +=item IO::Socket::UNIX +=item METHODS -=item REVISION +hostpath(), peerpath() +=back +=item SEE ALSO +=item AUTHOR +=item COPYRIGHT -=head2 Fcntl - load the C Fcntl.h defines +=head2 IO::lib::IO::File, IO::File - supply object methods for filehandles =item SYNOPSIS - =item DESCRIPTION +=item CONSTRUCTOR -=item NOTE +new ([ ARGS ] ) +=item METHODS +open( FILENAME [,MODE [,PERMS]] ) +=item SEE ALSO +=item HISTORY -=head2 File::Basename, Basename - parse file specifications +=head2 IO::lib::IO::Handle, IO::Handle - supply object methods for I/O +handles =item SYNOPSIS - =item DESCRIPTION +=item CONSTRUCTOR -fileparse_set_fstype, fileparse +new (), new_from_fd ( FD, MODE ) -=item EXAMPLES +=item METHODS +$fh->getline, $fh->getlines, $fh->fdopen ( FD, MODE ), $fh->write ( BUF, +LEN [, OFFSET }\] ), $fh->opened, $fh->untaint -C, C +=item NOTE +=item SEE ALSO +=item BUGS +=item HISTORY -=head2 File::CheckTree, validate - run many filetest checks on a tree +=head2 IO::lib::IO::Pipe, IO::pipe - supply object methods for pipes =item SYNOPSIS - =item DESCRIPTION +=item CONSTRCUTOR +new ( [READER, WRITER] ) +=item METHODS +reader ([ARGS]), writer ([ARGS]), handles () -=head2 File::Find, find - traverse a file tree +=item SEE ALSO -=item SYNOPSIS +=item AUTHOR +=item COPYRIGHT -=item DESCRIPTION +=head2 IO::lib::IO::Seekable, IO::Seekable - supply seek based methods for +I/O objects +=item SYNOPSIS +=item DESCRIPTION +=item SEE ALSO +=item HISTORY -=head2 File::Path - create or remove a series of directories +=head2 IO::lib::IO::Select, IO::Select - OO interface to the select system +call =item SYNOPSIS - =item DESCRIPTION +=item CONSTRUCTOR -=item AUTHORS - +new ( [ HANDLES ] ) -=item REVISION +=item METHODS +add ( HANDLES ), remove ( HANDLES ), exists ( HANDLE ), handles, can_read ( +[ TIMEOUT ] ), can_write ( [ TIMEOUT ] ), has_error ( [ TIMEOUT ] ), count +(), bits(), bits(), select ( READ, WRITE, ERROR [, TIMEOUT ] ) +=item EXAMPLE +=item AUTHOR +=item COPYRIGHT -=head2 FileCache - keep more files open than the system permits +=head2 IO::lib::IO::Socket, IO::Socket - Object interface to socket +communications =item SYNOPSIS - =item DESCRIPTION +=item CONSTRUCTOR -=item BUGS +new ( [ARGS] ) + +=item METHODS +accept([PKG]), timeout([VAL]), sockopt(OPT [, VAL]), sockdomain, socktype, +protocol +=item SUB-CLASSES +=over +=item IO::Socket::INET -=head2 FileHandle - supply object methods for filehandles +=item METHODS -=item SYNOPSIS +sockaddr (), sockport (), sockhost (), peeraddr (), peerport (), peerhost +() +=item IO::Socket::UNIX -=item DESCRIPTION +=item METHODS +hostpath(), peerpath() - $fh->print, $fh->printf, $fh->getline, $fh->getlines +=back =item SEE ALSO +=item AUTHOR -=item BUGS +=item COPYRIGHT +=head2 IPC::Open2, open2 - open a process for both reading and writing +=item SYNOPSIS +=item DESCRIPTION +=item WARNING -=head2 GDBM_File - Perl5 access to the gdbm library. +=item SEE ALSO -=item SYNOPSIS +=head2 IPC::Open3, open3 - open a process for reading, writing, and error +handling +=item SYNOPSIS =item DESCRIPTION +=item WARNING + +=head2 Math::BigFloat - Arbitrary length float math package -=item AVAILABILITY +=item SYNOPSIS + +=item DESCRIPTION +number format, Error returns 'NaN', Division is computed to =item BUGS +=item AUTHOR + +=head2 Math::BigInt - Arbitrary size integer math package -=item SEE ALSO +=item SYNOPSIS +=item DESCRIPTION +Canonical notation, Input, Output +=item EXAMPLES +=item BUGS -=head2 Getopt::Long, GetOptions - extended processing of command line -options +=item AUTHOR -=item SYNOPSIS +=head2 Math::Complex - complex numbers and associated mathematical +functions +=item SYNOPSIS =item DESCRIPTION +=item OPERATIONS -, !, =s, :s, =i, :i, =f, :f +=item CREATION -=over +=item STRINGIFICATION -=item Linkage specification +=item USAGE + +=item BUGS +=item AUTHOR -=item Aliases and abbreviations +=head2 NDBM_File - Tied access to ndbm files +=item SYNOPSIS -=item Non-option call-back routine +=item DESCRIPTION +=head2 Net::Ping - check a remote host for reachability -=item Option starters +=item SYNOPSIS +=item DESCRIPTION -=item Return value +=over + +=item Functions +Net::Ping->new([$proto [, $def_timeout [, $bytes]]]);, $p->ping($host [, +$timeout]);, $p->close();, pingecho($host [, $timeout]); +=back + +=item WARNING +=item NOTES -=back +=head2 Net::hostent - by-name interface to Perl's built-in gethost*() +functions -=item COMPATIBILITY +=item SYNOPSIS +=item DESCRIPTION =item EXAMPLES +=item NOTE -=item CONFIGURATION VARIABLES +=item AUTHOR +=head2 Net::netent - by-name interface to Perl's built-in getnet*() +functions -$Getopt::Long::autoabbrev, $Getopt::Long::getopt_compat, -$Getopt::Long::order, $Getopt::Long::ignorecase, -$Getopt::Long::VERSION, $Getopt::Long::error, $Getopt::Long::debug +=item SYNOPSIS +=item DESCRIPTION +=item EXAMPLES +=item NOTE -=head2 Getopt::Std, getopt - Process single-character switches with -switch clustering +=item AUTHOR -=item SYNOPSIS +=head2 Net::protoent - by-name interface to Perl's built-in getproto*() +functions +=item SYNOPSIS =item DESCRIPTION +=item NOTE +=item AUTHOR - - -=head2 I18N::Collate - compare 8-bit scalar data according to the -current locale +=head2 Net::servent - by-name interface to Perl's built-in getserv*() +functions =item SYNOPSIS - =item DESCRIPTION +=item EXAMPLES +=item NOTE +=item AUTHOR - -=head2 IPC::Open2, open2 - open a process for both reading and writing +=head2 ODBM_File - Tied access to odbm files =item SYNOPSIS - =item DESCRIPTION +=head2 Opcode - Disable named opcodes when compiling perl code -=item WARNING - +=item SYNOPSIS -=item SEE ALSO +=item DESCRIPTION +=item NOTE +=item WARNING +=item Operator Names and Operator Lists +an operator name (opname), an operator tag name (optag), a negated opname +or optag, an operator set (opset) -=head2 IPC::Open3, open3 - open a process for reading, writing, and -error handling +=item Opcode Functions -=item SYNOPSIS +opcodes, opset (OP, ...), opset_to_ops (OPSET), opset_to_hex (OPSET), +full_opset, empty_opset, invert_opset (OPSET), verify_opset (OPSET, ...), +define_optag (OPTAG, OPSET), opmask_add (OPSET), opmask, opdesc (OP, ...), +opdump (PAT) +=item Manipulating Opsets -=item DESCRIPTION +=item TO DO (maybe) +=item Predefined Opcode Tags +:base_core, :base_mem, :base_loop, :base_io, :base_orig, :base_math, +:default, :filesys_read, :sys_db, :browse, :filesys_open, :filesys_write, +:subprocess, :ownprocess, :others, :still_to_be_decided, :dangerous +=item SEE ALSO +=item AUTHORS -=head2 Net::Ping, pingecho - check a host for upness +=head2 Opcode::Safe, Safe - Compile and execute code in restricted +compartments =item SYNOPSIS - =item DESCRIPTION +a new namespace, an operator mask + +=item WARNING =over -=item Parameters +=item RECENT CHANGES +=item Methods in class Safe -hostname, timeout +permit (OP, ...), permit_only (OP, ...), deny (OP, ...), deny_only (OP, +...), trap (OP, ...), untrap (OP, ...), share (NAME, ...), share_from +(PACKAGE, ARRAYREF), varglob (VARNAME), reval (STRING), rdo (FILENAME), +root (NAMESPACE), mask (MASK) +=item Some Safety Issues +Memory, CPU, Snooping, Signals, State Changes -=back +=item AUTHOR -=item WARNING +=back +=head2 Opcode::ops, ops - Perl pragma to restrict unsafe operations when +compiling +=item SYNOPSIS +=item DESCRIPTION +=item SEE ALSO =head2 POSIX - Perl interface to IEEE Std 1003.1 =item SYNOPSIS - =item DESCRIPTION - =item NOTE - -=item CAVEATS - +=item CAVEATS =item FUNCTIONS - -_exit, abort, abs, access, acos, alarm, asctime, asin, assert, atan, -atan2, atexit, atof, atoi, atol, bsearch, calloc, ceil, chdir, chmod, -chown, clearerr, clock, close, closedir, cos, cosh, creat, ctermid, -ctime, cuserid, difftime, div, dup, dup2, errno, execl, execle, execlp, -execv, execve, execvp, exit, exp, fabs, fclose, fcntl, fdopen, feof, -ferror, fflush, fgetc, fgetpos, fgets, fileno, floor, fmod, fopen, -fork, fpathconf, fprintf, fputc, fputs, fread, free, freopen, frexp, -fscanf, fseek, fsetpos, fstat, ftell, fwrite, getc, getchar, getcwd, -getegid, getenv, geteuid, getgid, getgrgid, getgrnam, getgroups, -getlogin, getpgrp, getpid, getppid, getpwnam, getpwuid, gets, getuid, -gmtime, isalnum, isalpha, isatty, iscntrl, isdigit, isgraph, islower, -isprint, ispunct, isspace, isupper, isxdigit, kill, labs, ldexp, ldiv, -link, localeconv, localtime, log, log10, longjmp, lseek, malloc, mblen, -mbstowcs, mbtowc, memchr, memcmp, memcpy, memmove, memset, mkdir, -mkfifo, mktime, modf, nice, offsetof, open, opendir, pat +_exit, abort, abs, access, acos, alarm, asctime, asin, assert, atan, atan2, +atexit, atof, atoi, atol, bsearch, calloc, ceil, chdir, chmod, chown, +clearerr, clock, close, closedir, cos, cosh, creat, ctermid, ctime, +cuserid, difftime, div, dup, dup2, errno, execl, execle, execlp, execv, +execve, execvp, exit, exp, fabs, fclose, fcntl, fdopen, feof, ferror, +fflush, fgetc, fgetpos, fgets, fileno, floor, fmod, fopen, fork, fpathconf, +fprintf, fputc, fputs, fread, free, freopen, frexp, fscanf, fseek, fsetpos, +fstat, ftell, fwrite, getc, getchar, getcwd, getegid, getenv, geteuid, +getgid, getgrgid, getgrnam, getgroups, getlogin, getpgrp, getpid, getppid, +getpwnam, getpwuid, gets, getuid, gmtime, isalnum, isalpha, isatty, +iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, +isxdigit, kill, labs, ldexp, ldiv, link, localeconv, localtime, log, log10, +longjmp, lseek, malloc, mblen, mbstowcs, mbtowc, memchr, memcmp, memcpy, +memmove, memset, mkdir, mkfifo, mktime, modf, nice, offsetof, open, +opendir, pathconf, pause, perror, pipe, pow, printf, putc, putchar, puts, +qsort, raise, rand, read, readdir, realloc, remove, rename, rewind, +rewinddir, rmdir, scanf, setgid, setjmp, setlocale, setpgid, setsid, +setuid, sigaction, siglongjmp, sigpending, sigprocmask, sigsetjmp, +sigsuspend, sin, sinh, sleep, sprintf, sqrt, srand, sscanf, stat, strcat, +strchr, strcmp, strcoll, strcpy, strcspn, strerror, strftime, strlen, +strncat, strncmp, strncpy, stroul, strpbrk, strrchr, strspn, strstr, +strtod, strtok, strtol, strtoul, strxfrm, sysconf, system, tan, tanh, +tcdrain, tcflow, tcflush, tcgetpgrp, tcsendbreak, tcsetpgrp, time, times, +tmpfile, tmpnam, tolower, toupper, ttyname, tzname, tzset, umask, uname, +ungetc, unlink, utime, vfprintf, vprintf, vsprintf, wait, waitpid, +wcstombs, wctomb, write =item CLASSES - =over =item POSIX::SigAction - new =item POSIX::SigSet - new, addset, delset, emptyset, fillset, ismember =item POSIX::Termios - new, getattr, getcc, getcflag, getiflag, getispeed, getlflag, getoflag, getospeed, setattr, setcc, setcflag, setiflag, setispeed, setlflag, setoflag, setospeed, Baud rate values, Terminal interface values, c_cc field values, c_cflag field values, c_iflag field values, c_lflag field values, c_oflag field values - - =back =item PATHNAME CONSTANTS - Constants =item POSIX CONSTANTS - Constants =item SYSTEM CONFIGURATION - Constants =item ERRNO - Constants =item FCNTL - Constants =item FLOAT - Constants =item LIMITS - Constants =item LOCALE - Constants =item MATH - Constants =item SIGNAL - Constants =item STAT - Constants, Macros =item STDLIB - Constants =item STDIO - Constants =item TIME - Constants =item UNISTD - Constants =item WAIT - Constants, Macros =item CREATION - - - - =head2 Pod::Text - convert POD data to formatted ASCII text =item SYNOPSIS - =item DESCRIPTION - =item AUTHOR - =item TODO +=head2 SDBM_File - Tied access to sdbm files +=item SYNOPSIS +=item DESCRIPTION +=head2 Safe - Compile and execute code in restricted compartments -=head2 Safe - Safe extension module for Perl +=item SYNOPSIS =item DESCRIPTION - a new namespace, an operator mask -=over +=item WARNING -=item Operator masks +=over +=item RECENT CHANGES =item Methods in class Safe +permit (OP, ...), permit_only (OP, ...), deny (OP, ...), deny_only (OP, +...), trap (OP, ...), untrap (OP, ...), share (NAME, ...), share_from +(PACKAGE, ARRAYREF), varglob (VARNAME), reval (STRING), rdo (FILENAME), +root (NAMESPACE), mask (MASK) -NAMESPACE, MASK, root (NAMESPACE), mask (MASK), trap (OP, ...), untrap -(OP, ...), share (VARNAME, ...), varglob (VARNAME), reval (STRING), rdo -(FILENAME) - -=item Subroutines in package Safe - +=item Some Safety Issues -ops_to_mask (OP, ...), mask_to_ops (MASK), opcode (OP, ...), opname -(OP, ...), fullmask, emptymask, MAXO, op_mask +Memory, CPU, Snooping, Signals, State Changes =item AUTHOR - - - =back - - - =head2 Search::Dict, look - search for key in dictionary file =item SYNOPSIS - =item DESCRIPTION - - - - =head2 SelectSaver - save and restore selected file handle =item SYNOPSIS - =item DESCRIPTION - - - - =head2 SelfLoader - load functions only on demand =item SYNOPSIS - =item DESCRIPTION - =over =item The __DATA__ token - =item SelfLoader autoloading - =item Autoloading and package lexicals - =item SelfLoader and AutoLoader - =item __DATA__, __END__, and the FOOBAR::DATA filehandle. - =item Classes and inherited methods. - - - =back =item Multiple packages and fully qualified subroutine names - - - - -=head2 Socket, sockaddr_in, sockaddr_un, inet_aton, inet_ntoa - load -the C socket.h defines and structure manipulators +=head2 Shell - run shell commands transparently within perl =item SYNOPSIS - =item DESCRIPTION +=item AUTHOR -inet_aton HOSTNAME, inet_ntoa IP_ADDRESS, INADDR_ANY, INADDR_LOOPBACK, -INADDR_NONE, sockaddr_in PORT, ADDRESS, sockaddr_in SOCKADDR_IN, -pack_sockaddr_in PORT, IP_ADDRESS, unpack_sockaddr_in SOCKADDR_IN, -sockaddr_un PATHNAME, sockaddr_un SOCKADDR_UN, pack_sockaddr_un PATH, -unpack_sockaddr_un SOCKADDR_UN +=head2 Socket, sockaddr_in, sockaddr_un, inet_aton, inet_ntoa - load the C +socket.h defines and structure manipulators +=item SYNOPSIS +=item DESCRIPTION +inet_aton HOSTNAME, inet_ntoa IP_ADDRESS, INADDR_ANY, INADDR_BROADCAST, +INADDR_LOOPBACK, INADDR_NONE, sockaddr_in PORT, ADDRESS, sockaddr_in +SOCKADDR_IN, pack_sockaddr_in PORT, IP_ADDRESS, unpack_sockaddr_in +SOCKADDR_IN, sockaddr_un PATHNAME, sockaddr_un SOCKADDR_UN, +pack_sockaddr_un PATH, unpack_sockaddr_un SOCKADDR_UN =head2 Symbol - manipulate Perl symbols and their names =item SYNOPSIS - =item DESCRIPTION - - - - =head2 Sys::Hostname - Try every conceivable way to get hostname =item SYNOPSIS - =item DESCRIPTION - =item AUTHOR - - - - -=head2 Syslog, Sys::Syslog, openlog, closelog, setlogmask, syslog - -Perl interface to the UNIX syslog(3) calls +=head2 Syslog, Sys::Syslog, openlog, closelog, setlogmask, syslog - Perl +interface to the UNIX syslog(3) calls =item SYNOPSIS - =item DESCRIPTION - -openlog $ident, $logopt, $facility, syslog $priority, $mask, $format, -@args, setlogmask $mask_priority, closelog +openlog $ident, $logopt, $facility, syslog $priority, $format, @args, +setlogmask $mask_priority, closelog =item EXAMPLES - =item DEPENDENCIES - =item SEE ALSO - =item AUTHOR - - - - =head2 Term::Cap - Perl termcap interface =item SYNOPSIS - =item DESCRIPTION - =item EXAMPLES - - - - =head2 Term::Complete - Perl word completion module =item SYNOPSIS - =item DESCRIPTION - -Attempts word completion. Cannot be changed, ^D, ^U, , +EtabEAttempts word completion. +Cannot be changed, ^D, ^U, EdelE, EbsE =item DIAGNOSTICS - =item BUGS - =item AUTHOR - - - - -=head2 Term::ReadLine - Perl interface to various C packages. -If no real package is found, substitutes stubs instead of basic -functions. +=head2 Term::ReadLine - Perl interface to various C packages. If +no real package is found, substitutes stubs instead of basic functions. =item SYNOPSIS - =item DESCRIPTION - =item Minimal set of supported functions - C, C, C, C, C, $C, C, C, C =item EXPORTS - - - - =head2 Test::Harness - run perl standard test scripts with statistics =item SYNOPSIS - =item DESCRIPTION - =over =item The test script output - - - =back =item EXPORT - =item DIAGNOSTICS - C, C, C, C, C +%s\n\tFailed %d/%d tests, %.2f%% okay.>, C, C, C =item SEE ALSO - =item AUTHORS - =item BUGS - - - - =head2 Text::Abbrev, abbrev - create an abbreviation table from a list =item SYNOPSIS - =item DESCRIPTION - =item EXAMPLE +=head2 Text::ParseWords - parse text into an array of tokens +=item SYNOPSIS +=item DESCRIPTION +=item AUTHORS -=head2 Text::Soundex - Implementation of the Soundex Algorithm as -Described by Knuth +=head2 Text::Soundex - Implementation of the Soundex Algorithm as Described +by Knuth =item SYNOPSIS - =item DESCRIPTION - =item EXAMPLES - =item LIMITATIONS - =item AUTHOR +=head2 Text::Tabs -- expand and unexpand tabs per the unix expand(1) and +unexpand(1) +=item SYNOPSIS +=item DESCRIPTION +=item BUGS -=head2 Text::Tabs -- expand and unexpand tabs +=item AUTHOR -=item SYNOPSIS +=head2 Text::Wrap - line wrapping to form simple paragraphs +=item SYNOPSIS =item DESCRIPTION +=item EXAMPLE =item AUTHOR +=head2 Tie::Hash, Tie::StdHash - base class definitions for tied hashes + +=item SYNOPSIS + +=item DESCRIPTION +TIEHASH classname, LIST, STORE this, key, value, FETCH this, key, FIRSTKEY +this, NEXTKEY this, lastkey, EXISTS this, key, DELETE this, key, CLEAR this +=item CAVEATS +=item MORE INFORMATION -=head2 Text::Wrap -- wrap text into a paragraph +=head2 Tie::RefHash - use references as hash keys =item SYNOPSIS - =item DESCRIPTION +=item EXAMPLE =item AUTHOR +=item VERSION +=item SEE ALSO - - -=head2 Tie::Hash, Tie::StdHash - base class definitions for tied hashes +=head2 Tie::Scalar, Tie::StdScalar - base class definitions for tied +scalars =item SYNOPSIS - =item DESCRIPTION +TIESCALAR classname, LIST, FETCH this, STORE this, value, DESTROY this -TIEHASH classname, LIST, STORE this, key, value, FETCH this, key, -FIRSTKEY this, NEXTKEY this, lastkey, EXISTS this, key, DELETE this, -key, CLEAR this +=item MORE INFORMATION -=item CAVEATS +=head2 Tie::SubstrHash - Fixed-table-size, fixed-key-length hashing +=item SYNOPSIS -=item MORE INFORMATION +=item DESCRIPTION +=item CAVEATS +=head2 Time::Local - efficiently compute time from local and GMT time +=item SYNOPSIS +=item DESCRIPTION -=head2 Tie::Scalar, Tie::StdScalar - base class definitions for tied -scalars +=head2 Time::gmtime - by-name interface to Perl's built-in gmtime() +function =item SYNOPSIS - =item DESCRIPTION +=item NOTE -TIESCALAR classname, LIST, FETCH this, STORE this, value, DESTROY this +=item AUTHOR -=item MORE INFORMATION +=head2 Time::localtime - by-name interface to Perl's built-in localtime() +function +=item SYNOPSIS +=item DESCRIPTION +=item NOTE +=item AUTHOR -=head2 Tie::SubstrHash - Fixed-table-size, fixed-key-length hashing +=head2 Time::tm - internal object used by Time::gmtime and Time::localtime =item SYNOPSIS +=item DESCRIPTION + +=item AUTHOR + +=head2 UNIVERSAL - base class for ALL classes (blessed references) + +=item SYNOPSIS =item DESCRIPTION +isa ( TYPE ), can ( METHOD ), VERSION ( [ REQUIRE ] ), isa ( REF, TYPE ) -=item CAVEATS +=head2 User::grent - by-name interface to Perl's built-in getgr*() +functions +=item SYNOPSIS +=item DESCRIPTION +=item NOTE +=item AUTHOR -=head2 Time::Local - efficiently compute tome from local and GMT time +=head2 User::pwent - by-name interface to Perl's built-in getpw*() +functions =item SYNOPSIS - =item DESCRIPTION +=item NOTE - +=item AUTHOR =head1 AUXILIARY DOCUMENTATION -Here should be listed all the extra program's documentation, but they don't all -have manual pages yet: +Here should be listed all the extra programs' documentation, but they +don't all have manual pages yet: =item a2p @@ -3178,10 +3506,8 @@ have manual pages yet: =item wrapsuid - =head1 AUTHOR -Larry Wall EFE, with the help of oodles of -other folks. - +Larry Wall EFE, with the help of oodles +of other folks. diff --git a/pp.c b/pp.c index d7725b8..089d523 100644 --- a/pp.c +++ b/pp.c @@ -731,23 +731,19 @@ PP(pp_repeat) if (SvROK(tmpstr)) sv_unref(tmpstr); } - if (USE_LEFT(tmpstr) || SvTYPE(tmpstr) > SVt_PVMG) { - SvSetSV(TARG, tmpstr); - SvPV_force(TARG, len); - if (count != 1) { - if (count < 1) - SvCUR_set(TARG, 0); - else { - SvGROW(TARG, (count * len) + 1); - repeatcpy(SvPVX(TARG) + len, SvPVX(TARG), len, count - 1); - SvCUR(TARG) *= count; - } - *SvEND(TARG) = '\0'; + SvSetSV(TARG, tmpstr); + SvPV_force(TARG, len); + if (count != 1) { + if (count < 1) + SvCUR_set(TARG, 0); + else { + SvGROW(TARG, (count * len) + 1); + repeatcpy(SvPVX(TARG) + len, SvPVX(TARG), len, count - 1); + SvCUR(TARG) *= count; } - (void)SvPOK_only(TARG); + *SvEND(TARG) = '\0'; } - else - sv_setsv(TARG, &sv_no); + (void)SvPOK_only(TARG); PUSHTARG; } RETURN; @@ -1004,11 +1000,11 @@ PP(pp_bit_or) dPOPTOPssrl; if (SvNIOKp(left) || SvNIOKp(right)) { if (op->op_private & HINT_INTEGER) { - IBW value = SvIV(left) | SvIV(right); + IBW value = (USE_LEFT(left) ? SvIV(left) : 0) | SvIV(right); SETi( value ); } else { - UBW value = SvUV(left) | SvUV(right); + UBW value = (USE_LEFT(left) ? SvUV(left) : 0) | SvUV(right); SETu( value ); } } diff --git a/pp_hot.c b/pp_hot.c index f957deb..b9e3b87 100644 --- a/pp_hot.c +++ b/pp_hot.c @@ -97,7 +97,7 @@ PP(pp_gelem) break; case 'C': if (strEQ(elem, "CODE")) - ref = (SV*)GvCV(gv); + ref = (SV*)GvCVu(gv); break; case 'F': if (strEQ(elem, "FILEHANDLE")) /* XXX deprecate in 5.005 */ @@ -957,7 +957,8 @@ do_readline() perl_call_method("READLINE", GIMME); LEAVE; SPAGAIN; - if (GIMME == G_SCALAR) sv_setsv(TARG, TOPs); + if (GIMME == G_SCALAR) + SvSetSV_nosteal(TARG, TOPs); RETURN; } fp = Nullfp; @@ -1717,17 +1718,17 @@ PP(pp_entersub) may_clone = FALSE; break; case SVt_PVGV: - if (!(cv = GvCV((GV*)sv))) + if (!(cv = GvCVu((GV*)sv))) cv = sv_2cv(sv, &stash, &gv, TRUE); break; } - ENTER; - SAVETMPS; - if (may_clone && cv && CvCLONE(cv)) cv = (CV*)sv_2mortal((SV*)cv_clone(cv)); + ENTER; + SAVETMPS; + retry: if (!cv) DIE("Not a CODE reference"); @@ -1736,12 +1737,8 @@ PP(pp_entersub) if (gv = CvGV(cv)) { SV *tmpstr; GV *ngv; - if (SvFAKE(cv) && GvCV(gv) != cv) { /* autoloaded stub? */ + if (cv != GvCV(gv)) { /* autoloaded stub? */ cv = GvCV(gv); - if (SvTYPE(sv) == SVt_PVGV) { - SvREFCNT_dec(GvCV((GV*)sv)); - GvCV((GV*)sv) = (CV*)SvREFCNT_inc((SV*)cv); - } goto retry; } tmpstr = sv_newmortal(); @@ -1760,7 +1757,7 @@ PP(pp_entersub) } gimme = GIMME; - if ((op->op_private & OPpENTERSUB_DB)) { + if ((op->op_private & OPpENTERSUB_DB) && !CvNODEBUG(cv)) { SV *oldsv = sv; sv = GvSV(DBsub); save_item(sv); @@ -2035,7 +2032,7 @@ DIE("Can't call method \"%s\" without a package or object reference", name); if (!gv) DIE("Can't locate object method \"%s\" via package \"%s\"", name, packname); - SETs((SV*)gv); + SETs(isGV(gv) ? (SV*)GvCV(gv) : (SV*)gv); RETURN; } *(stack_base + TOPMARK + 1) = sv_2mortal(newRV((SV*)iogv)); @@ -2054,7 +2051,7 @@ DIE("Can't call method \"%s\" without a package or object reference", name); name, HvNAME(SvSTASH(ob))); } - SETs((SV*)gv); + SETs(isGV(gv) ? (SV*)GvCV(gv) : (SV*)gv); RETURN; } diff --git a/pp_sys.c b/pp_sys.c index 10b64d4..f24c8ab 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -468,7 +468,7 @@ PP(pp_tie) methname = "TIESCALAR"; stash = gv_stashsv(mark[1], FALSE); - if (!stash || !(gv = gv_fetchmethod(stash, methname)) || !GvCV(gv)) + if (!stash || !(gv = gv_fetchmethod(stash, methname))) DIE("Can't locate object method \"%s\" via package \"%s\"", methname, SvPV(mark[1],na)); @@ -483,7 +483,7 @@ PP(pp_tie) if (perldb && curstash != debstash) op->op_private |= OPpENTERSUB_DB; - XPUSHs((SV*)gv); + XPUSHs((SV*)GvCV(gv)); PUTBACK; if (op = pp_entersub()) @@ -572,11 +572,11 @@ PP(pp_dbmopen) sv = sv_mortalcopy(&sv_no); sv_setpv(sv, "AnyDBM_File"); stash = gv_stashsv(sv, FALSE); - if (!stash || !(gv = gv_fetchmethod(stash, "TIEHASH")) || !GvCV(gv)) { + if (!stash || !(gv = gv_fetchmethod(stash, "TIEHASH"))) { PUTBACK; perl_require_pv("AnyDBM_File.pm"); SPAGAIN; - if (!(gv = gv_fetchmethod(stash, "TIEHASH")) || !GvCV(gv)) + if (!(gv = gv_fetchmethod(stash, "TIEHASH"))) DIE("No dbm on this machine"); } @@ -601,7 +601,7 @@ PP(pp_dbmopen) else PUSHs(sv_2mortal(newSViv(O_RDWR))); PUSHs(right); - PUSHs((SV*)gv); + PUSHs((SV*)GvCV(gv)); PUTBACK; if (op = pp_entersub()) @@ -618,7 +618,7 @@ PP(pp_dbmopen) PUSHs(left); PUSHs(sv_2mortal(newSViv(O_RDONLY))); PUSHs(right); - PUSHs((SV*)gv); + PUSHs((SV*)GvCV(gv)); PUTBACK; if (op = pp_entersub()) diff --git a/sv.c b/sv.c index ab08ea9..d8704b8 100644 --- a/sv.c +++ b/sv.c @@ -1288,7 +1288,7 @@ register SV *sv; switch (SvTYPE(sv)) { case SVt_NULL: sv_upgrade(sv, SVt_IV); - return SvIVX(sv); + break; case SVt_PV: sv_upgrade(sv, SVt_PVIV); break; @@ -1357,7 +1357,7 @@ register SV *sv; switch (SvTYPE(sv)) { case SVt_NULL: sv_upgrade(sv, SVt_IV); - return SvUVX(sv); + break; case SVt_PV: sv_upgrade(sv, SVt_PVIV); break; @@ -1938,8 +1938,14 @@ register SV *sstr; GvIMPORTED_HV_on(dstr); break; case SVt_PVCV: - if (intro) + if (intro) { + if (GvCVGEN(dstr) && GvCV(dstr) != (CV*)sref) { + SvREFCNT_dec(GvCV(dstr)); + GvCV(dstr) = Nullcv; + GvCVGEN(dstr) = 0; + } SAVESPTR(GvCV(dstr)); + } else { CV* cv = GvCV(dstr); if (cv) { @@ -1949,15 +1955,13 @@ register SV *sstr; (CvROOT(cv) || CvXSUB(cv)) ) warn("Subroutine %s redefined", GvENAME((GV*)dstr)); - if (SvREFCNT(cv) == 1) - SvFAKE_on(cv); } } - sub_generation++; if (GvCV(dstr) != (CV*)sref) { GvCV(dstr) = (CV*)sref; GvCVGEN(dstr) = 0; /* Switch off cacheness. */ GvASSUMECV_on(dstr); + sub_generation++; } if (curcop->cop_stash != GvSTASH(dstr)) GvIMPORTED_CV_on(dstr); @@ -2582,15 +2586,15 @@ register SV *sv; assert(SvREFCNT(sv) == 0); if (SvOBJECT(sv)) { - dSP; - GV* destructor; - if (defstash) { /* Still have a symbol table? */ - destructor = gv_fetchmethod(SvSTASH(sv), "DESTROY"); + dSP; + GV* destructor; ENTER; SAVEFREESV(SvSTASH(sv)); - if (destructor && GvCV(destructor)) { + + destructor = gv_fetchmethod(SvSTASH(sv), "DESTROY"); + if (destructor) { SV ref; Zero(&ref, 1, SV); @@ -2602,10 +2606,12 @@ register SV *sv; PUSHMARK(SP); PUSHs(&ref); PUTBACK; - perl_call_sv((SV*)destructor, G_DISCARD|G_EVAL|G_KEEPERR); + perl_call_sv((SV*)GvCV(destructor), + G_DISCARD|G_EVAL|G_KEEPERR); del_XRV(SvANY(&ref)); SvREFCNT(sv)--; } + LEAVE; } else @@ -3585,7 +3591,7 @@ I32 lref; return Nullcv; *st = GvESTASH(gv); fix_gv: - if (lref && !GvCV(gv)) { + if (lref && !GvCVu(gv)) { SV *tmpsv; ENTER; tmpsv = NEWSV(704,0); @@ -3595,10 +3601,10 @@ I32 lref; Nullop, Nullop); LEAVE; - if (!GvCV(gv)) + if (!GvCVu(gv)) croak("Unable to create sub named \"%s\"", SvPV(sv,na)); } - return GvCV(gv); + return GvCVu(gv); } } diff --git a/sv.h b/sv.h index 29342f0..0186536 100644 --- a/sv.h +++ b/sv.h @@ -553,7 +553,15 @@ SV *newRV_noinc _((SV *)); #define SvSETMAGIC(x) if (SvSMAGICAL(x)) mg_set(x) -#define SvSetSV(dst,src) if (dst != src) sv_setsv(dst,src) +#define SvSetSV(dst,src) if ((dst) != (src)) sv_setsv(dst,src) + +#define SvSetSV_nosteal(dst,src) \ + if ((dst) != (src)) { \ + U32 tMpF = SvFLAGS(src) & SVs_TEMP; \ + SvTEMP_off(src); \ + sv_setsv(dst, src); \ + SvFLAGS(src) |= tMpF; \ + } #define SvPEEK(sv) sv_peek(sv) diff --git a/t/TEST b/t/TEST index 0b996f4..fdd995e 100755 --- a/t/TEST +++ b/t/TEST @@ -21,7 +21,7 @@ $ENV{EMXSHELL} = 'sh'; # For OS/2 if ($ARGV[0] eq '') { @ARGV = split(/[ \n]/, - `echo base/*.t comp/*.t cmd/*.t io/*.t; echo op/*.t lib/*.t`); + `echo base/*.t comp/*.t cmd/*.t pragma/*.t io/*.t; echo op/*.t lib/*.t`); } if ($^O eq 'os2' || $^O eq 'qnx') { diff --git a/t/comp/colon.t b/t/comp/colon.t index e69de29..2a37367 100755 --- a/t/comp/colon.t +++ b/t/comp/colon.t @@ -0,0 +1,138 @@ +#!./perl + +# +# Ensure that syntax using colons (:) is parsed correctly. +# The tests are done on the following tokens (by default): +# ABC LABEL XYZZY m q qq qw qx s tr y AUTOLOAD and alarm +# -- Robin Barker +# + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +use strict; + +$_ = ''; # to avoid undef warning on m// etc. + +sub ok { + my($test,$ok) = @_; + print "not " unless $ok; + print "ok $test\n"; +} + +$SIG{__WARN__} = sub { 1; }; # avoid some spurious warnings + +print "1..25\n"; + +ok 1, (eval "package ABC; sub zyx {1}; 1;" and + eval "ABC::zyx" and + not eval "ABC:: eq ABC||" and + not eval "ABC::: >= 0"); + +ok 2, (eval "package LABEL; sub zyx {1}; 1;" and + eval "LABEL::zyx" and + not eval "LABEL:: eq LABEL||" and + not eval "LABEL::: >= 0"); + +ok 3, (eval "package XYZZY; sub zyx {1}; 1;" and + eval "XYZZY::zyx" and + not eval "XYZZY:: eq XYZZY||" and + not eval "XYZZY::: >= 0"); + +ok 4, (eval "package m; sub zyx {1}; 1;" and + not eval "m::zyx" and + eval "m:: eq m||" and + not eval "m::: >= 0"); + +ok 5, (eval "package q; sub zyx {1}; 1;" and + not eval "q::zyx" and + eval "q:: eq q||" and + not eval "q::: >= 0"); + +ok 6, (eval "package qq; sub zyx {1}; 1;" and + not eval "qq::zyx" and + eval "qq:: eq qq||" and + not eval "qq::: >= 0"); + +ok 7, (eval "package qw; sub zyx {1}; 1;" and + not eval "qw::zyx" and + eval "qw:: eq qw||" and + not eval "qw::: >= 0"); + +ok 8, (eval "package qx; sub zyx {1}; 1;" and + not eval "qx::zyx" and + eval "qx:: eq qx||" and + not eval "qx::: >= 0"); + +ok 9, (eval "package s; sub zyx {1}; 1;" and + not eval "s::zyx" and + not eval "s:: eq s||" and + eval "s::: >= 0"); + +ok 10, (eval "package tr; sub zyx {1}; 1;" and + not eval "tr::zyx" and + not eval "tr:: eq tr||" and + eval "tr::: >= 0"); + +ok 11, (eval "package y; sub zyx {1}; 1;" and + not eval "y::zyx" and + not eval "y:: eq y||" and + eval "y::: >= 0"); + +ok 12, (eval "ABC:1" and + not eval "ABC:echo: eq ABC|echo|" and + not eval "ABC:echo:ohce: >= 0"); + +ok 13, (eval "LABEL:1" and + not eval "LABEL:echo: eq LABEL|echo|" and + not eval "LABEL:echo:ohce: >= 0"); + +ok 14, (eval "XYZZY:1" and + not eval "XYZZY:echo: eq XYZZY|echo|" and + not eval "XYZZY:echo:ohce: >= 0"); + +ok 15, (not eval "m:1" and + eval "m:echo: eq m|echo|" and + not eval "m:echo:ohce: >= 0"); + +ok 16, (not eval "q:1" and + eval "q:echo: eq q|echo|" and + not eval "q:echo:ohce: >= 0"); + +ok 17, (not eval "qq:1" and + eval "qq:echo: eq qq|echo|" and + not eval "qq:echo:ohce: >= 0"); + +ok 18, (not eval "qw:1" and + eval "qw:echo: eq qw|echo|" and + not eval "qw:echo:ohce: >= 0"); + +ok 19, (not eval "qx:1" and + eval "qx:echo: eq qx|echo|" and + not eval "qx:echo:ohce: >= 0"); + +ok 20, (not eval "s:1" and + not eval "s:echo: eq s|echo|" and + eval "s:echo:ohce: >= 0"); + +ok 21, (not eval "tr:1" and + not eval "tr:echo: eq tr|echo|" and + eval "tr:echo:ohce: >= 0"); + +ok 22, (not eval "y:1" and + not eval "y:echo: eq y|echo|" and + eval "y:echo:ohce: >= 0"); + +ok 23, (eval "AUTOLOAD:1" and + not eval "AUTOLOAD:echo: eq AUTOLOAD|echo|" and + not eval "AUTOLOAD:echo:ohce: >= 0"); + +ok 24, (eval "and:1" and + not eval "and:echo: eq and|echo|" and + not eval "and:echo:ohce: >= 0"); + +ok 25, (eval "alarm:1" and + not eval "alarm:echo: eq alarm|echo|" and + not eval "alarm:echo:ohce: >= 0"); diff --git a/t/comp/use.t b/t/comp/use.t new file mode 100644 index 0000000..a6ce2a4 --- /dev/null +++ b/t/comp/use.t @@ -0,0 +1,101 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +print "1..14\n"; + +my $i = 1; + +eval "use 5.000;"; +if ($@) { + print STDERR $@,"\n"; + print "not "; +} +print "ok ",$i++,"\n"; + +eval sprintf "use %.5f;", $]; +if ($@) { + print STDERR $@,"\n"; + print "not "; +} +print "ok ",$i++,"\n"; + + +eval sprintf "use %.5f;", $] - 0.000001; +if ($@) { + print STDERR $@,"\n"; + print "not "; +} +print "ok ",$i++,"\n"; + +eval sprintf("use %.5f;", $] + 1); +unless ($@) { + print "not "; +} +print "ok ",$i++,"\n"; + +eval sprintf "use %.5f;", $] + 0.00001; +unless ($@) { + print "not "; +} +print "ok ",$i++,"\n"; + + + +use lib; # I know that this module will be there. + + +local $lib::VERSION = 1.0; + +eval "use lib 0.9"; +if ($@) { + print STDERR $@,"\n"; + print "not "; +} +print "ok ",$i++,"\n"; + +eval "use lib 1.0"; +if ($@) { + print STDERR $@,"\n"; + print "not "; +} +print "ok ",$i++,"\n"; + +eval "use lib 1.01"; +unless ($@) { + print "not "; +} +print "ok ",$i++,"\n"; + + +eval "use lib 0.9 qw(fred)"; +if ($@) { + print STDERR $@,"\n"; + print "not "; +} +print "ok ",$i++,"\n"; + +print "not " unless $INC[0] eq "fred"; +print "ok ",$i++,"\n"; + +eval "use lib 1.0 qw(joe)"; +if ($@) { + print STDERR $@,"\n"; + print "not "; +} +print "ok ",$i++,"\n"; + +print "not " unless $INC[0] eq "joe"; +print "ok ",$i++,"\n"; + +eval "use lib 1.01 qw(freda)"; +unless ($@) { + print "not "; +} +print "ok ",$i++,"\n"; + +print "not " if $INC[0] eq "freda"; +print "ok ",$i++,"\n"; diff --git a/t/op/assignwarn.t b/t/op/assignwarn.t index e69de29..32ee5bb 100755 --- a/t/op/assignwarn.t +++ b/t/op/assignwarn.t @@ -0,0 +1,61 @@ +#!./perl + +# +# Verify which OP= operators warn if their targets are undefined. +# Based on redef.t, contributed by Graham Barr +# -- Robin Barker +# + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +use strict; + +$^W = 1; +my $warn = ""; +$SIG{q(__WARN__)} = sub { print $warn; $warn .= join("",@_) }; + +sub ok { print $_[1] ? "ok " : "not ok ", $_[0], "\n"; } + +sub uninitialized { $warn =~ s/Use of uninitialized value[^\n]+\n//s; } + +print "1..23\n"; + +{ my $x; $x ++; ok 1, ! uninitialized; } +{ my $x; $x --; ok 2, ! uninitialized; } +{ my $x; ++ $x; ok 3, ! uninitialized; } +{ my $x; -- $x; ok 4, ! uninitialized; } + +{ my $x; $x **= 1; ok 5, uninitialized; } + +{ my $x; $x += 1; ok 6, ! uninitialized; } +{ my $x; $x -= 1; ok 7, ! uninitialized; } + +{ my $x; $x .= 1; ok 8, ! uninitialized; } + +{ my $x; $x *= 1; ok 9, uninitialized; } +{ my $x; $x /= 1; ok 10, uninitialized; } +{ my $x; $x %= 1; ok 11, uninitialized; } + +{ my $x; $x x= 1; ok 12, uninitialized; } + +{ my $x; $x &= 1; ok 13, uninitialized; } +{ my $x; $x |= 1; ok 14, ! uninitialized; } +{ my $x; $x ^= 1; ok 15, uninitialized; } + +{ my $x; $x &&= 1; ok 16, ! uninitialized; } +{ my $x; $x ||= 1; ok 17, ! uninitialized; } + +{ my $x; $x <<= 1; ok 18, uninitialized; } +{ my $x; $x >>= 1; ok 19, uninitialized; } + +{ my $x; $x &= "x"; ok 20, uninitialized; } +{ my $x; $x |= "x"; ok 21, ! uninitialized; } +{ my $x; $x ^= "x"; ok 22, uninitialized; } + +ok 23, $warn eq ''; + +# If we got any errors that we were not expecting, then print them +print map "#$_\n", split /\n/, $warn if length $warn; diff --git a/t/op/misc.t b/t/op/misc.t index 5b94e03..6d591c0 100755 --- a/t/op/misc.t +++ b/t/op/misc.t @@ -219,7 +219,7 @@ print "ok\n" if (1E2<<1 == 200 and 3E4<<3 == 240000); EXPECT ok ######## -print "ok\n" if ("\0" cmp "\xFF"); +print "ok\n" if ("\0" lt "\xFF"); EXPECT ok ######## diff --git a/t/op/sysio.t b/t/op/sysio.t index 554fdf5..0f546b2 100755 --- a/t/op/sysio.t +++ b/t/op/sysio.t @@ -168,6 +168,8 @@ close(I); unlink $outfile; +chdir('..'); + 1; # eof diff --git a/t/pragma/locale.t b/t/pragma/locale.t index e69de29..0f71da4 100755 --- a/t/pragma/locale.t +++ b/t/pragma/locale.t @@ -0,0 +1,449 @@ +#!./perl -wT + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +use strict; + +my $have_setlocale = 0; +eval { + require POSIX; + import POSIX ':locale_h'; + $have_setlocale++; +}; + +print "1..", ($have_setlocale ? 104 : 98), "\n"; + +use vars qw($a + $English $German $French $Spanish + @C @English @German @French @Spanish + $Locale @Locale %iLocale %UPPER %lower @Neoalpha); + +$a = 'abc %'; + +sub ok { + my ($n, $result) = @_; + + print 'not ' unless ($result); + print "ok $n\n"; +} + +# First we'll do a lot of taint checking for locales. +# This is the easiest to test, actually, as any locale, +# even the default locale will taint under 'use locale'. + +sub is_tainted { # hello, camel two. + my $dummy; + not eval { $dummy = join("", @_), kill 0; 1 } +} + +sub check_taint ($$) { + ok $_[0], is_tainted($_[1]); +} + +sub check_taint_not ($$) { + ok $_[0], not is_tainted($_[1]); +} + +use locale; # engage locale and therefore locale taint. + +check_taint_not 1, $a; + +check_taint 2, uc($a); +check_taint 3, "\U$a"; +check_taint 4, ucfirst($a); +check_taint 5, "\u$a"; +check_taint 6, lc($a); +check_taint 7, "\L$a"; +check_taint 8, lcfirst($a); +check_taint 9, "\l$a"; + +check_taint 10, sprintf('%e', 123.456); +check_taint 11, sprintf('%f', 123.456); +check_taint 12, sprintf('%g', 123.456); +check_taint_not 13, sprintf('%d', 123.456); +check_taint_not 14, sprintf('%x', 123.456); + +$_ = $a; # untaint $_ + +$_ = uc($a); # taint $_ + +check_taint 15, $_; + +/(\w)/; # taint $&, $`, $', $+, $1. +check_taint 16, $&; +check_taint 17, $`; +check_taint 18, $'; +check_taint 19, $+; +check_taint 20, $1; +check_taint_not 21, $2; + +/(.)/; # untaint $&, $`, $', $+, $1. +check_taint_not 22, $&; +check_taint_not 23, $`; +check_taint_not 24, $'; +check_taint_not 25, $+; +check_taint_not 26, $1; +check_taint_not 27, $2; + +/(\W)/; # taint $&, $`, $', $+, $1. +check_taint 28, $&; +check_taint 29, $`; +check_taint 30, $'; +check_taint 31, $+; +check_taint 32, $1; +check_taint_not 33, $2; + +/(\s)/; # taint $&, $`, $', $+, $1. +check_taint 34, $&; +check_taint 35, $`; +check_taint 36, $'; +check_taint 37, $+; +check_taint 38, $1; +check_taint_not 39, $2; + +/(\S)/; # taint $&, $`, $', $+, $1. +check_taint 40, $&; +check_taint 41, $`; +check_taint 42, $'; +check_taint 43, $+; +check_taint 44, $1; +check_taint_not 45, $2; + +$_ = $a; # untaint $_ + +check_taint_not 46, $_; + +/(b)/; # this must not taint +check_taint_not 47, $&; +check_taint_not 48, $`; +check_taint_not 49, $'; +check_taint_not 50, $+; +check_taint_not 51, $1; +check_taint_not 52, $2; + +$_ = $a; # untaint $_ + +check_taint_not 53, $_; + +$b = uc($a); # taint $b +s/(.+)/$b/; # this must taint only the $_ + +check_taint 54, $_; +check_taint_not 55, $&; +check_taint_not 56, $`; +check_taint_not 57, $'; +check_taint_not 58, $+; +check_taint_not 59, $1; +check_taint_not 60, $2; + +$_ = $a; # untaint $_ + +s/(.+)/b/; # this must not taint +check_taint_not 61, $_; +check_taint_not 62, $&; +check_taint_not 63, $`; +check_taint_not 64, $'; +check_taint_not 65, $+; +check_taint_not 66, $1; +check_taint_not 67, $2; + +$b = $a; # untaint $b + +($b = $a) =~ s/\w/$&/; +check_taint 68, $b; # $b should be tainted. +check_taint_not 69, $a; # $a should be not. + +$_ = $a; # untaint $_ + +s/(\w)/\l$1/; # this must taint +check_taint 70, $_; +check_taint 71, $&; +check_taint 72, $`; +check_taint 73, $'; +check_taint 74, $+; +check_taint 75, $1; +check_taint_not 76, $2; + +$_ = $a; # untaint $_ + +s/(\w)/\L$1/; # this must taint +check_taint 77, $_; +check_taint 78, $&; +check_taint 79, $`; +check_taint 80, $'; +check_taint 81, $+; +check_taint 82, $1; +check_taint_not 83, $2; + +$_ = $a; # untaint $_ + +s/(\w)/\u$1/; # this must taint +check_taint 84, $_; +check_taint 85, $&; +check_taint 86, $`; +check_taint 87, $'; +check_taint 88, $+; +check_taint 89, $1; +check_taint_not 90, $2; + +$_ = $a; # untaint $_ + +s/(\w)/\U$1/; # this must taint +check_taint 91, $_; +check_taint 92, $&; +check_taint 93, $`; +check_taint 94, $'; +check_taint 95, $+; +check_taint 96, $1; +check_taint_not 97, $2; + +# After all this tainting $a should be cool. + +check_taint_not 98, $a; + +# I think we've seen quite enough of taint. +# Let us do some *real* locale work now, +# unless setlocale() is missing (i.e. minitest). + +exit unless $have_setlocale; + +sub getalnum { + sort grep /\w/, map { chr } 0..255 +} + +sub locatelocale ($$@) { + my ($lcall, $alnum, @try) = @_; + + undef $$lcall; + + for (@try) { + local $^W = 0; # suppress "Subroutine LC_ALL redefined" + if (setlocale(&LC_ALL, $_)) { + $$lcall = $_; + @$alnum = &getalnum; + last; + } + } + + @$alnum = () unless (defined $$lcall); +} + +# Find some default locale + +locatelocale(\$Locale, \@Locale, qw(C POSIX)); + +# Find some English locale + +locatelocale(\$English, \@English, + qw(en_US.ISO8859-1 en_GB.ISO8859-1 + en en_US en_UK en_IE en_CA en_AU en_NZ + english english.iso88591 + american american.iso88591 + british british.iso88591 + )); + +# Find some German locale + +locatelocale(\$German, \@German, + qw(de_DE.ISO8859-1 de_AT.ISO8859-1 de_CH.ISO8859-1 + de de_DE de_AT de_CH + german german.iso88591)); + +# Find some French locale + +locatelocale(\$French, \@French, + qw(fr_FR.ISO8859-1 fr_BE.ISO8859-1 fr_CA.ISO8859-1 fr_CH.ISO8859-1 + fr fr_FR fr_BE fr_CA fr_CH + french french.iso88591)); + +# Find some Spanish locale + +locatelocale(\$Spanish, \@Spanish, + qw(es_AR.ISO8859-1 es_BO.ISO8859-1 es_CL.ISO8859-1 + es_CO.ISO8859-1 es_CR.ISO8859-1 es_EC.ISO8859-1 + es_ES.ISO8859-1 es_GT.ISO8859-1 es_MX.ISO8859-1 + es_NI.ISO8859-1 es_PA.ISO8859-1 es_PE.ISO8859-1 + es_PY.ISO8859-1 es_SV.ISO8859-1 es_UY.ISO8859-1 es_VE.ISO8859-1 + es es_AR es_BO es_CL + es_CO es_CR es_EC + es_ES es_GT es_MX + es_NI es_PA es_PE + es_PY es_SV es_UY es_VE + spanish spanish.iso88591)); + +# Select the largest of the alpha(num)bets. + +($Locale, @Locale) = ($English, @English) + if (length(@English) > length(@Locale)); +($Locale, @Locale) = ($German, @German) + if (length(@German) > length(@Locale)); +($Locale, @Locale) = ($French, @French) + if (length(@French) > length(@Locale)); +($Locale, @Locale) = ($Spanish, @Spanish) + if (length(@Spanish) > length(@Locale)); + +print "# Locale = $Locale\n"; +print "# Alnum_ = @Locale\n"; + +{ + local $^W = 0; + setlocale(&LC_ALL, $Locale); +} + +{ + my $i = 0; + + for (@Locale) { + $iLocale{$_} = $i++; + } +} + +# Sieve the uppercase and the lowercase. + +for (@Locale) { + if (/[^\d_]/) { # skip digits and the _ + if (lc eq $_) { + $UPPER{$_} = uc; + } else { + $lower{$_} = lc; + } + } +} + +# Cross-check the upper and the lower. +# Yes, this is broken when the upper<->lower changes the number of +# the glyphs (e.g. the German sharp-s aka double-s aka sz-ligature, +# or the Dutch IJ or the Spanish LL or ...) +# But so far all the implementations do this wrong so we can do it wrong too. + +for (keys %UPPER) { + if (defined $lower{$UPPER{$_}}) { + if ($_ ne $lower{$UPPER{$_}}) { + print 'not '; + last; + } + } +} +print "ok 99\n"; + +for (keys %lower) { + if (defined $UPPER{$lower{$_}}) { + if ($_ ne $UPPER{$lower{$_}}) { + print 'not '; + last; + } + } +} +print "ok 100\n"; + +# Find the alphabets that are not alphabets in the default locale. + +{ + no locale; + + for (keys %UPPER, keys %lower) { + push(@Neoalpha, $_) if (/\W/); + } +} + +@Neoalpha = sort @Neoalpha; + +# Test \w. + +{ + my $word = join('', @Neoalpha); + + $word =~ /^(\w*)$/; + + print 'not ' if ($1 ne $word); +} +print "ok 101\n"; + +# Find places where the collation order differs from the default locale. + +{ + my (@k, $i, $j, @d); + + { + no locale; + + @k = sort (keys %UPPER, keys %lower); + } + + for ($i = 0; $i < @k; $i++) { + for ($j = $i + 1; $j < @k; $j++) { + if ($iLocale{$k[$j]} < $iLocale{$k[$i]}) { + push(@d, [$k[$j], $k[$i]]); + } + } + } + + # Cross-check those places. + + for (@d) { + ($i, $j) = @$_; + if ($i gt $j) { + print "# i = $i, j = $j, i ", + $i le $j ? 'le' : 'gt', " j\n"; + print 'not '; + last; + } + } +} +print "ok 102\n"; + +# Cross-check whole character set. + +for (map { chr } 0..255) { + if (/\w/ and /\W/) { print 'not '; last } + if (/\d/ and /\D/) { print 'not '; last } + if (/\s/ and /\S/) { print 'not '; last } + if (/\w/ and /\D/ and not /_/ and + not (exists $UPPER{$_} or exists $lower{$_})) { + print 'not '; + last; + } +} +print "ok 103\n"; + +# The @Locale should be internally consistent. + +{ + my ($from, $to, , $lesser, $greater); + + for (0..9) { + # Select a slice. + $from = int(($_*@Locale)/10); + $to = $from + int(@Locale/10); + $to = $#Locale if ($to > $#Locale); + $lesser = join('', @Locale[$from..$to]); + # Select a slice one character on. + $from++; $to++; + $to = $#Locale if ($to > $#Locale); + $greater = join('', @Locale[$from..$to]); + if (not ($lesser lt $greater) or + not ($lesser le $greater) or + not ($lesser ne $greater) or + ($lesser eq $greater) or + ($lesser ge $greater) or + ($lesser gt $greater) or + ($greater lt $lesser ) or + ($greater le $lesser ) or + not ($greater ne $lesser ) or + ($greater eq $lesser ) or + not ($greater ge $lesser ) or + not ($greater gt $lesser ) or + # Well, these two are sort of redundant because @Locale + # was derived using cmp. + not (($lesser cmp $greater) == -1) or + not (($greater cmp $lesser ) == 1) + ) { + print 'not '; + last; + } + } +} +print "ok 104\n"; diff --git a/t/pragma/overload.t b/t/pragma/overload.t index e69de29..9c897c3 100755 --- a/t/pragma/overload.t +++ b/t/pragma/overload.t @@ -0,0 +1,345 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; +} + +use Config; + +package Oscalar; +use overload ( + # Anonymous subroutines: +'+' => sub {new Oscalar $ {$_[0]}+$_[1]}, +'-' => sub {new Oscalar + $_[2]? $_[1]-${$_[0]} : ${$_[0]}-$_[1]}, +'<=>' => sub {new Oscalar + $_[2]? $_[1]-${$_[0]} : ${$_[0]}-$_[1]}, +'cmp' => sub {new Oscalar + $_[2]? ($_[1] cmp ${$_[0]}) : (${$_[0]} cmp $_[1])}, +'*' => sub {new Oscalar ${$_[0]}*$_[1]}, +'/' => sub {new Oscalar + $_[2]? $_[1]/${$_[0]} : + ${$_[0]}/$_[1]}, +'%' => sub {new Oscalar + $_[2]? $_[1]%${$_[0]} : ${$_[0]}%$_[1]}, +'**' => sub {new Oscalar + $_[2]? $_[1]**${$_[0]} : ${$_[0]}-$_[1]}, + +qw( +"" stringify +0+ numify) # Order of arguments unsignificant +); + +sub new { + my $foo = $_[1]; + bless \$foo, $_[0]; +} + +sub stringify { "${$_[0]}" } +sub numify { 0 + "${$_[0]}" } # Not needed, additional overhead + # comparing to direct compilation based on + # stringify + +package main; + +$test = 0; +$| = 1; +print "1..",&last,"\n"; + +sub test { + $test++; if (shift) {print "ok $test\n";1} else {print "not ok $test\n";0} +} + +$a = new Oscalar "087"; +$b= "$a"; + +# All test numbers in comments are off by 1. +# So much for hard-wiring them in :-) To fix this: +test(1); # 1 + +test ($b eq $a); # 2 +test ($b eq "087"); # 3 +test (ref $a eq "Oscalar"); # 4 +test ($a eq $a); # 5 +test ($a eq "087"); # 6 + +$c = $a + 7; + +test (ref $c eq "Oscalar"); # 7 +test (!($c eq $a)); # 8 +test ($c eq "94"); # 9 + +$b=$a; + +test (ref $a eq "Oscalar"); # 10 + +$b++; + +test (ref $b eq "Oscalar"); # 11 +test ( $a eq "087"); # 12 +test ( $b eq "88"); # 13 +test (ref $a eq "Oscalar"); # 14 + +$c=$b; +$c-=$a; + +test (ref $c eq "Oscalar"); # 15 +test ( $a eq "087"); # 16 +test ( $c eq "1"); # 17 +test (ref $a eq "Oscalar"); # 18 + +$b=1; +$b+=$a; + +test (ref $b eq "Oscalar"); # 19 +test ( $a eq "087"); # 20 +test ( $b eq "88"); # 21 +test (ref $a eq "Oscalar"); # 22 + +eval q[ package Oscalar; use overload ('++' => sub { $ {$_[0]}++;$_[0] } ) ]; + +$b=$a; + +test (ref $a eq "Oscalar"); # 23 + +$b++; + +test (ref $b eq "Oscalar"); # 24 +test ( $a eq "087"); # 25 +test ( $b eq "88"); # 26 +test (ref $a eq "Oscalar"); # 27 + +package Oscalar; +$dummy=bless \$dummy; # Now cache of method should be reloaded +package main; + +$b=$a; +$b++; + +test (ref $b eq "Oscalar"); # 28 +test ( $a eq "087"); # 29 +test ( $b eq "88"); # 30 +test (ref $a eq "Oscalar"); # 31 + + +eval q[package Oscalar; use overload ('++' => sub { $ {$_[0]} += 2; $_[0] } ) ]; + +$b=$a; + +test (ref $a eq "Oscalar"); # 32 + +$b++; + +test (ref $b eq "Oscalar"); # 33 +test ( $a eq "087"); # 34 +test ( $b eq "88"); # 35 +test (ref $a eq "Oscalar"); # 36 + +package Oscalar; +$dummy=bless \$dummy; # Now cache of method should be reloaded +package main; + +$b++; + +test (ref $b eq "Oscalar"); # 37 +test ( $a eq "087"); # 38 +test ( $b eq "90"); # 39 +test (ref $a eq "Oscalar"); # 40 + +$b=$a; +$b++; + +test (ref $b eq "Oscalar"); # 41 +test ( $a eq "087"); # 42 +test ( $b eq "89"); # 43 +test (ref $a eq "Oscalar"); # 44 + + +test ($b? 1:0); # 45 + +eval q[ package Oscalar; use overload ('=' => sub {$main::copies++; + package Oscalar; + local $new=$ {$_[0]}; + bless \$new } ) ]; + +$b=new Oscalar "$a"; + +test (ref $b eq "Oscalar"); # 46 +test ( $a eq "087"); # 47 +test ( $b eq "087"); # 48 +test (ref $a eq "Oscalar"); # 49 + +$b++; + +test (ref $b eq "Oscalar"); # 50 +test ( $a eq "087"); # 51 +test ( $b eq "89"); # 52 +test (ref $a eq "Oscalar"); # 53 +test ($copies == 0); # 54 + +$b+=1; + +test (ref $b eq "Oscalar"); # 55 +test ( $a eq "087"); # 56 +test ( $b eq "90"); # 57 +test (ref $a eq "Oscalar"); # 58 +test ($copies == 0); # 59 + +$b=$a; +$b+=1; + +test (ref $b eq "Oscalar"); # 60 +test ( $a eq "087"); # 61 +test ( $b eq "88"); # 62 +test (ref $a eq "Oscalar"); # 63 +test ($copies == 0); # 64 + +$b=$a; +$b++; + +test (ref $b eq "Oscalar") || print ref $b,"=ref(b)\n"; # 65 +test ( $a eq "087"); # 66 +test ( $b eq "89"); # 67 +test (ref $a eq "Oscalar"); # 68 +test ($copies == 1); # 69 + +eval q[package Oscalar; use overload ('+=' => sub {$ {$_[0]} += 3*$_[1]; + $_[0] } ) ]; +$c=new Oscalar; # Cause rehash + +$b=$a; +$b+=1; + +test (ref $b eq "Oscalar"); # 70 +test ( $a eq "087"); # 71 +test ( $b eq "90"); # 72 +test (ref $a eq "Oscalar"); # 73 +test ($copies == 2); # 74 + +$b+=$b; + +test (ref $b eq "Oscalar"); # 75 +test ( $b eq "360"); # 76 +test ($copies == 2); # 77 +$b=-$b; + +test (ref $b eq "Oscalar"); # 78 +test ( $b eq "-360"); # 79 +test ($copies == 2); # 80 + +$b=abs($b); + +test (ref $b eq "Oscalar"); # 81 +test ( $b eq "360"); # 82 +test ($copies == 2); # 83 + +$b=abs($b); + +test (ref $b eq "Oscalar"); # 84 +test ( $b eq "360"); # 85 +test ($copies == 2); # 86 + +eval q[package Oscalar; + use overload ('x' => sub {new Oscalar ( $_[2] ? "_.$_[1]._" x $ {$_[0]} + : "_.${$_[0]}._" x $_[1])}) ]; + +$a=new Oscalar "yy"; +$a x= 3; +test ($a eq "_.yy.__.yy.__.yy._"); # 87 + +eval q[package Oscalar; + use overload ('.' => sub {new Oscalar ( $_[2] ? + "_.$_[1].__.$ {$_[0]}._" + : "_.$ {$_[0]}.__.$_[1]._")}) ]; + +$a=new Oscalar "xx"; + +test ("b${a}c" eq "_._.b.__.xx._.__.c._"); # 88 + +# Check inheritance of overloading; +{ + package OscalarI; + @ISA = 'Oscalar'; +} + +$aI = new OscalarI "$a"; +test (ref $aI eq "OscalarI"); # 89 +test ("$aI" eq "xx"); # 90 +test ($aI eq "xx"); # 91 +test ("b${aI}c" eq "_._.b.__.xx._.__.c._"); # 92 + +# Here we test blessing to a package updates hash + +eval "package Oscalar; no overload '.'"; + +test ("b${a}" eq "_.b.__.xx._"); # 93 +$x="1"; +bless \$x, Oscalar; +test ("b${a}c" eq "bxxc"); # 94 +new Oscalar 1; +test ("b${a}c" eq "bxxc"); # 95 + +# Negative overloading: + +$na = eval { ~$a }; +test($@ =~ /no method found/); # 96 + +# Check AUTOLOADING: + +*Oscalar::AUTOLOAD = + sub { *{"Oscalar::$AUTOLOAD"} = sub {"_!_" . shift() . "_!_"} ; + goto &{"Oscalar::$AUTOLOAD"}}; + +eval "package Oscalar; use overload '~' => 'comple'"; + +$na = eval { ~$a }; # Hash was not updated +test($@ =~ /no method found/); # 97 + +bless \$x, Oscalar; + +$na = eval { ~$a }; # Hash updated +test !$@; # 98 +test($na eq '_!_xx_!_'); # 99 + +$na = 0; + +$na = eval { ~$aI }; # Hash was not updated +test($@ =~ /no method found/); # 100 + +bless \$x, OscalarI; + +$na = eval { ~$aI }; +print $@; + +test !$@; # 101 +test($na eq '_!_xx_!_'); # 102 + +eval "package Oscalar; use overload '>>' => 'rshft'"; + +$na = eval { $aI >> 1 }; # Hash was not updated +test($@ =~ /no method found/); # 103 + +bless \$x, OscalarI; + +$na = 0; + +$na = eval { $aI >> 1 }; +print $@; + +test !$@; # 104 +test($na eq '_!_xx_!_'); # 105 + +test (overload::Method($a, '0+') eq \&Oscalar::numify); # 106 +test (overload::Method($aI,'0+') eq \&Oscalar::numify); # 107 +test (overload::Overloaded($aI)); # 108 +test (!overload::Overloaded('overload')); # 109 + +test (! defined overload::Method($aI, '<<')); # 110 +test (! defined overload::Method($a, '<')); # 111 + +test (overload::StrVal($aI) =~ /^OscalarI=SCALAR\(0x[\da-fA-F]+\)$/); # 112 +test (overload::StrVal(\$aI) eq "@{[\$aI]}"); # 113 + +# Last test is: +sub last {113} diff --git a/t/pragma/strict-refs b/t/pragma/strict-refs new file mode 100644 index 0000000..6d36ff8 --- /dev/null +++ b/t/pragma/strict-refs @@ -0,0 +1,279 @@ +Check strict refs functionality + +__END__ + +# no strict, should build & run ok. +my $fred ; +$b = "fred" ; +$a = $$b ; +$c = ${"def"} ; +$c = @{"def"} ; +$c = %{"def"} ; +$c = *{"def"} ; +$c = \&{"def"} ; +EXPECT + +######## + +# strict refs - error +use strict ; +my $fred ; +my $a = ${"fred"} ; +EXPECT +Can't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 5. +######## + +# strict refs - error +use strict 'refs' ; +my $fred ; +my $a = ${"fred"} ; +EXPECT +Can't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 5. +######## + +# strict refs - error +use strict 'refs' ; +my $fred ; +my $b = "fred" ; +my $a = $$b ; +EXPECT +Can't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 6. +######## + +# strict refs - error +use strict 'refs' ; +my $b ; +my $a = $$b ; +EXPECT +Can't use an undefined value as a SCALAR reference at - line 5. +######## + +# strict refs - error +use strict 'refs' ; +my $b ; +my $a = @$b ; +EXPECT +Can't use an undefined value as an ARRAY reference at - line 5. +######## + +# strict refs - error +use strict 'refs' ; +my $b ; +my $a = %$b ; +EXPECT +Can't use an undefined value as a HASH reference at - line 5. +######## + +# strict refs - error +use strict 'refs' ; +my $b ; +my $a = *$b ; +EXPECT +Can't use an undefined value as a symbol reference at - line 5. +######## + +# strict refs - no error +use strict ; +no strict 'refs' ; +my $fred ; +my $b = "fred" ; +my $a = $$b ; +use strict 'refs' ; +EXPECT + +######## + +# strict refs - no error +use strict qw(subs vars) ; +my $fred ; +my $b = "fred" ; +my $a = $$b ; +use strict 'refs' ; +EXPECT + +######## + +# strict refs - no error +my $fred ; +my $b = "fred" ; +my $a = $$b ; +use strict 'refs' ; +EXPECT + +######## + +# strict refs - no error +use strict 'refs' ; +my $fred ; +my $b = \$fred ; +my $a = $$b ; +EXPECT + +######## + +# Check runtime scope of strict refs pragma +use strict 'refs'; +my $fred ; +my $b = "fred" ; +{ + no strict ; + my $a = $$b ; +} +my $a = $$b ; +EXPECT +Can't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 10. +######## + +# Check runtime scope of strict refs pragma +no strict ; +my $fred ; +my $b = "fred" ; +{ + use strict 'refs' ; + my $a = $$b ; +} +my $a = $$b ; +EXPECT +Can't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 8. +######## + +# Check runtime scope of strict refs pragma +no strict ; +my $fred ; +my $b = "fred" ; +{ + use strict 'refs' ; + $a = sub { my $c = $$b ; } +} +&$a ; +EXPECT +Can't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 8. +######## + + +--FILE-- abc +my $a = ${"Fred"} ; +1; +--FILE-- +use strict 'refs' ; +require "./abc"; +EXPECT + +######## + +--FILE-- abc +use strict 'refs' ; +1; +--FILE-- +require "./abc"; +my $a = ${"Fred"} ; +EXPECT + +######## + +--FILE-- abc +use strict 'refs' ; +my $a = ${"Fred"} ; +1; +--FILE-- +${"Fred"} ; +require "./abc"; +EXPECT +Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at ./abc line 2. +######## + +--FILE-- abc.pm +use strict 'refs' ; +my $a = ${"Fred"} ; +1; +--FILE-- +my $a = ${"Fred"} ; +use abc; +EXPECT +Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at abc.pm line 2. +BEGIN failed--compilation aborted at - line 2. +######## + +# Check scope of pragma with eval +no strict ; +eval { + my $a = ${"Fred"} ; +}; +print STDERR $@ ; +my $a = ${"Fred"} ; +EXPECT + +######## + +# Check scope of pragma with eval +no strict ; +eval { + use strict 'refs' ; + my $a = ${"Fred"} ; +}; +print STDERR $@ ; +my $a = ${"Fred"} ; +EXPECT +Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at - line 6. +######## + +# Check scope of pragma with eval +use strict 'refs' ; +eval { + my $a = ${"Fred"} ; +}; +print STDERR $@ ; +EXPECT +Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at - line 5. +######## + +# Check scope of pragma with eval +use strict 'refs' ; +eval { + no strict ; + my $a = ${"Fred"} ; +}; +print STDERR $@ ; +my $a = ${"Fred"} ; +EXPECT +Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at - line 9. +######## + +# Check scope of pragma with eval +no strict ; +eval ' + my $a = ${"Fred"} ; +'; print STDERR $@ ; +my $a = ${"Fred"} ; +EXPECT + +######## + +# Check scope of pragma with eval +no strict ; +eval q[ + use strict 'refs' ; + my $a = ${"Fred"} ; +]; print STDERR $@; +EXPECT +Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at (eval 1) line 3. +######## + +# Check scope of pragma with eval +use strict 'refs' ; +eval ' + my $a = ${"Fred"} ; +'; print STDERR $@ ; +EXPECT +Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at (eval 1) line 2. +######## + +# Check scope of pragma with eval +use strict 'refs' ; +eval ' + no strict ; + my $a = ${"Fred"} ; +'; print STDERR $@; +my $a = ${"Fred"} ; +EXPECT +Can't use string ("Fred") as a SCALAR ref while "strict refs" in use at - line 8. diff --git a/t/pragma/strict-subs b/t/pragma/strict-subs new file mode 100644 index 0000000..6864a3a --- /dev/null +++ b/t/pragma/strict-subs @@ -0,0 +1,279 @@ +Check strict subs functionality + +__END__ + +# no strict, should build & run ok. +Fred ; +my $fred ; +$b = "fred" ; +$a = $$b ; +EXPECT + +######## + +use strict qw(refs vars); +Fred ; +EXPECT + +######## + +use strict ; +no strict 'subs' ; +Fred ; +EXPECT + +######## + +# strict subs - error +use strict 'subs' ; +Fred ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at - line 4. +Execution of - aborted due to compilation errors. +######## + +# strict subs - error +use strict ; +Fred ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at - line 4. +Execution of - aborted due to compilation errors. +######## + +# strict subs - no error +use strict 'subs' ; +sub Fred {} +Fred ; +EXPECT + +######## + +# Check compile time scope of strict subs pragma +use strict 'subs' ; +{ + no strict ; + my $a = Fred ; +} +my $a = Fred ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at - line 8. +Execution of - aborted due to compilation errors. +######## + +# Check compile time scope of strict subs pragma +no strict; +{ + use strict 'subs' ; + my $a = Fred ; +} +my $a = Fred ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at - line 6. +Execution of - aborted due to compilation errors. +######## + +# Check compile time scope of strict vars pragma +use strict 'vars' ; +{ + no strict ; + $joe = 1 ; +} +$joe = 1 ; +EXPECT +Variable "$joe" is not imported at - line 8. +Global symbol "joe" requires explicit package name at - line 8. +Execution of - aborted due to compilation errors. +######## + +# Check compile time scope of strict vars pragma +no strict; +{ + use strict 'vars' ; + $joe = 1 ; +} +$joe = 1 ; +EXPECT +Global symbol "joe" requires explicit package name at - line 6. +Execution of - aborted due to compilation errors. +######## + +# Check runtime scope of strict refs pragma +use strict 'refs'; +my $fred ; +my $b = "fred" ; +{ + no strict ; + my $a = $$b ; +} +my $a = $$b ; +EXPECT +Can't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 10. +######## + +# Check runtime scope of strict refs pragma +no strict ; +my $fred ; +my $b = "fred" ; +{ + use strict 'refs' ; + my $a = $$b ; +} +my $a = $$b ; +EXPECT +Can't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 8. +######## + +# Check runtime scope of strict refs pragma +no strict ; +my $fred ; +my $b = "fred" ; +{ + use strict 'refs' ; + $a = sub { my $c = $$b ; } +} +&$a ; +EXPECT +Can't use string ("fred") as a SCALAR ref while "strict refs" in use at - line 8. +######## + +use strict 'subs' ; +my $a = Fred ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at - line 3. +Execution of - aborted due to compilation errors. +######## + +--FILE-- abc +my $a = Fred ; +1; +--FILE-- +use strict 'subs' ; +require "./abc"; +EXPECT + +######## + +--FILE-- abc +use strict 'subs' ; +1; +--FILE-- +require "./abc"; +my $a = Fred ; +EXPECT + +######## + +--FILE-- abc +use strict 'subs' ; +my $a = Fred ; +1; +--FILE-- +Fred ; +require "./abc"; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at ./abc line 2. + at - line 2. +######## + +--FILE-- abc.pm +use strict 'subs' ; +my $a = Fred ; +1; +--FILE-- +Fred ; +use abc; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at abc.pm line 2. + at - line 2. +BEGIN failed--compilation aborted at - line 2. +######## + +# Check scope of pragma with eval +no strict ; +eval { + my $a = Fred ; +}; +print STDERR $@; +my $a = Fred ; +EXPECT + +######## + +# Check scope of pragma with eval +no strict ; +eval { + use strict 'subs' ; + my $a = Fred ; +}; +print STDERR $@; +my $a = Fred ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at - line 6. +Execution of - aborted due to compilation errors. +######## + +# Check scope of pragma with eval +use strict 'subs' ; +eval { + my $a = Fred ; +}; +print STDERR $@; +my $a = Fred ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at - line 5. +Bareword "Fred" not allowed while "strict subs" in use at - line 8. +Execution of - aborted due to compilation errors. +######## + +# Check scope of pragma with eval +use strict 'subs' ; +eval { + no strict ; + my $a = Fred ; +}; +print STDERR $@; +my $a = Fred ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at - line 9. +Execution of - aborted due to compilation errors. +######## + +# Check scope of pragma with eval +no strict ; +eval ' + Fred ; +'; print STDERR $@ ; +Fred ; +EXPECT + +######## + +# Check scope of pragma with eval +no strict ; +eval q[ + use strict 'subs' ; + Fred ; +]; print STDERR $@; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at (eval 1) line 3. +######## + +# Check scope of pragma with eval +use strict 'subs' ; +eval ' + Fred ; +'; print STDERR $@ ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at (eval 1) line 2. +######## + +# Check scope of pragma with eval +use strict 'subs' ; +eval ' + no strict ; + my $a = Fred ; +'; print STDERR $@; +my $a = Fred ; +EXPECT +Bareword "Fred" not allowed while "strict subs" in use at - line 8. +Execution of - aborted due to compilation errors. diff --git a/t/pragma/strict-vars b/t/pragma/strict-vars new file mode 100644 index 0000000..727eb2d --- /dev/null +++ b/t/pragma/strict-vars @@ -0,0 +1,225 @@ +Check strict vars functionality + +__END__ + +# no strict, should build & run ok. +Fred ; +my $fred ; +$b = "fred" ; +$a = $$b ; +EXPECT + +######## + +use strict qw(subs refs) ; +$fred ; +EXPECT + +######## + +use strict ; +no strict 'vars' ; +$fred ; +EXPECT + +######## + +# strict vars - no error +use strict 'vars' ; +use vars qw( $freddy) ; +local $abc::joe ; +my $fred ; +my $b = \$fred ; +$Fred::ABC = 1 ; +$freddy = 2 ; +EXPECT + +######## + +# strict vars - error +use strict ; +$fred ; +EXPECT +Global symbol "fred" requires explicit package name at - line 4. +Execution of - aborted due to compilation errors. +######## + +# strict vars - error +use strict 'vars' ; +$fred ; +EXPECT +Global symbol "fred" requires explicit package name at - line 4. +Execution of - aborted due to compilation errors. +######## + +# strict vars - error +use strict 'vars' ; +local $fred ; +EXPECT +Global symbol "fred" requires explicit package name at - line 4. +Execution of - aborted due to compilation errors. +######## + +# Check compile time scope of strict vars pragma +use strict 'vars' ; +{ + no strict ; + $joe = 1 ; +} +$joe = 1 ; +EXPECT +Variable "$joe" is not imported at - line 8. +Global symbol "joe" requires explicit package name at - line 8. +Execution of - aborted due to compilation errors. +######## + +# Check compile time scope of strict vars pragma +no strict; +{ + use strict 'vars' ; + $joe = 1 ; +} +$joe = 1 ; +EXPECT +Global symbol "joe" requires explicit package name at - line 6. +Execution of - aborted due to compilation errors. +######## + +--FILE-- abc +$joe = 1 ; +1; +--FILE-- +use strict 'vars' ; +require "./abc"; +EXPECT + +######## + +--FILE-- abc +use strict 'vars' ; +1; +--FILE-- +require "./abc"; +$joe = 1 ; +EXPECT + +######## + +--FILE-- abc +use strict 'vars' ; +$joe = 1 ; +1; +--FILE-- +$joe = 1 ; +require "./abc"; +EXPECT +Variable "$joe" is not imported at ./abc line 2. +Global symbol "joe" requires explicit package name at ./abc line 2. + at - line 2. +######## + +--FILE-- abc.pm +use strict 'vars' ; +$joe = 1 ; +1; +--FILE-- +$joe = 1 ; +use abc; +EXPECT +Variable "$joe" is not imported at abc.pm line 2. +Global symbol "joe" requires explicit package name at abc.pm line 2. + at - line 2. +BEGIN failed--compilation aborted at - line 2. +######## + +# Check scope of pragma with eval +no strict ; +eval { + $joe = 1 ; +}; +print STDERR $@; +$joe = 1 ; +EXPECT + +######## + +# Check scope of pragma with eval +no strict ; +eval { + use strict 'vars' ; + $joe = 1 ; +}; +print STDERR $@; +$joe = 1 ; +EXPECT +Global symbol "joe" requires explicit package name at - line 6. +Execution of - aborted due to compilation errors. +######## + +# Check scope of pragma with eval +use strict 'vars' ; +eval { + $joe = 1 ; +}; +print STDERR $@; +$joe = 1 ; +EXPECT +Global symbol "joe" requires explicit package name at - line 5. +Variable "$joe" is not imported at - line 8. +Global symbol "joe" requires explicit package name at - line 8. +Execution of - aborted due to compilation errors. +######## + +# Check scope of pragma with eval +use strict 'vars' ; +eval { + no strict ; + $joe = 1 ; +}; +print STDERR $@; +$joe = 1 ; +EXPECT +Variable "$joe" is not imported at - line 9. +Global symbol "joe" requires explicit package name at - line 9. +Execution of - aborted due to compilation errors. +######## + +# Check scope of pragma with eval +no strict ; +eval ' + $joe = 1 ; +'; print STDERR $@ ; +$joe = 1 ; +EXPECT + +######## + +# Check scope of pragma with eval +no strict ; +eval q[ + use strict 'vars' ; + $joe = 1 ; +]; print STDERR $@; +EXPECT +Global symbol "joe" requires explicit package name at (eval 1) line 3. +######## + +# Check scope of pragma with eval +use strict 'vars' ; +eval ' + $joe = 1 ; +'; print STDERR $@ ; +EXPECT +Global symbol "joe" requires explicit package name at (eval 1) line 2. +######## + +# Check scope of pragma with eval +use strict 'vars' ; +eval ' + no strict ; + $joe = 1 ; +'; print STDERR $@; +$joe = 1 ; +EXPECT +Global symbol "joe" requires explicit package name at - line 8. +Execution of - aborted due to compilation errors. diff --git a/t/pragma/strict.t b/t/pragma/strict.t index e69de29..bf90266 100755 --- a/t/pragma/strict.t +++ b/t/pragma/strict.t @@ -0,0 +1,82 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + $ENV{PERL5LIB} = '../lib'; +} + +$| = 1; + +my $tmpfile = "tmp0000"; +my $i = 0 ; +1 while -f ++$tmpfile; +END { unlink $tmpfile if $tmpfile; } + +my @prgs = () ; + +foreach (sort glob("pragma/strict-*")) { + + open F, "<$_" or die "Cannot open $_: $!\n" ; + while () { + last if /^__END__/ ; + } + + { + local $/ = undef; + @prgs = (@prgs, split "\n########\n", ) ; + } + close F ; +} + +undef $/; + +print "1..", scalar @prgs, "\n"; + + +for (@prgs){ + my $switch = ""; + my @temps = () ; + if (s/^\s*-\w+//){ + $switch = $&; + } + my($prog,$expected) = split(/\nEXPECT\n/, $_); + if ( $prog =~ /--FILE--/) { + my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ; + shift @files ; + die "Internal error test $i didn't split into pairs, got " . + scalar(@files) . "[" . join("%%%%", @files) ."]\n" + if @files % 2 ; + while (@files > 2) { + my $filename = shift @files ; + my $code = shift @files ; + push @temps, $filename ; + open F, ">$filename" or die "Cannot open $filename: $!\n" ; + print F $code ; + close F ; + } + shift @files ; + $prog = shift @files ; + } + open TEST, "| sh -c './perl $switch' >$tmpfile 2>&1"; + print TEST $prog, "\n"; + close TEST; + my $status = $?; + my $results = `cat $tmpfile`; + $results =~ s/\n+$//; + $expected =~ s/\n+$//; + my $prefix = ($results =~ s/^PREFIX\n//) ; + if ( $results =~ s/^SKIPPED\n//) { + print "$results\n" ; + } + elsif (($prefix and $results !~ /^\Q$expected/) or + (!$prefix and $results ne $expected)){ + print STDERR "PROG: $switch\n$prog\n"; + print STDERR "EXPECTED:\n$expected\n"; + print STDERR "GOT:\n$results\n"; + print "not "; + } + print "ok ", ++$i, "\n"; + foreach (@temps) + { unlink $_ if $_ } +} diff --git a/t/pragma/subs.t b/t/pragma/subs.t index e69de29..cf936d2 100755 --- a/t/pragma/subs.t +++ b/t/pragma/subs.t @@ -0,0 +1,123 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + $ENV{PERL5LIB} = '../lib'; +} + +$| = 1; +undef $/; +my @prgs = split "\n########\n", ; +print "1..", scalar @prgs, "\n"; + +my $tmpfile = "tmp0000"; +my $i = 0 ; +1 while -f ++$tmpfile; +END { unlink $tmpfile if $tmpfile; } + +for (@prgs){ + my $switch = ""; + my @temps = () ; + if (s/^\s*-\w+//){ + $switch = $&; + } + my($prog,$expected) = split(/\nEXPECT\n/, $_); + if ( $prog =~ /--FILE--/) { + my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ; + shift @files ; + die "Internal error test $i didn't split into pairs, got " . + scalar(@files) . "[" . join("%%%%", @files) ."]\n" + if @files % 2 ; + while (@files > 2) { + my $filename = shift @files ; + my $code = shift @files ; + push @temps, $filename ; + open F, ">$filename" or die "Cannot open $filename: $!\n" ; + print F $code ; + close F ; + } + shift @files ; + $prog = shift @files ; + } + open TEST, "| sh -c './perl $switch' >$tmpfile 2>&1"; + print TEST $prog, "\n"; + close TEST; + my $status = $?; + my $results = `cat $tmpfile`; + $results =~ s/\n+$//; + $expected =~ s/\n+$//; + my $prefix = ($results =~ s/^PREFIX\n//) ; + if ( $results =~ s/^SKIPPED\n//) { + print "$results\n" ; + } + elsif (($prefix and $results !~ /^\Q$expected/) or + (!$prefix and $results ne $expected)){ + print STDERR "PROG: $switch\n$prog\n"; + print STDERR "EXPECTED:\n$expected\n"; + print STDERR "GOT:\n$results\n"; + print "not "; + } + print "ok ", ++$i, "\n"; + foreach (@temps) + { unlink $_ if $_ } +} + +__END__ + +# Error - not predeclaring a sub +Fred 1,2 ; +sub Fred {} +EXPECT +Number found where operator expected at - line 3, near "Fred 1" + (Do you need to predeclare Fred?) +syntax error at - line 3, near "Fred 1" +Execution of - aborted due to compilation errors. +######## + +# Error - not predeclaring a sub in time +Fred 1,2 ; +use subs qw( Fred ) ; +sub Fred {} +EXPECT +Number found where operator expected at - line 3, near "Fred 1" + (Do you need to predeclare Fred?) +syntax error at - line 3, near "Fred 1" +Execution of - aborted due to compilation errors. +######## + +# AOK +use subs qw( Fred) ; +Fred 1,2 ; +sub Fred { print $_[0] + $_[1], "\n" } +EXPECT +3 +######## + +# override a built-in function +use subs qw( open ) ; +open 1,2 ; +sub open { print $_[0] + $_[1], "\n" } +EXPECT +3 +######## + +--FILE-- abc +Fred 1,2 ; +1; +--FILE-- +use subs qw( Fred ) ; +require "./abc" ; +sub Fred { print $_[0] + $_[1], "\n" } +EXPECT +3 +######## + +# check that it isn't affected by block scope +{ + use subs qw( Fred ) ; +} +Fred 1, 2; +sub Fred { print $_[0] + $_[1], "\n" } +EXPECT +3 diff --git a/t/pragma/warn-global b/t/pragma/warn-global new file mode 100644 index 0000000..3325273 --- /dev/null +++ b/t/pragma/warn-global @@ -0,0 +1,146 @@ +Check existing $^W functionality + +__END__ + +# warnable code, warnings disabled +$a =+ 3 ; +EXPECT + +######## +-w +# warnable code, warnings enabled via command line switch +$a =+ 3 ; +EXPECT +Reversed += operator at - line 3. +######## +#! perl -w +# warnable code, warnings enabled via #! line +$a =+ 3 ; +EXPECT +Reversed += operator at - line 3. +######## + +# warnable code, warnings enabled via compile time $^W +BEGIN { $^W = 1 } +$a =+ 3 ; +EXPECT +Reversed += operator at - line 4. +######## + +# compile-time warnable code, warnings enabled via runtime $^W +# so no warning printed. +$^W = 1 ; +$a =+ 3 ; +EXPECT + +######## + +# warnable code, warnings enabled via runtime $^W +$^W = 1 ; +my $b ; chop $b ; +EXPECT +Use of uninitialized value at - line 4. +######## + +# warnings enabled at compile time, disabled at run time +BEGIN { $^W = 1 } +$^W = 0 ; +my $b ; chop $b ; +EXPECT + +######## + +# warnings disabled at compile time, enabled at run time +BEGIN { $^W = 0 } +$^W = 1 ; +my $b ; chop $b ; +EXPECT +Use of uninitialized value at - line 5. +######## +-w +--FILE-- abcd +my $b ; chop $b ; +1 ; +--FILE-- +require "./abcd"; +EXPECT +Use of uninitialized value at ./abcd line 1. +######## + +--FILE-- abcd +my $b ; chop $b ; +1 ; +--FILE-- +#! perl -w +require "./abcd"; +EXPECT +Use of uninitialized value at ./abcd line 1. +######## + +--FILE-- abcd +my $b ; chop $b ; +1 ; +--FILE-- +$^W =1 ; +require "./abcd"; +EXPECT +Use of uninitialized value at ./abcd line 1. +######## + +--FILE-- abcd +$^W = 0; +my $b ; chop $b ; +1 ; +--FILE-- +$^W =1 ; +require "./abcd"; +EXPECT + +######## + +--FILE-- abcd +$^W = 1; +1 ; +--FILE-- +$^W =0 ; +require "./abcd"; +my $b ; chop $b ; +EXPECT +Use of uninitialized value at - line 3. +######## + +$^W = 1; +eval "my $b ; chop $b ;" ; +EXPECT +Use of uninitialized value at - line 3. +Use of uninitialized value at - line 3. +######## + +eval "$^W = 1;" ; +my $b ; chop $b ; +EXPECT + +######## + +eval {$^W = 1;} ; +my $b ; chop $b ; +EXPECT +Use of uninitialized value at - line 3. +######## + +{ + local ($^W) = 1; +} +my $b ; chop $b ; +EXPECT + +######## + +my $a ; chop $a ; +{ + local ($^W) = 1; + my $b ; chop $b ; +} +my $c ; chop $c ; +EXPECT +Use of uninitialized value at - line 5. diff --git a/t/pragma/warning.t b/t/pragma/warning.t index e69de29..c197f35 100755 --- a/t/pragma/warning.t +++ b/t/pragma/warning.t @@ -0,0 +1,82 @@ +#!./perl + +BEGIN { + chdir 't' if -d 't'; + @INC = '../lib'; + $ENV{PERL5LIB} = '../lib'; +} + +$| = 1; + +my $tmpfile = "tmp0000"; +my $i = 0 ; +1 while -f ++$tmpfile; +END { unlink $tmpfile if $tmpfile; } + +my @prgs = () ; + +foreach (sort glob("pragma/warn-*")) { + + open F, "<$_" or die "Cannot open $_: $!\n" ; + while () { + last if /^__END__/ ; + } + + { + local $/ = undef; + @prgs = (@prgs, split "\n########\n", ) ; + } + close F ; +} + +undef $/; + +print "1..", scalar @prgs, "\n"; + + +for (@prgs){ + my $switch = ""; + my @temps = () ; + if (s/^\s*-\w+//){ + $switch = $&; + } + my($prog,$expected) = split(/\nEXPECT\n/, $_); + if ( $prog =~ /--FILE--/) { + my(@files) = split(/\n--FILE--\s*([^\s\n]*)\s*\n/, $prog) ; + shift @files ; + die "Internal error test $i didn't split into pairs, got " . + scalar(@files) . "[" . join("%%%%", @files) ."]\n" + if @files % 2 ; + while (@files > 2) { + my $filename = shift @files ; + my $code = shift @files ; + push @temps, $filename ; + open F, ">$filename" or die "Cannot open $filename: $!\n" ; + print F $code ; + close F ; + } + shift @files ; + $prog = shift @files ; + } + open TEST, "| sh -c './perl $switch' >$tmpfile 2>&1"; + print TEST $prog, "\n"; + close TEST; + my $status = $?; + my $results = `cat $tmpfile`; + $results =~ s/\n+$//; + $expected =~ s/\n+$//; + my $prefix = ($results =~ s/^PREFIX\n//) ; + if ( $results =~ s/^SKIPPED\n//) { + print "$results\n" ; + } + elsif (($prefix and $results !~ /^\Q$expected/) or + (!$prefix and $results ne $expected)){ + print STDERR "PROG: $switch\n$prog\n"; + print STDERR "EXPECTED:\n$expected\n"; + print STDERR "GOT:\n$results\n"; + print "not "; + } + print "ok ", ++$i, "\n"; + foreach (@temps) + { unlink $_ if $_ } +} diff --git a/toke.c b/toke.c index 913368a..5d53fb3 100644 --- a/toke.c +++ b/toke.c @@ -1013,7 +1013,7 @@ GV *gv; if (gv) { if (GvIO(gv)) return 0; - if (!GvCV(gv)) + if (!GvCVu(gv)) gv = 0; } s = scan_word(s, tmpbuf, TRUE, &len); @@ -1027,7 +1027,7 @@ GV *gv; } if (!keyword(tmpbuf, len)) { indirgv = gv_fetchpv(tmpbuf,FALSE, SVt_PVCV); - if (indirgv && GvCV(indirgv)) + if (indirgv && GvCVu(indirgv)) return 0; /* filehandle or package name makes it a method */ if (!gv || GvIO(indirgv) || gv_stashpvn(tmpbuf, len, FALSE)) { @@ -1567,6 +1567,23 @@ yylex() if (*s == ':' && s[1] != ':') /* for csh execing sh scripts */ s++; if (!in_eval && *s == '#' && s[1] == '!') { +#ifdef ARG_ZERO_IS_SCRIPT + /* + * HP-UX (at least) sets argv[0] to the script + * name, which makes $^X incorrect. + * So, having found "#!", we'll set it right. + */ + GV *x = gv_fetchpv("\030", TRUE, SVt_PV); + if (sv_eq(GvSV(x), GvSV(curcop->cop_filegv))) { + char *a = s + 2; + while (*a == ' ' || *a == '\t') + a++; + d = a; + while (*d && !isSPACE(*d)) + d++; + sv_setpvn(GvSV(x), a, d - a); + } +#endif /* ARG_ZERO_IS_SCRIPT */ d = instr(s,"perl -"); if (!d) d = instr(s,"perl"); @@ -2335,8 +2352,15 @@ yylex() keylookup: bufptr = s; s = scan_word(s, tokenbuf, FALSE, &len); - - if (*s == ':' && s[1] == ':' && strNE(tokenbuf, "CORE")) + + /* Some keywords can be followed by any delimiter, including ':' */ + tmp = (len == 1 && strchr("msyq", tokenbuf[0]) || + len == 2 && ((tokenbuf[0] == 't' && tokenbuf[1] == 'r') || + (tokenbuf[0] == 'q' && + strchr("qwx", tokenbuf[1])))); + + /* x::* is just a word, unless x is "CORE" */ + if (!tmp && *s == ':' && s[1] == ':' && strNE(tokenbuf, "CORE")) goto just_a_word; d = s; @@ -2344,18 +2368,12 @@ yylex() d++; /* no comments skipped here, or s### is misparsed */ /* Is this a label? */ - if (expect == XSTATE && d < bufend && *d == ':' && *(d + 1) != ':') { - if (len == 1 && strchr("syq", tokenbuf[0]) || - len == 2 && ((tokenbuf[0] == 't' && tokenbuf[1] == 'r') || - (tokenbuf[0] == 'q' && - strchr("qwx", tokenbuf[1])))) - ; /* no */ - else { - s = d + 1; - yylval.pval = savepv(tokenbuf); - CLINE; - TOKEN(LABEL); - } + if (!tmp && expect == XSTATE + && d < bufend && *d == ':' && *(d + 1) != ':') { + s = d + 1; + yylval.pval = savepv(tokenbuf); + CLINE; + TOKEN(LABEL); } /* Check for keywords */ @@ -2444,7 +2462,7 @@ yylex() /* (But it's an indir obj regardless for sort.) */ if ((last_lop_op == OP_SORT || - (!immediate_paren && (!gv || !GvCV(gv))) ) && + (!immediate_paren && (!gv || !GvCVu(gv))) ) && (last_lop_op != OP_MAPSTART && last_lop_op != OP_GREPSTART)){ expect = (last_lop == oldoldbufptr) ? XTERM : XOPERATOR; goto bareword; @@ -2466,7 +2484,7 @@ yylex() /* If followed by var or block, call it a method (unless sub) */ - if ((*s == '$' || *s == '{') && (!gv || !GvCV(gv))) { + if ((*s == '$' || *s == '{') && (!gv || !GvCVu(gv))) { last_lop = oldbufptr; last_lop_op = OP_METHOD; PREBLOCK(METHOD); @@ -2479,7 +2497,7 @@ yylex() /* Not a method, so call it a subroutine (if defined) */ - if (gv && GvCV(gv)) { + if (gv && GvCVu(gv)) { CV* cv = GvCV(gv); if (*s == '(') { nextval[nexttoke].opval = yylval.opval; diff --git a/util.c b/util.c index 99c6f41..5329c5a 100644 --- a/util.c +++ b/util.c @@ -1099,7 +1099,7 @@ mess(pat, args) if (usermess) { tmpstr = sv_newmortal(); sv_setpv(tmpstr, va_arg(*args, char *)); - *s++ = SvPVX(tmpstr)[SvCUR(tmpstr)-1]; + *s++ = SvCUR(tmpstr) ? SvPVX(tmpstr)[SvCUR(tmpstr)-1] : ' '; } else { (void) vsprintf(s,pat,*args); diff --git a/vms/Makefile b/vms/Makefile index 542e139..aa69afb 100644 --- a/vms/Makefile +++ b/vms/Makefile @@ -252,7 +252,7 @@ pod1 = [.lib.pod]perl.pod [.lib.pod]perlapio.pod [.lib.pod]perlbook.pod [.lib.po pod2 = [.lib.pod]perldata.pod [.lib.pod]perldebug.pod [.lib.pod]perldiag.pod [.lib.pod]perldsc.pod pod3 = [.lib.pod]perlembed.pod [.lib.pod]perlform.pod [.lib.pod]perlfunc.pod [.lib.pod]perlguts.pod pod4 = [.lib.pod]perlipc.pod [.lib.pod]perllocale.pod [.lib.pod]perllol.pod [.lib.pod]perlmod.pod [.lib.pod]perlobj.pod -pod5 = [.lib.pod]perlop.pod [.lib.pod]perlovl.pod [.lib.pod]perlpod.pod [.lib.pod]perlre.pod +pod5 = [.lib.pod]perlop.pod [.lib.pod]perlpod.pod [.lib.pod]perlre.pod pod6 = [.lib.pod]perlref.pod [.lib.pod]perlrun.pod [.lib.pod]perlsec.pod [.lib.pod]perlstyle.pod pod7 = [.lib.pod]perlsub.pod [.lib.pod]perlsyn.pod [.lib.pod]perltie.pod [.lib.pod]perltoc.pod pod8 = [.lib.pod]perltrap.pod [.lib.pod]perlvar.pod [.lib.pod]perlxs.pod [.lib.pod]perlxstut.pod @@ -593,10 +593,6 @@ preplibrary : $(MINIPERL_EXE) $(ARCHDIR)Config.pm [.lib]DynaLoader.pm [.lib.VMS] @ If f$$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod] @ Copy/Log [.pod]perlop.pod $@ -[.lib.pod]perlovl.pod : [.pod]perlovl.pod - @ If f$$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod] - @ Copy/Log [.pod]perlovl.pod $@ - [.lib.pod]perlpod.pod : [.pod]perlpod.pod @ If f$$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod] @ Copy/Log [.pod]perlpod.pod $@ diff --git a/vms/descrip.mms b/vms/descrip.mms index 9bfdf0c..451ca3d 100644 --- a/vms/descrip.mms +++ b/vms/descrip.mms @@ -283,7 +283,7 @@ pod1 = [.lib.pod]perl.pod [.lib.pod]perlapio.pod [.lib.pod]perlbook.pod [.lib.po pod2 = [.lib.pod]perldata.pod [.lib.pod]perldebug.pod [.lib.pod]perldiag.pod [.lib.pod]perldsc.pod pod3 = [.lib.pod]perlembed.pod [.lib.pod]perlform.pod [.lib.pod]perlfunc.pod [.lib.pod]perlguts.pod pod4 = [.lib.pod]perlipc.pod [.lib.pod]perllocale.pod [.lib.pod]perllol.pod [.lib.pod]perlmod.pod [.lib.pod]perlobj.pod -pod5 = [.lib.pod]perlop.pod [.lib.pod]perlovl.pod [.lib.pod]perlpod.pod [.lib.pod]perlre.pod +pod5 = [.lib.pod]perlop.pod [.lib.pod]perlpod.pod [.lib.pod]perlre.pod pod6 = [.lib.pod]perlref.pod [.lib.pod]perlrun.pod [.lib.pod]perlsec.pod [.lib.pod]perlstyle.pod pod7 = [.lib.pod]perlsub.pod [.lib.pod]perlsyn.pod [.lib.pod]perltie.pod [.lib.pod]perltoc.pod pod8 = [.lib.pod]perltrap.pod [.lib.pod]perlvar.pod [.lib.pod]perlxs.pod [.lib.pod]perlxstut.pod @@ -624,10 +624,6 @@ preplibrary : $(MINIPERL_EXE) $(ARCHDIR)Config.pm [.lib]DynaLoader.pm [.lib.VMS] @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod] @ Copy/Log $(MMS$SOURCE) $(MMS$TARGET) -[.lib.pod]perlovl.pod : [.pod]perlovl.pod - @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod] - @ Copy/Log $(MMS$SOURCE) $(MMS$TARGET) - [.lib.pod]perlpod.pod : [.pod]perlpod.pod @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod] @ Copy/Log $(MMS$SOURCE) $(MMS$TARGET)