Integrate mainline (Via/via etc.)
Nick Ing-Simmons [Wed, 10 Jul 2002 06:58:47 +0000 (06:58 +0000)]
p4raw-id: //depot/perlio@17461

43 files changed:
Changes
MANIFEST
Porting/config.sh
Porting/pumpkin.pod
djgpp/config.over
doio.c
epoc/config.sh
ext/B/B/C.pm
ext/Data/Dumper/Dumper.xs
ext/MIME/Base64/QuotedPrint.pm
ext/PerlIO/scalar/Makefile.PL [moved from ext/PerlIO/Scalar/Makefile.PL with 63% similarity]
ext/PerlIO/scalar/scalar.pm [moved from ext/PerlIO/Scalar/Scalar.pm with 67% similarity]
ext/PerlIO/scalar/scalar.xs [moved from ext/PerlIO/Scalar/Scalar.xs with 99% similarity]
ext/PerlIO/t/via.t
ext/PerlIO/via/Makefile.PL [moved from ext/PerlIO/Via/Makefile.PL with 66% similarity]
ext/PerlIO/via/via.pm [moved from ext/PerlIO/Via/Via.pm with 67% similarity]
ext/PerlIO/via/via.xs [moved from ext/PerlIO/Via/Via.xs with 99% similarity]
ext/threads/shared/shared.pm
ext/threads/shared/shared.xs
hints/uwin.sh
hints/vmesa.sh
lib/Config.t [new file with mode: 0644]
lib/File/Spec/Unix.pm
lib/PerlIO/via/QuotedPrint.pm [new file with mode: 0644]
lib/PerlIO/via/t/QuotedPrint.t [new file with mode: 0644]
makedepend.SH
op.c
patchlevel.h
perl.c
perlio.c
pod/perldelta.pod
pod/perliol.pod
pod/perlport.pod
pod/perlre.pod
pod/perltoc.pod
pp_ctl.c
t/lib/strict/subs
t/op/eval.t
t/op/magic.t
toke.c
util.c
win32/Makefile
win32/makefile.mk

diff --git a/Changes b/Changes
index 9d9e180..75e00ce 100644 (file)
--- a/Changes
+++ b/Changes
@@ -28,6 +28,231 @@ example from http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/
 Version v5.7.X         Development release working toward v5.8
 --------------
 ____________________________________________________________________________
+[ 17439] By: jhi                                   on 2002/07/09  13:55:16
+        Log: Empty lines.
+     Branch: perl
+          ! MANIFEST
+____________________________________________________________________________
+[ 17438] By: jhi                                   on 2002/07/09  13:48:44
+        Log: Integrate perlio:
+             
+             [ 17431]
+             SuSE 8.0 at least needs hints to use -lgdbm for ODBM_File
+             
+             [ 17432]
+             Core-dump prevention for 
+             open PIPE, "-|:stdio", "cat /etc/motd";
+             (root cause not yet fixed).
+             
+             [ 17433]
+             Special case :stdio pushed method so that "-|:stdio" does 
+             not have an uninitialized layer on top.
+             
+             [ 17435]
+             Call $encoding->decode($sv) without a $chk argument.
+             This fixes modification of readonly value under use encoding().
+             Not a final fix as it does not warn on failed decode.
+             
+             [ 17437]
+             perldiag patch for implied open of STDIN/STDOUT/STDERR
+             in wrong mode.
+     Branch: perl
+         +> ext/ODBM_File/hints/linux.pl
+         !> MANIFEST perlio.c pod/perldiag.pod sv.c
+____________________________________________________________________________
+[ 17437] By: nick                                  on 2002/07/09  13:42:06
+        Log: perldiag patch for implied open of STDIN/STDOUT/STDERR
+             in wrong mode.
+     Branch: perlio
+          ! pod/perldiag.pod
+____________________________________________________________________________
+[ 17436] By: jhi                                   on 2002/07/09  13:05:43
+        Log: Subject: [ID 20020708.001] makedepend problem (output of cppstdin garbled)
+             From: Hans Ranke <Hans.Ranke@ei.tum.de>
+             Date: Mon, 8 Jul 2002 16:17:00 +0200 (MET DST)
+             Message-Id: <5.8.0_12541_1026136670@regency>
+     Branch: perl
+          ! makedepend.SH
+____________________________________________________________________________
+[ 17435] By: nick                                  on 2002/07/09  12:38:01
+        Log: Call $encoding->decode($sv) without a $chk argument.
+             This fixes modification of readonly value under use encoding().
+             Not a final fix as it does not warn on failed decode.
+     Branch: perlio
+          ! sv.c
+____________________________________________________________________________
+[ 17434] By: jhi                                   on 2002/07/09  11:50:41
+        Log: Subject: [DOC PATCH] perlre, minor error
+             From: "Steffen Mueller" <xyey9001@sneakemail.com>
+             Date: Tue, 9 Jul 2002 02:23:33 +0200
+             Message-ID: <20020709002024.28399.qmail@onion.perl.org>
+     Branch: perl
+          ! pod/perlre.pod
+____________________________________________________________________________
+[ 17433] By: nick                                  on 2002/07/09  11:42:32
+        Log: Special case :stdio pushed method so that "-|:stdio" does 
+             not have an uninitialized layer on top.
+     Branch: perlio
+          ! perlio.c
+____________________________________________________________________________
+[ 17432] By: nick                                  on 2002/07/09  09:38:45
+        Log: Core-dump prevention for 
+             open PIPE, "-|:stdio", "cat /etc/motd";
+             (root cause not yet fixed).
+     Branch: perlio
+          ! perlio.c
+____________________________________________________________________________
+[ 17431] By: nick                                  on 2002/07/09  08:01:54
+        Log: SuSE 8.0 at least needs hints to use -lgdbm for ODBM_File
+     Branch: perlio
+          + ext/ODBM_File/hints/linux.pl
+          ! MANIFEST
+____________________________________________________________________________
+[ 17430] By: nick                                  on 2002/07/09  07:59:06
+        Log: Integrate mainline
+     Branch: perlio
+         +> ext/MIME/Base64/t/quoted-print.t lib/Math/BigInt/t/bare_mif.t
+          - ext/MIME/Base64/t/qp.t
+         !> (integrate 48 files)
+____________________________________________________________________________
+[ 17429] By: jhi                                   on 2002/07/09  00:17:49
+        Log: MIME::QuotedPrint is for bytes only; from Gisle.
+     Branch: perl
+          ! ext/MIME/Base64/QuotedPrint.pm
+          ! ext/MIME/Base64/t/quoted-print.t
+____________________________________________________________________________
+[ 17428] By: jhi                                   on 2002/07/08  23:26:49
+        Log: Subject: [ID 20020708.003] File::Spec::Unix::tmpdir automagically creates $ENV{TMPDIR}
+             From: Diab Jerius <dj@head-cfa.harvard.edu>
+             Date: Mon, 8 Jul 2002 18:44:12 -0400 (EDT)
+             Message-Id: <200207082244.g68MiDY22791@pelf.harvard.edu>
+     Branch: perl
+          ! lib/File/Spec/Unix.pm
+____________________________________________________________________________
+[ 17427] By: jhi                                   on 2002/07/08  23:17:21
+        Log: Subject: patch against   t/op/magic.t
+             From: Jim Cromie <jcromie@divsol.com>
+             Date: Mon, 08 Jul 2002 19:23:38 -0400
+             Message-ID: <3D2A1EFA.8050603@divsol.com>
+     Branch: perl
+          ! t/op/magic.t
+____________________________________________________________________________
+[ 17426] By: jhi                                   on 2002/07/08  21:38:24
+        Log: Subject: [DOC PATCH] Thread::Signal.pm
+             From: Elizabeth Mattijsen <liz@dijkmat.nl>
+             Date: Mon, 08 Jul 2002 23:40:32 +0200
+             Message-Id: <4.2.0.58.20020708233854.024783b0@mickey.dijkmat.nl>
+     Branch: perl
+          ! ext/Thread/Thread/Signal.pm
+____________________________________________________________________________
+[ 17425] By: jhi                                   on 2002/07/08  20:10:15
+        Log: Integrate maint patches #17421, #17424:
+             
+             on platforms like HP-UX that are subject to the ARG_ZERO_IS_SCRIPT
+             hack, $^X was improperly set to the script name when the script
+             was run via the PATH; argv[0] in that case shows up as the bare
+             name of the script rather than its fully qualified path, which
+             meant that the sanity check in the ARG_ZERO_IS_SCRIPT code fails
+             to recognize it as the running script name; fix tries to match
+             bare script name in that case (from Gisle Aas)
+             
+             tweak change#17421 ($0 is full path to script even when script
+             is invoked via PATH almost everywhere except Windows)
+     Branch: perl
+         !> t/op/magic.t toke.c
+____________________________________________________________________________
+[ 17424] By: gsar                                  on 2002/07/08  19:54:10
+        Log: tweak change#17421 ($0 is full path to script even when script
+             is invoked via PATH almost everywhere except Windows)
+     Branch: maint-5.6/perl
+          ! t/op/magic.t
+____________________________________________________________________________
+[ 17423] By: jhi                                   on 2002/07/08  19:10:29
+        Log: Subject: Re: [ID 20020626.011] wantarray() causes clobbering of unrelated vars outside the sub 
+             From: Hugo van der Sanden <hv@crypt.compulink.co.uk>
+             Date: Mon, 08 Jul 2002 17:00:33 +0100
+             Message-Id: <200207081600.g68G0Xw07553@crypt.compulink.co.uk>
+     Branch: perl
+          ! lib/File/Basename.pm op.c t/op/wantarray.t
+____________________________________________________________________________
+[ 17422] By: jhi                                   on 2002/07/08  19:08:58
+        Log: Subject: [PATCH perl@17412] regcomp.c casting tweak
+             From: "Craig A. Berry" <craigberry@mac.com>
+             Date: Mon, 08 Jul 2002 13:17:35 -0500
+             Message-Id: <5.1.1.5.0.20020708124433.034a5dd8@exchi01>
+     Branch: perl
+          ! regcomp.c
+____________________________________________________________________________
+[ 17421] By: gsar                                  on 2002/07/08  17:07:01
+        Log: on platforms like HP-UX that are subject to the ARG_ZERO_IS_SCRIPT
+             hack, $^X was improperly set to the script name when the script
+             was run via the PATH; argv[0] in that case shows up as the bare
+             name of the script rather than its fully qualified path, which
+             meant that the sanity check in the ARG_ZERO_IS_SCRIPT code fails
+             to recognize it as the running script name; fix tries to match
+             bare script name in that case (from Gisle Aas)
+     Branch: maint-5.6/perl
+          ! t/op/magic.t toke.c
+____________________________________________________________________________
+[ 17420] By: jhi                                   on 2002/07/08  12:54:52
+        Log: Subject: [ DOC PATCH] Re: build failure on Solaris with useithreads
+             From: Dave Mitchell <davem@fdgroup.com>
+             Date: Mon, 8 Jul 2002 00:45:42 +0100
+             Message-ID: <20020708004542.B14412@fdgroup.com>
+     Branch: perl
+          ! README.solaris
+____________________________________________________________________________
+[ 17419] By: jhi                                   on 2002/07/08  12:19:24
+        Log: Add a note about perlmonks as suggested by Ilya Martynov;
+             add an admonition about "can you write my shopping cart
+             script for me!!!"
+     Branch: perl
+          ! pod/perlfaq2.pod
+____________________________________________________________________________
+[ 17418] By: jhi                                   on 2002/07/08  12:11:31
+        Log: Subject: [DOC PATCH] perlfaq2.pod, perlmodstyle.pod
+             From: Iain Truskett <spoon@cpan.org>
+             Date: Mon, 8 Jul 2002 16:50:55 +1000
+             Message-ID: <20020708065055.GC14168@eh.org>
+     Branch: perl
+          ! pod/perlfaq2.pod pod/perlmodstyle.pod
+____________________________________________________________________________
+[ 17417] By: jhi                                   on 2002/07/08  12:08:27
+        Log: Subject: [DOC PATCH] perlthrtut.pod
+             From: Iain Truskett <spoon@cpan.org>
+             Date: Mon, 8 Jul 2002 13:53:59 +1000       
+             Message-ID: <20020708035359.GB14168@eh.org>  
+     Branch: perl
+          ! pod/perlthrtut.pod
+____________________________________________________________________________
+[ 17416] By: jhi                                   on 2002/07/08  12:07:11
+        Log: Subject: [PATCH] t/op/glob.t
+             From: Iain Truskett <spoon@cpan.org>
+             Date: Mon, 8 Jul 2002 11:59:21 +1000
+             Message-ID: <20020708015921.GA14168@eh.org>
+     Branch: perl
+          ! t/op/glob.t
+____________________________________________________________________________
+[ 17415] By: jhi                                   on 2002/07/08  11:58:54
+        Log: More AUTHORS updates.
+     Branch: perl
+          ! AUTHORS
+____________________________________________________________________________
+[ 17414] By: jhi                                   on 2002/07/07  22:17:28
+        Log: AUTHORS updates.
+     Branch: perl
+          ! AUTHORS
+____________________________________________________________________________
+[ 17413] By: jhi                                   on 2002/07/07  21:42:20
+        Log: README tweaks.
+     Branch: perl
+          ! README.tru64
+____________________________________________________________________________
+[ 17412] By: jhi                                   on 2002/07/07  20:54:53
+        Log: Update Changes.
+     Branch: perl
+          ! Changes patchlevel.h
+____________________________________________________________________________
 [ 17411] By: jhi                                   on 2002/07/07  20:36:18
         Log: Regen toc, modlib.
      Branch: perl
index 00f57b9..f83fbc0 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -531,17 +531,17 @@ ext/PerlIO/encoding/encoding.xs PerlIO::encoding
 ext/PerlIO/encoding/Makefile.PL PerlIO::encoding makefile writer
 ext/PerlIO/encoding/MANIFEST   PerlIO::encoding list of files
 ext/PerlIO/PerlIO.t            See if PerlIO works
-ext/PerlIO/Scalar/Makefile.PL  PerlIO layer for scalars
-ext/PerlIO/Scalar/Scalar.pm    PerlIO layer for scalars
-ext/PerlIO/Scalar/Scalar.xs    PerlIO layer for scalars
+ext/PerlIO/scalar/Makefile.PL  PerlIO layer for scalars
+ext/PerlIO/scalar/scalar.pm    PerlIO layer for scalars
+ext/PerlIO/scalar/scalar.xs    PerlIO layer for scalars
 ext/PerlIO/t/encoding.t                See if PerlIO encoding conversion works
 ext/PerlIO/t/fail.t            See if bad layers fail
 ext/PerlIO/t/fallback.t                See if PerlIO fallbacks work
-ext/PerlIO/t/scalar.t          See if PerlIO::Scalar works
-ext/PerlIO/t/via.t             See if PerlIO::Via works
-ext/PerlIO/Via/Makefile.PL     PerlIO layer for layers in perl
-ext/PerlIO/Via/Via.pm          PerlIO layer for layers in perl
-ext/PerlIO/Via/Via.xs          PerlIO layer for layers in perl
+ext/PerlIO/t/scalar.t          See if PerlIO::scalar works
+ext/PerlIO/t/via.t             See if PerlIO::via works
+ext/PerlIO/via/Makefile.PL     PerlIO layer for layers in perl
+ext/PerlIO/via/via.pm          PerlIO layer for layers in perl
+ext/PerlIO/via/via.xs          PerlIO layer for layers in perl
 ext/POSIX/hints/bsdos.pl       Hint for POSIX for named architecture
 ext/POSIX/hints/dynixptx.pl    Hint for POSIX for named architecture
 ext/POSIX/hints/freebsd.pl     Hint for POSIX for named architecture
@@ -995,6 +995,7 @@ lib/Class/ISA/test.pl               See if Class::ISA works
 lib/Class/Struct.pm            Declare struct-like datatypes as Perl classes
 lib/Class/Struct.t             See if Class::Struct works
 lib/complete.pl                        A command completion subroutine
+lib/Config.t                   See if Config works
 lib/constant.pm                        For "use constant"
 lib/constant.t                 See if compile-time constants work
 lib/CPAN.pm                    Interface to Comprehensive Perl Archive Network
@@ -1359,6 +1360,8 @@ lib/overload.pm                   Module for overloading perl operators
 lib/overload.t                 See if operator overloading works
 lib/perl5db.pl                 Perl debugging routines
 lib/PerlIO.pm                  PerlIO support module
+lib/PerlIO/via/QuotedPrint.pm  PerlIO::via::QuotedPrint
+lib/PerlIO/via/t/QuotedPrint.t PerlIO::via::QuotedPrint
 lib/ph.t                       See if h2ph works
 lib/Pod/Checker.pm             Pod-Parser - check POD documents for syntax errors
 lib/Pod/Find.pm                        used by pod/splitpod
@@ -2824,4 +2827,3 @@ x2p/util.h                        Public declarations for the above
 x2p/walk.c                     Parse tree walker
 XSUB.h                         Include file for extension subroutines
 xsutils.c                      Additional bundled package methods not in UNIVERSAL::
-
index b74cbc2..f221572 100644 (file)
@@ -493,7 +493,7 @@ dlsrc='dl_dlopen.xs'
 doublesize='8'
 drand01='drand48()'
 drand48_r_proto='0'
-dynamic_ext='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/Scalar PerlIO/Via PerlIO/encoding SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared'
+dynamic_ext='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/scalar PerlIO/via PerlIO/encoding SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared'
 eagain='EAGAIN'
 ebcdic='undef'
 echo='echo'
@@ -508,7 +508,7 @@ endservent_r_proto='0'
 eunicefix=':'
 exe_ext=''
 expr='expr'
-extensions='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/Scalar PerlIO/Via PerlIO/encoding SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared Errno'
+extensions='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/scalar PerlIO/via PerlIO/encoding SDBM_File Socket Storable Sys/Hostname Sys/Syslog Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared Errno'
 extras=''
 fflushNULL='define'
 fflushall='undef'
@@ -676,7 +676,7 @@ issymlink='test -h'
 ivdformat='"ld"'
 ivsize='8'
 ivtype='long'
-known_extensions='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call GDBM_File I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/Scalar PerlIO/Via PerlIO/encoding SDBM_File Socket Storable Sys/Hostname Sys/Syslog Thread Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared'
+known_extensions='B ByteLoader Cwd DB_File Data/Dumper Devel/DProf Devel/PPPort Devel/Peek Digest/MD5 Encode Fcntl File/Glob Filter/Util/Call GDBM_File I18N/Langinfo IO IPC/SysV List/Util MIME/Base64 NDBM_File ODBM_File Opcode POSIX PerlIO/scalar PerlIO/via PerlIO/encoding SDBM_File Socket Storable Sys/Hostname Sys/Syslog Thread Time/HiRes Unicode/Normalize XS/APItest XS/Typemap attrs re threads threads/shared'
 ksh=''
 ld='ld'
 lddlflags='-shared -expect_unresolved "*" -msym -std -s'
index 141a60a..1ecab87 100644 (file)
@@ -1277,6 +1277,20 @@ Anyway, all this leads to quite obscure failures that are sure to drive
 casual users crazy.  Even experienced users will get confused :-).  Upon
 reflection, I'd say leave libperl.so in $archlib.
 
+=item 4.
+
+Indentation style: over the years Perl has become a mishmash of
+various indentation styles, but the original "Larry style" can
+probably be restored with (GNU) indent somewhat like this:
+
+    indent -kr -nce -psl -sc
+
+More full solution would also specify a list of Perl specific types
+with -TSV -TAV -THV .. -TMAGIC -TPerlIO ... but that list would be
+quite ungainly.  Also note that GNU indent also doesn't do aligning
+of assignments, which would truly wreck the indentation in places
+like sv.c:Perl_sv_upgrade().
+
 =back
 
 =head1 Upload Your Work to CPAN
index 6967233..f385f55 100644 (file)
@@ -39,12 +39,12 @@ repair()
      -e 's/encode/Encode/'\
      -e 's=filter/util/call=Filter/Util/Call=' \
      -e 's=digest/md5=Digest/MD5=' \
-     -e 's=perlio/scalar=PerlIO/Scalar=' \
+     -e 's=perlio/scalar=PerlIO/scalar=' \
      -e 's=mime/base64=MIME/Base64=' \
      -e 's=time/hires=Time/HiRes=' \
      -e 's=list/util=List/Util=' \
      -e 's=cwd=Cwd=' \
-     -e 's=perlio/via=PerlIO/Via=' \
+     -e 's=perlio/via=PerlIO/via=' \
      -e 's=perlio/encoding=PerlIO/encoding=' \
      -e 's=xs/apitest=XS/APItest=' \
      -e 's=xs/typemap=XS/Typemap=' \
diff --git a/doio.c b/doio.c
index 622778a..01d485b 100644 (file)
--- a/doio.c
+++ b/doio.c
@@ -546,8 +546,8 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
     }
 
     fd = PerlIO_fileno(fp);
-    /* If there is no fd (e.g. PerlIO::Scalar) assume it isn't a
-     * socket - this covers PerlIO::Scalar - otherwise unless we "know" the
+    /* If there is no fd (e.g. PerlIO::scalar) assume it isn't a
+     * socket - this covers PerlIO::scalar - otherwise unless we "know" the
      * type probe for socket-ness.
      */
     if (IoTYPE(io) && IoTYPE(io) != IoTYPE_PIPE && IoTYPE(io) != IoTYPE_STD && fd >= 0) {
@@ -596,7 +596,7 @@ Perl_do_openn(pTHX_ GV *gv, register char *name, I32 len, int as_raw,
            }
        }
        if (savefd != fd) {
-           /* Still a small can-of-worms here if (say) PerlIO::Scalar
+           /* Still a small can-of-worms here if (say) PerlIO::scalar
               is assigned to (say) STDOUT - for now let dup2() fail
               and provide the error
             */
index a19e735..78b22ac 100644 (file)
@@ -487,7 +487,7 @@ endservent_r_proto='0'
 eunicefix=':'
 exe_ext=''
 expr='expr'
-extensions='Data/Dumper Digest/MD5 Errno Fcntl File/Glob Filter/Util/Call IO List/Util MIME/Base64 Opcode PerlIO/Scalar Socket Storable Sys/Hostname Unicode/Storable attrs re'
+extensions='Data/Dumper Digest/MD5 Errno Fcntl File/Glob Filter/Util/Call IO List/Util MIME/Base64 Opcode PerlIO/scalar Socket Storable Sys/Hostname Unicode/Storable attrs re'
 fflushNULL='undef'
 fflushall='define'
 find=''
index f1019f0..8d71bb2 100644 (file)
@@ -1309,7 +1309,7 @@ sub B::IO::save_data {
         GvSV( gv ) = sv;
     }
 CODE
-    # for PerlIO::Scalar
+    # for PerlIO::scalar
     $use_xsloader = 1;
     $init->add_eval( sprintf 'open(%s, "<", $%s)', $globname, $globname );
 }
index a129c3f..63b0f79 100644 (file)
@@ -152,7 +152,16 @@ esc_q_utf8(pTHX_ SV* sv, register char *src, register STRLEN slen)
             else if (k < 0x80)
                 *r++ = (char)k;
             else {
-                r += sprintf(r, "\\x{%"UVxf"}", k);
+             /* The return value of sprintf() is unportable.
+              * In modern systems it returns (int) the number of characters,
+              * but in older systems it might return (char*) the original
+              * buffer, or it might even be (void).  The easiest portable
+              * thing to do is probably use sprintf() in void context and
+              * then strlen(buffer) for the length.  The more proper way
+              * would of course be to figure out the prototype of sprintf.
+              * --jhi */
+               sprintf(r, "\\x{%"UVxf"}", k);
+                r += strlen(r);
             }
         }
         *r++ = '"';
index ad0d7e1..2cdc018 100644 (file)
@@ -159,37 +159,4 @@ sub decode_qp ($)
 *encode = \&encode_qp;
 *decode = \&decode_qp;
 
-# Methods for use as a PerlIO layer object
-
-sub PUSHED
-{
- my ($class,$mode) = @_;
- # When writing we buffer the data
- my $write = '';
- return bless \$write,$class;
-}
-
-sub FILL
-{
- my ($obj,$fh) = @_;
- my $line = <$fh>;
- return (defined $line) ? decode_qp($line) : undef;
-}
-
-sub WRITE
-{
- my ($obj,$buf,$fh) = @_;
- $$obj .= encode_qp($buf);
- return length($buf);
-}
-
-sub FLUSH
-{
- my ($obj,$fh) = @_;
- print $fh $$obj or return -1;
- $$obj = '';
- return 0;
-}
-
-
 1;
similarity index 63%
rename from ext/PerlIO/Scalar/Makefile.PL
rename to ext/PerlIO/scalar/Makefile.PL
index 9d97e4a..11a9ee5 100644 (file)
@@ -1,7 +1,7 @@
 use ExtUtils::MakeMaker;
 WriteMakefile(
-       NAME            => "PerlIO::Scalar",
+       NAME            => "PerlIO::scalar",
        MAN3PODS    => {},  # Pods will be built by installman.
-       VERSION_FROM    => 'Scalar.pm',
+       VERSION_FROM    => 'scalar.pm',
 );
 
similarity index 67%
rename from ext/PerlIO/Scalar/Scalar.pm
rename to ext/PerlIO/scalar/scalar.pm
index e086032..d75d370 100644 (file)
@@ -1,13 +1,13 @@
-package PerlIO::Scalar;
+package PerlIO::scalar;
 our $VERSION = '0.01';
 use XSLoader ();
-XSLoader::load 'PerlIO::Scalar';
+XSLoader::load 'PerlIO::scalar';
 1;
 __END__
 
 =head1 NAME
 
-PerlIO::Scalar - support module for in-memory IO.
+PerlIO::scalar - support module for in-memory IO.
 
 =head1 SYNOPSIS
 
@@ -15,7 +15,7 @@ PerlIO::Scalar - support module for in-memory IO.
 
 =head1 DESCRIPTION
 
-C<PerlIO::Scalar> only exists to use XSLoader to load C code that provides
+C<PerlIO::scalar> only exists to use XSLoader to load C code that provides
 support for treating a scalar as an "in memory" file.
 
 All normal file operations can be performed on the handle. The scalar
similarity index 99%
rename from ext/PerlIO/Scalar/Scalar.xs
rename to ext/PerlIO/scalar/scalar.xs
index 5bbc119..f505c89 100644 (file)
@@ -264,7 +264,7 @@ PerlIOScalar_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags)
 
 PerlIO_funcs PerlIO_scalar = {
  sizeof(PerlIO_funcs),
- "Scalar",
+ "scalar",
  sizeof(PerlIOScalar),
  PERLIO_K_BUFFERED|PERLIO_K_RAW,
  PerlIOScalar_pushed,
@@ -296,7 +296,7 @@ PerlIO_funcs PerlIO_scalar = {
 
 #endif /* Layers available */
 
-MODULE = PerlIO::Scalar        PACKAGE = PerlIO::Scalar
+MODULE = PerlIO::scalar        PACKAGE = PerlIO::scalar
 
 PROTOTYPES: ENABLE
 
index 9fe699f..d40e85e 100644 (file)
@@ -20,14 +20,14 @@ my $fh;
 my $a = join("", map { chr } 0..255) x 10;
 my $b;
 
-BEGIN { use_ok('MIME::QuotedPrint'); }
+BEGIN { use_ok('PerlIO::via::QuotedPrint'); }
 
-ok( !open($fh,"<Via(MIME::QuotedPrint)", $tmp), 'open QuotedPrint fails');
-ok( open($fh,">Via(MIME::QuotedPrint)", $tmp), 'open QuotedPrint for output');
+ok( !open($fh,"<via(PerlIO::via::QuotedPrint)", $tmp), 'open QuotedPrint for input fails');
+ok(  open($fh,">via(PerlIO::via::QuotedPrint)", $tmp), 'open QuotedPrint for output');
 ok( (print $fh $a), "print to output file");
 ok( close($fh), 'close output file');
 
-ok( open($fh,"<Via(MIME::QuotedPrint)", $tmp), 'open QuotedPrint for input');
+ok( open($fh,"<via(PerlIO::via::QuotedPrint)", $tmp), 'open QuotedPrint for input');
 { local $/; $b = <$fh> }
 ok( close($fh), "close input file");
 
@@ -45,7 +45,7 @@ is($a, $b, 'compare original data with filtered version');
     print $fh "Hello\n";
     close($fh);
 
-    ok( ! open($fh,">Via(Unknown::Module)", $tmp), 'open Via Unknown::Module will fail');
+    ok( ! open($fh,">via(Unknown::Module)", $tmp), 'open via Unknown::Module will fail');
     like( $warnings, qr/^Cannot find package 'Unknown::Module'/,  'warn about unknown package' );
 
     # Now open normally again to see if we get right fileno
@@ -62,17 +62,17 @@ is($a, $b, 'compare original data with filtered version');
 
     $warnings = '';
     no warnings 'layer';
-    ok( ! open($fh,">Via(Unknown::Module)", $tmp), 'open Via Unknown::Module will fail');
+    ok( ! open($fh,">via(Unknown::Module)", $tmp), 'open via Unknown::Module will fail');
     is( $warnings, "",  "don't warn about unknown package" );
 }
 
 my $obj = '';
 sub Foo::PUSHED                        { $obj = shift; -1; }
-sub PerlIO::Via::Bar::PUSHED   { $obj = shift; -1; }
-open $fh, '<:Via(Foo)', "foo";
+sub PerlIO::via::Bar::PUSHED   { $obj = shift; -1; }
+open $fh, '<:via(Foo)', "foo";
 is( $obj, 'Foo', 'search for package Foo' );
-open $fh, '<:Via(Bar)', "bar";
-is( $obj, 'PerlIO::Via::Bar', 'search for package PerlIO::Via::Bar' );
+open $fh, '<:via(Bar)', "bar";
+is( $obj, 'PerlIO::via::Bar', 'search for package PerlIO::via::Bar' );
 
 END {
     1 while unlink $tmp;
similarity index 66%
rename from ext/PerlIO/Via/Makefile.PL
rename to ext/PerlIO/via/Makefile.PL
index d47ba93..deb401f 100644 (file)
@@ -1,7 +1,7 @@
 use ExtUtils::MakeMaker;
 WriteMakefile(
-       NAME            => "PerlIO::Via",
+       NAME            => "PerlIO::via",
        MAN3PODS    => {},  # Pods will be built by installman.
-       VERSION_FROM    => 'Via.pm',
+       VERSION_FROM    => 'via.pm',
 );
 
similarity index 67%
rename from ext/PerlIO/Via/Via.pm
rename to ext/PerlIO/via/via.pm
index 7f3938a..cab00fa 100644 (file)
@@ -1,40 +1,63 @@
-package PerlIO::Via;
+package PerlIO::via;
 our $VERSION = '0.01';
 use XSLoader ();
-XSLoader::load 'PerlIO::Via';
+XSLoader::load 'PerlIO::via';
 1;
 __END__
 
 =head1 NAME
 
-PerlIO::Via - Helper class for PerlIO layers implemented in perl
+PerlIO::via - Helper class for PerlIO layers implemented in perl
 
 =head1 SYNOPSIS
 
-   use Some::Package;
+   use PerlIO::via::Layer;
+   open($fh,"<:via(Layer)",...);
 
-   open($fh,"<:Via(Some::Package)",...);
+   use Some::Other::Package;
+   open($fh,">:via(Some::Other::Package)",...);
 
-   use PerlIO::Via::SomeLayer;
+=head1 DESCRIPTION
 
-   # Assume PerlIO::Via:: default namespace when SomeLayer.pm is not found
-   open($fh,"<:Via(SomeLayer)",...);
+The PerlIO::via module allows you to develop PerlIO layers in Perl, without
+having to go into the nitty gritty of programming C with XS as the interface
+to Perl.
 
-=head1 DESCRIPTION
+One example module, L<PerlIO::via::QuotedPrint>, is include with Perl
+5.8.0, and more example modules are available from CPAN, such as
+L<PerlIO::via::StripHTML> and L<PerlIO::via::Base64>.  The
+PerlIO::via::StripHTML for instance, allows you to say:
+
+       use PerlIO::via::StripHTML;
+       open( my $fh, "<:via(StripHTML)", "index.html" );
+        my @line = <$fh>;
+
+to obtain the text of an HTML-file in an array with all the HTML-tags
+automagically removed.
+
+Please note that if the layer is created in the PerlIO::via:: namespace, it
+does B<not> have to be fully qualified.  The PerlIO::via module will prefix
+the PerlIO::via:: namespace if the specified modulename does not exist as a
+fully qualified module name.
 
-The package to be used as a layer should implement at least some of the
-following methods. In the method descriptions below I<$fh> will be
+=head1 EXPECTED METHODS
+
+To create a Perl module that implements a PerlIO layer in Perl (as opposed to
+in C using XS as the interface to Perl), you need to supply some of the
+following subroutines.  It is recommended to create these Perl modules in the
+PerlIO::via:: namespace, so that they can easily be located on CPAN and use
+the default namespace feature of the PerlIO::via module itself.
+
+Please note that this is an area of recent development in Perl and that the
+interface described here is therefor still subject to change (and hopefully
+better documentation and more examples).
+
+In the method descriptions below I<$fh> will be
 a reference to a glob which can be treated as a perl file handle.
 It refers to the layer below. I<$fh> is not passed if the layer
 is at the bottom of the stack, for this reason and to maintain
 some level of "compatibility" with TIEHANDLE classes it is passed last.
-
-As an example, in Perl release 5.8.0 the included MIME::QuotedPrint
-module defines the required TIEHANDLE methods so that you can say
-
-       use MIME::QuotedPrint;
-       open(my $fh, ">Via(MIME::QuotedPrint)", "qp");
-
+  
 =over 4
 
 =item $class->PUSHED([$mode[,$fh]])
@@ -147,11 +170,17 @@ value of FILL or READ.
 
 =back
 
+=head1 EXAMPLES
+
+Check the PerlIO::via:: namespace on CPAN for examples of PerlIO layers
+implemented in Perl.  To give you an idea how simple the implementation of
+a PerlIO layer can look, as simple example is included here.
+
 =head2 Example - a Hexadecimal Handle
 
-Given the following module, Hex.pm:
+Given the following module, PerlIO::via::Hex.pm:
 
-    package Hex;
+    package PerlIO::via::Hex;
 
     sub PUSHED
     {
@@ -190,16 +219,12 @@ output to hexadecimal dump of the output bytes: for example "A" will
 be converted to "41" (on ASCII-based machines, on EBCDIC platforms
 the "A" will become "c1")
 
-    use Hex;
-    open(my $fh, ">:Via(Hex)", "foo.hex");
+    use PerlIO::via::Hex;
+    open(my $fh, ">:via(Hex)", "foo.hex");
 
 and the following code will read the hexdump in and convert it
 on the fly back into bytes:
 
-    open(my $fh, "<:Via(Hex)", "foo.hex");
+    open(my $fh, "<:via(Hex)", "foo.hex");
 
 =cut
-
-
-
-
similarity index 99%
rename from ext/PerlIO/Via/Via.xs
rename to ext/PerlIO/via/via.xs
index fb6718d..0c24778 100644 (file)
@@ -137,7 +137,7 @@ PerlIOVia_pushed(pTHX_ PerlIO * f, const char *mode, SV * arg,
            s->stash = gv_stashpvn(pkg, pkglen, FALSE);
            if (!s->stash) {
                s->obj =
-                   newSVpvn(Perl_form(aTHX_ "PerlIO::Via::%s", pkg),
+                   newSVpvn(Perl_form(aTHX_ "PerlIO::via::%s", pkg),
                             pkglen + 13);
                SvREFCNT_dec(arg);
                s->stash = gv_stashpvn(SvPVX(s->obj), pkglen + 13, FALSE);
@@ -564,7 +564,7 @@ PerlIOVia_dup(pTHX_ PerlIO * f, PerlIO * o, CLONE_PARAMS * param,
 
 PerlIO_funcs PerlIO_object = {
  sizeof(PerlIO_funcs),
- "Via",
+ "via",
  sizeof(PerlIOVia),
  PERLIO_K_BUFFERED|PERLIO_K_DESTRUCT,
  PerlIOVia_pushed,
@@ -596,7 +596,7 @@ PerlIO_funcs PerlIO_object = {
 
 #endif /* Layers available */
 
-MODULE = PerlIO::Via   PACKAGE = PerlIO::Via
+MODULE = PerlIO::via   PACKAGE = PerlIO::via
 PROTOTYPES: ENABLE;
 
 BOOT:
index 8f3c677..d7fe1dc 100644 (file)
@@ -3,36 +3,13 @@ package threads::shared;
 use 5.007_003;
 use strict;
 use warnings;
-use Config;
-
-BEGIN {
-    unless ($Config{useithreads}) {
-       my @caller = caller(2);
-        die <<EOF;
-$caller[1] line $caller[2]:
-
-This Perl hasn't been configured and built properly for the threads
-module to work.  (The 'useithreads' configuration option hasn't been used.)
-
-Having threads support requires all of Perl and all of the XS modules in
-the Perl installation to be rebuilt, it is not just a question of adding
-the threads module.  (In other words, threaded and non-threaded Perls
-are binary incompatible.)
-
-If you want to the use the threads module, please contact the people
-who built your Perl.
-
-Cannot continue, aborting.
-EOF
-    }
-}
 
 require Exporter;
 our @ISA = qw(Exporter);
 our @EXPORT = qw(share cond_wait cond_broadcast cond_signal _refcnt _id _thrcnt);
 our $VERSION = '0.90';
 
-if ($Config{'useithreads'}) {
+if ($threads::threads) {
        *cond_wait = \&cond_wait_enabled;
        *cond_signal = \&cond_signal_enabled;
        *cond_broadcast = \&cond_broadcast_enabled;
@@ -77,8 +54,8 @@ threads::shared - Perl extension for sharing data structures between threads
   share($scalar);
   share(@array);
   share(%hash);
-  my $bar = share([]);
-  $hash{bar} = share({});
+  my $bar = &share([]);
+  $hash{bar} = &share({});
 
   { lock(%hash); ...  }
 
@@ -103,8 +80,9 @@ C<share>, C<lock>, C<cond_wait>, C<cond_signal>, C<cond_broadcast>
 
 =item share VARIABLE
 
-C<share> takes a value and marks it as shared. You can share a scalar, array,
-hash, scalar ref, array ref or hash ref. C<share> will return the shared value.
+C<share> takes a value and marks it as shared. You can share a scalar,
+array, hash, scalar ref, array ref or hash ref.  C<share> will return
+the shared rvalue.
 
 C<share> will traverse up references exactly I<one> level.
 C<share(\$a)> is equivalent to C<share($a)>, while C<share(\\$a)> is not.
@@ -112,6 +90,10 @@ C<share(\$a)> is equivalent to C<share($a)>, while C<share(\\$a)> is not.
 A variable can also be marked as shared at compile time by using the
 C<shared> attribute: C<my $var : shared>.
 
+If you want to share a newly created reference unfortunately you
+need to use C<&share([])> and C<&share({})> syntax due to problems
+with Perl's prototyping.
+
 =item lock VARIABLE
 
 C<lock> places a lock on a variable until the lock goes out of scope.  If
index 14524f6..2a08fb0 100644 (file)
@@ -743,7 +743,6 @@ Perl_sharedsv_locksv(pTHX_ SV *sv)
 =for apidoc sharedsv_init
 
 Saves a space for keeping SVs wider than an interpreter,
-currently only stores a pointer to the first interpreter.
 
 =cut
 
@@ -955,7 +954,7 @@ CODE:
        }
        XSRETURN_UNDEF;
 
-void
+SV*
 share(SV *ref)
        PROTOTYPE: \[$@%]
        CODE:
@@ -963,6 +962,9 @@ share(SV *ref)
        if(SvROK(ref))
            ref = SvRV(ref);
        Perl_sharedsv_share(aTHX_ ref);
+       RETVAL = newRV(ref);
+       OUTPUT:
+       RETVAL
 
 void
 lock_enabled(SV *ref)
index e5a09a6..c05d9eb 100644 (file)
@@ -24,7 +24,7 @@ i_utime=undef
 # compile/link flags
 ldflags=-g
 optimize=-g
-static_ext="B Data/Dumper Digest/MD5 Errno Fcntl Filter::Util::Call IO IPC/SysV MIME::Base64 Opcode PerlIO::Scalar POSIX SDBM_File Socket Storable Unicode::Normalize attrs re"
+static_ext="B Data/Dumper Digest/MD5 Errno Fcntl Filter::Util::Call IO IPC/SysV MIME::Base64 Opcode PerlIO::scalar POSIX SDBM_File Socket Storable Unicode::Normalize attrs re"
 #static_ext=none
 # dynamic loading needs work
 usedl=undef
index f0c0232..5fad22b 100644 (file)
@@ -316,7 +316,7 @@ sig_num_init='0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,2
 sizetype='size_t'
 so='.a'
 ssizetype='ssize_t'
-static_ext='Data/Dumper Digest/MD5 Fcntl Filter/Util/Call GDBM_File IO IPC/SysV List/Util MIME/Base64 NDBM_File Opcode PerlIO/Scalar POSIX Socket Storable Thread Time/HiRes Time/Piece attrs re'
+static_ext='Data/Dumper Digest/MD5 Fcntl Filter/Util/Call GDBM_File IO IPC/SysV List/Util MIME/Base64 NDBM_File Opcode PerlIO/scalar POSIX Socket Storable Thread Time/HiRes Time/Piece attrs re'
 stdchar='char'
 stdio_cnt='(fp)->__countIn'
 stdio_ptr='(fp)->__bufPtr'
diff --git a/lib/Config.t b/lib/Config.t
new file mode 100644 (file)
index 0000000..d64d810
--- /dev/null
@@ -0,0 +1,96 @@
+BEGIN {
+    chdir 't' if -d 't';
+    @INC = '../lib';
+    require "./test.pl";
+}
+
+plan tests => 23;
+
+use_ok('Config');
+
+# Some (safe?) bets.
+
+ok(keys %Config > 900, "Config has more than 900 entries");
+
+ok(each %Config);
+
+is($Config{PERL_REVISION}, 5, "PERL_REVISION is 5");
+
+ok( exists $Config{cc},      "has cc");
+
+ok( exists $Config{ccflags}, "has ccflags");
+
+ok(!exists $Config{python},  "has no python");
+
+ok( exists $Config{d_fork},  "has d_fork");
+
+ok(!exists $Config{d_bork},  "has no d_bork");
+
+like($Config{ivsize},     qr/^(4|8)$/, "ivsize is 4 or 8 (it is $Config{ivsize})");
+
+# byteorder is virtual, but it has rules. 
+
+like($Config{byteorder}, qr/^(1234|4321|12345678|87654321)$/, "byteorder is 1234 or 4321 or 12345678 or 87654321 (it is $Config{byteorder})");
+
+is(length $Config{byteorder}, $Config{ivsize}, "byteorder is as long as ivsize (which is $Config{ivsize})");
+
+# ccflags_nolargefiles is virtual, too.
+
+ok(exists $Config{ccflags_nolargefiles}, "has ccflags_nolargefiles");
+
+# Utility functions.
+
+like(Config::myconfig(),  qr/cc='$Config{cc}'/, "myconfig");
+
+like(Config::config_sh(), qr/cc='$Config{cc}'/, "config_sh");
+
+my $out = tie *STDOUT, 'FakeOut';
+
+Config::config_vars('cc');
+my $out1 = $$out;
+$out->clear;
+
+Config::config_vars('d_bork');
+my $out2 = $$out;
+$out->clear;
+
+untie *STDOUT;
+
+like($out1, qr/^cc='$Config{cc}';/, "config_vars cc");
+like($out2, qr/^d_bork='UNKNOWN';/, "config_vars d_bork is UNKNOWN");
+
+# Read-only.
+
+undef $@;
+eval { $Config{d_bork} = 'borkbork' };
+like($@, qr/Config is read-only/, "no STORE");
+
+ok(!exists $Config{d_bork}, "still no d_bork");
+
+undef $@;
+eval { delete $Config{d_fork} };
+like($@, qr/Config is read-only/, "no DELETE");
+
+ok( exists $Config{d_fork}, "still d_fork");
+
+undef $@;
+eval { %Config = () };
+like($@, qr/Config is read-only/, "no CLEAR");
+
+ok( exists $Config{d_fork}, "still d_fork");
+
+package FakeOut;
+
+sub TIEHANDLE {
+        bless(\(my $text), $_[0]);
+}
+
+sub clear {
+        ${ $_[0] } = '';
+}
+
+sub PRINT {
+        my $self = shift;
+        $$self .= join('', @_);
+}
+
index c6ca111..87ee505 100644 (file)
@@ -141,10 +141,8 @@ is tainted, it is not used.
 my $tmpdir;
 sub tmpdir {
     return $tmpdir if defined $tmpdir;
-    my @dirlist = ( "/tmp" );
-    if ( exists $ENV{TMPDIR} )
+    my @dirlist = ($ENV{TMPDIR}, "/tmp");
     {
-      unshift @dirlist, $ENV{TMPDIR};
        no strict 'refs';
        if (${"\cTAINT"}) { # Check for taint mode on perl >= 5.8.0
             require Scalar::Util;
diff --git a/lib/PerlIO/via/QuotedPrint.pm b/lib/PerlIO/via/QuotedPrint.pm
new file mode 100644 (file)
index 0000000..3acf45c
--- /dev/null
@@ -0,0 +1,87 @@
+package PerlIO::via::QuotedPrint;
+
+# Make sure we do things by the book
+# Set the version info
+
+use strict;
+$PerlIO::via::QuotedPrint::VERSION = 0.01;
+
+# Make sure the encoding/decoding stuff is available
+
+use MIME::QuotedPrint (); # no need to pollute this namespace
+
+#-----------------------------------------------------------------------
+#  IN: 1 class to bless with
+#      2 mode string (ignored)
+#      3 file handle of PerlIO layer below (ignored)
+# OUT: 1 blessed object
+
+sub PUSHED { bless [],$_[0] } #PUSHED
+
+#-----------------------------------------------------------------------
+#  IN: 1 instantiated object (ignored)
+#      2 handle to read from
+# OUT: 1 decoded string
+
+sub FILL {
+
+# Read the line from the handle
+# Decode if there is something decode and return result or signal eof
+
+    my $line = readline( $_[1] );
+    (defined $line) ? MIME::QuotedPrint::decode_qp( $line ) : undef;
+} #FILL
+
+#-----------------------------------------------------------------------
+#  IN: 1 instantiated object (ignored)
+#      2 buffer to be written
+#      3 handle to write to
+# OUT: 1 number of bytes written
+
+sub WRITE {
+
+# Encode whatever needs to be encoded and write to handle: indicate result
+
+    (print {$_[2]} MIME::QuotedPrint::encode_qp($_[1])) ? length($_[1]) : -1;
+} #WRITE
+
+# Satisfy -require-
+
+1;
+
+__END__
+
+=head1 NAME
+
+PerlIO::via::QuotedPrint - PerlIO layer for quoted-printable strings
+
+=head1 SYNOPSIS
+
+ use PerlIO::via::QuotedPrint;
+
+ open( my $in,'<Via(PerlIO::via::QuotedPrint)','file.qp' )
+  or die "Can't open file.qp for reading: $!\n";
+ open( my $out,'>Via(PerlIO::via::QuotedPrint)','file.qp' )
+  or die "Can't open file.qp for writing: $!\n";
+
+=head1 DESCRIPTION
+
+This module implements a PerlIO layer that works on files encoded in the
+quoted-printable format.  It will decode from quoted-printable while reading
+from a handle, and it will encode as quoted-printable while writing to a handle.
+
+=head1 SEE ALSO
+
+L<PerlIO::via>, L<MIME::QuotedPrint>, L<PerlIO::via::Base64>, L<PerlIO::via::MD5>,
+L<PerlIO::via::StripHTML>.
+
+=head1 COPYRIGHT
+
+Copyright (c) 2002 Elizabeth Mattijsen.  Based on example that was initially
+added to MIME::QuotedPrint.pm for the 5.8.0 distribution of Perl.
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=cut
diff --git a/lib/PerlIO/via/t/QuotedPrint.t b/lib/PerlIO/via/t/QuotedPrint.t
new file mode 100644 (file)
index 0000000..9b2587c
--- /dev/null
@@ -0,0 +1,59 @@
+my $file = 'test.qp';
+
+BEGIN {
+    if ($ENV{PERL_CORE}) {     
+       chdir 't' if -d 't';
+       @INC = '../lib';
+    }
+    unless (find PerlIO::Layer 'perlio') {
+        print "1..0 # Skip: PerlIO not used\n";
+       exit 0;
+    }
+}
+
+use Test::More tests => 11;
+
+BEGIN { use_ok('PerlIO::via::QuotedPrint') }
+
+my $decoded = <<EOD;
+This is a tést for quoted-printable text that has hàrdly any speçial characters
+in it.
+EOD
+
+my $encoded = <<EOD;
+This is a t=E9st for quoted-printable text that has h=E0rdly any spe=E7ial =
+characters
+in it.
+EOD
+
+# Create the encoded test-file
+
+ok(
+ open( my $out,'>:via(PerlIO::via::QuotedPrint)', $file ),
+ "opening '$file' for writing"
+);
+
+ok( (print $out $decoded),             'print to file' );
+ok( close( $out ),                     'closing encoding handle' );
+
+# Check encoding without layers
+
+{
+local $/ = undef;
+ok( open( my $test,$file ),            'opening without layer' );
+is( $encoded,readline( $test ),                'check encoded content' );
+ok( close( $test ),                    'close test handle' );
+}
+
+# Check decoding _with_ layers
+
+ok(
+ open( my $in,'<:via(PerlIO::via::QuotedPrint)', $file ),
+ "opening '$file' for reading"
+);
+is( $decoded,join( '',<$in> ),         'check decoding' );
+ok( close( $in ),                      'close decoding handle' );
+
+# Remove whatever we created now
+
+ok( unlink( $file ),                   "remove test file '$file'" );
index 5894995..b8581e9 100755 (executable)
@@ -150,7 +150,7 @@ for file in `$cat .clist`; do
            -e 's|\.c\.c|.c|' $uwinfix | \
         $uniq | $sort | $uniq >> .deptmp
     else
-        $cppstdin $finc -I. $cppflags $cppminus <UU/$file.c 2>&1 |
+        $cppstdin $finc -I. $cppflags $cppminus <UU/$file.c >.cout 2>.cerr
         $sed \
            -e '1d' \
            -e '/^#.*<stdin>/d' \
@@ -165,7 +165,7 @@ for file in `$cat .clist`; do
            -e 's/^.*"\(.*\)".*$/'$filebase'\$(OBJ_EXT): \1/' \
            -e 's/^# *[0-9][0-9]* \(.*\)$/'$filebase'\$(OBJ_EXT): \1/' \
            -e 's|: \./|: |' \
-           -e 's|\.c\.c|.c|' $uwinfix | \
+           -e 's|\.c\.c|.c|' $uwinfix .cout .cerr| \
         $uniq | $sort | $uniq >> .deptmp
     fi
 done
@@ -230,7 +230,7 @@ $rm -f $mf
 $cp $mf.new $mf
 $rm $mf.new
 $echo "# WARNING: Put nothing here or make depend will gobble it up!" >> $mf
-$rm -rf .deptmp UU .shlist .clist .hlist .hsed
+$rm -rf .deptmp UU .shlist .clist .hlist .hsed .cout .cerr
 rmdir .depending
 
 !NO!SUBS!
diff --git a/op.c b/op.c
index 0a8c0a2..5a60a1c 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3977,6 +3977,10 @@ Perl_newCONDOP(pTHX_ I32 flags, OP *first, OP *trueop, OP *falseop)
 
     scalarboolean(first);
     if (first->op_type == OP_CONST) {
+        if (first->op_private & OPpCONST_BARE &&
+           first->op_private & OPpCONST_STRICT) {
+           no_bareword_allowed(first);
+       }
        if (SvTRUE(((SVOP*)first)->op_sv)) {
            op_free(first);
            op_free(falseop);
index a7612d6..b12a603 100644 (file)
@@ -79,7 +79,7 @@
 #if !defined(PERL_PATCHLEVEL_H_IMPLICIT) && !defined(LOCAL_PATCH_COUNT)
 static char    *local_patches[] = {
         NULL
-       ,"DEVEL17411"
+       ,"DEVEL17439"
        ,NULL
 };
 
diff --git a/perl.c b/perl.c
index 3c2a04f..f7131d0 100644 (file)
--- a/perl.c
+++ b/perl.c
@@ -431,7 +431,7 @@ perl_destruct(pTHXx)
     FREETMPS;
 
     /* Need to flush since END blocks can produce output */
-    PerlIO_flush((PerlIO*)NULL);
+    my_fflush_all();
 
     if (CALL_FPTR(PL_threadhook)(aTHX)) {
         /* Threads hook has vetoed further cleanup */
index 3cce842..6b6e6e4 100644 (file)
--- a/perlio.c
+++ b/perlio.c
@@ -1255,7 +1255,7 @@ PerlIO_layer_from_ref(pTHX_ SV *sv)
      * For any scalar type load the handler which is bundled with perl
      */
     if (SvTYPE(sv) < SVt_PVAV)
-       return PerlIO_find_layer(aTHX_ "Scalar", 6, 1);
+       return PerlIO_find_layer(aTHX_ "scalar", 6, 1);
 
     /*
      * For other types allow if layer is known but don't try and load it
@@ -1295,7 +1295,7 @@ PerlIO_resolve_layers(pTHX_ const char *layers,
                incdef = 0;
            }
            /*
-            * Don't fail if handler cannot be found :Via(...) etc. may do
+            * Don't fail if handler cannot be found :via(...) etc. may do
             * something sensible else we will just stringfy and open
             * resulting string.
             */
index 24a8938..2611c84 100644 (file)
@@ -990,13 +990,7 @@ in quoted-printable encoding, as defined in RFC 2045 - I<MIME
 
     print $encoded, "\n"; # "Smiley in Unicode: =263A"
 
-MIME::QuotedPrint has been enhanced to provide the basic methods
-necessary to use it with PerlIO::Via as in :
-
-    use MIME::QuotedPrint;
-    open($fh,">Via(MIME::QuotedPrint)",$path);
-
-See L<MIME::QuotedPrint>.
+See also L<PerlIO::via::QuotedPrint>.
 
 =item *
 
@@ -1010,22 +1004,27 @@ for open().
 
 =item *
 
-C<PerlIO::Scalar>, by Nick Ing-Simmons, provides the implementation
+C<PerlIO::scalar>, by Nick Ing-Simmons, provides the implementation
 of IO to "in memory" Perl scalars as discussed above.  It also serves
 as an example of a loadable PerlIO layer.  Other future possibilities
-include PerlIO::Array and PerlIO::Code.  See L<PerlIO::Scalar>.
+include PerlIO::Array and PerlIO::Code.  See L<PerlIO::scalar>.
 
 =item *
 
-C<PerlIO::Via>, by Nick Ing-Simmons, acts as a PerlIO layer and wraps
+C<PerlIO::via>, by Nick Ing-Simmons, acts as a PerlIO layer and wraps
 PerlIO layer functionality provided by a class (typically implemented
-in perl code).
+in Perl code).
 
-    use MIME::QuotedPrint;
-    open($fh,">Via(MIME::QuotedPrint)",$path);
+=item *
+
+C<PerlIO::via::QuotedPrint>, by Elizabeth Mattijsen, is an example
+of a C<PerlIO::via> class:
 
-This will automatically convert everything output to C<$fh>
-to Quoted-Printable.  See L<PerlIO::Via>.
+    use PerlIO::via::QuotedPrint;
+    open($fh,">Via(PerlIO::via::QuotedPrint)",$path);
+
+This will automatically convert everything output to C<$fh> to
+Quoted-Printable.  See L<PerlIO::via> and L<PerlIO::via::QuotedPrint>.
 
 =item *
 
@@ -3483,6 +3482,11 @@ developers available, we could not get this fixed and tested in time
 for 5.8.0.  Perl 5.6.1 still works for AmigaOS (as does the the 5.7.2
 development release).
 
+The C<PerlIO::Scalar> and C<PerlIO::Via> (capitalised) were renamed as
+C<PerlIO::scalar> and C<PerlIO::via> (all lowercase) just before 5.8.0.
+The main rationale was to have all core IO layers to have all
+lowercase names.
+
 =head1 Reporting Bugs
 
 If you find what you think is a bug, you might check the articles
index b9dcee9..08ea7c6 100644 (file)
@@ -780,13 +780,13 @@ makes this layer available, although F<PerlIO.pm> "knows" where to
 find it.  It is an example of a layer which takes an argument as it is
 called thus:
 
-   open($fh,"<:encoding(iso-8859-7)",$pathname)
+   open( $fh, "<:encoding(iso-8859-7)", $pathname );
 
 =item ":Scalar"
 
-Provides support for
+Provides support for reading data from and writing data to a scalar.
 
-   open($fh,"...",\$scalar)
+   open( $fh, ":Scalar", \$scalar );
 
 When a handle is so opened, then reads get bytes from the string value
 of I<$scalar>, and writes change the value. In both cases the position
@@ -797,10 +797,10 @@ determined via C<tell>.
 
 Provided to allow layers to be implemented as Perl code.  For instance:
 
-   use MIME::QuotedPrint;
-   open(my $fh, ">Via(MIME::QuotedPrint)", "qp");
+   use PerlIO::via::StripHTML;
+   open( my $fh, ">:Via(StripHTML)", "index.html" );
 
-See L<PerlIO::Via> for details.
+See L<PerlIO::via> for details.
 
 =back
 
@@ -867,6 +867,3 @@ a person who is not a PerlIO guru (yet).
 =back
 
 =cut
-
-
-
index 4610a4a..fffb1bc 100644 (file)
@@ -2094,9 +2094,11 @@ available at http://www.cpan.org/src/index.html
         OpenBSD
         OpenVMS         (VMS)
         OS/2
+        PowerUX
         POSIX-BC        (BS2000)
         QNX
         Solaris
+        SunOS 4
         SUPER-UX
         Tru64 UNIX      (DEC OSF/1, Digital UNIX)
         UNICOS
@@ -2114,23 +2116,23 @@ available at http://www.cpan.org/src/index.html
 The following platforms worked with the previous releases (5.6 and
 5.7), but we did not manage either to fix or to test these in time
 for the 5.8.0 release.  There is a very good chance that many of these
-will work fine with the 5.8.0.  The only one known for certain to be
-broken for 5.8.0 is the AmigaOS (for which 5.6.1 and 5.7.2 can be used)
+will work fine with the 5.8.0.
 
-        AmigaOS
         BSD/OS
         DomainOS
         Hurd
         LynxOS
         MachTen
         PowerMAX
-        PowerUX
         SCO SV
-        SunOS 4
         SVR4
         Unixware
         Windows 3.1
 
+Known to be broken for 5.8.0 (but 5.6.1 and 5.7.2 can be used):
+
+       AmigaOS
+
 The following platforms have been known to build Perl from source in
 the past (5.005_03 and earlier), but we haven't been able to verify
 their status for the current release, either because the
index 0256f22..bb52113 100644 (file)
@@ -884,7 +884,7 @@ multiple ways it might succeed, you need to understand backtracking to
 know which variety of success you will achieve.
 
 When using look-ahead assertions and negations, this can all get even
-tricker.  Imagine you'd like to find a sequence of non-digits not
+trickier.  Imagine you'd like to find a sequence of non-digits not
 followed by "123".  You might try to write that as
 
     $_ = "ABC123";
index 83581c8..109b1f1 100644 (file)
@@ -16568,7 +16568,19 @@ unix, stdio, perlio, crlf, utf8, bytes, raw
 
 =back
 
-=head2 PerlIO::Scalar - support module for in-memory IO.
+=head2 PerlIO::encoding - encoding layer
+
+=over 4
+
+=item SYNOPSIS
+
+=item DESCRIPTION
+
+=item SEE ALSO
+
+=back
+
+=head2 PerlIO::scalar - support module for in-memory IO.
 
 =over 4
 
@@ -16578,7 +16590,7 @@ unix, stdio, perlio, crlf, utf8, bytes, raw
 
 =back
 
-=head2 PerlIO::Via - Helper class for PerlIO layers implemented in perl
+=head2 PerlIO::via - Helper class for PerlIO layers implemented in perl
 
 =over 4
 
@@ -16586,15 +16598,19 @@ unix, stdio, perlio, crlf, utf8, bytes, raw
 
 =item DESCRIPTION
 
+=item EXPECTED METHODS
+
 $class->PUSHED([$mode[,$fh]]), $obj->POPPED([$fh]),
-$class->OPEN($path,$mode[,$fh]), $obj->BINMODE([,$fh]),
-$class->FDOPEN($fd), $class->SYSOPEN($path,$imode,$perm,$fh),
+$obj->OPEN($path,$mode[,$fh]), $obj->BINMODE([,$fh]),
+$obj->FDOPEN($fd[,$fh]), $obj->SYSOPEN($path,$imode,$perm,[,$fh]),
 $obj->FILENO($fh), $obj->READ($buffer,$len,$fh), $obj->WRITE($buffer,$fh),
 $obj->FILL($fh), $obj->CLOSE($fh), $obj->SEEK($posn,$whence,$fh),
 $obj->TELL($fh), $obj->UNREAD($buffer,$fh), $obj->FLUSH($fh),
 $obj->SETLINEBUF($fh), $obj->CLEARERR($fh), $obj->ERROR($fh),
 $obj->EOF($fh)
 
+=item EXAMPLES
+
 =over 4
 
 =item Example - a Hexadecimal Handle
@@ -16603,7 +16619,7 @@ $obj->EOF($fh)
 
 =back
 
-=head2 PerlIO::encoding - encoding layer
+=head2 PerlIO::via::QuotedPrint - PerlIO layer for quoted-printable strings
 
 =over 4
 
@@ -16613,6 +16629,8 @@ $obj->EOF($fh)
 
 =item SEE ALSO
 
+=item COPYRIGHT
+
 =back
 
 =head2 Pod::Checker, podchecker() - check pod documents for syntax errors
@@ -18988,9 +19006,12 @@ new, new NUMBER, down, down NUMBER, up, up NUMBER
 =back
 
 =head2 Thread::Signal - Start a thread which runs signal handlers reliably
+(for old code)
 
 =over 4
 
+=item CAVEAT
+
 =item SYNOPSIS
 
 =item DESCRIPTION
index 2fb4b17..971df59 100644 (file)
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3276,7 +3276,7 @@ PP(pp_entereval)
     STRLEN len;
     OP *ret;
 
-    if (!SvPV(sv,len) || !len)
+    if (!SvPV(sv,len))
        RETPUSHUNDEF;
     TAINT_PROPER("eval");
 
index 88d4afc..4a90809 100644 (file)
@@ -334,3 +334,14 @@ use strict;
 EXPECT
 Bareword "foo" not allowed while "strict subs" in use at - line 4.
 Execution of - aborted due to compilation errors.
+
+########
+
+# ID 20020703.002
+use strict;
+use warnings;
+my $abc = XYZ ? 1 : 0;
+print "$abc\n";
+EXPECT
+Bareword "XYZ" not allowed while "strict subs" in use at - line 5.
+Execution of - aborted due to compilation errors.
index 17b8d9d..5897b2b 100755 (executable)
@@ -1,6 +1,6 @@
 #!./perl
 
-print "1..45\n";
+print "1..46\n";
 
 eval 'print "ok 1\n";';
 
@@ -234,3 +234,10 @@ print $@;
   eval q{my $$$x};
   print $@ ? "ok 45\n" : "not ok 45\n";
 }
+
+# [ID 20020623.002] eval "" doesn't clear $@
+{
+    $@ = 5;
+    eval q{};
+    print length($@) ? "not ok 46\t# \$\@ = '$@'\n" : "ok 46\n";
+}
index a85ff6b..c21b12a 100755 (executable)
@@ -232,8 +232,9 @@ EOF
 
     local $ENV{PATH}= ".";
     (my $script_name = $script) =~ s/.*(show-shebang)/$1/;
+    $script_name = "[]$script_name" if $Is_VMS;
     $s1 = "\$^X is $perl, \$0 is $script_name\n" if $Is_MSWin32;
-    $_ = `$script_name`;
+    $_ = $Is_VMS ? `$^X $script_name` : `$script_name`;
     s/\.exe//i if $Is_Dos or $Is_Cygwin or $Is_os2;
     s{\bminiperl\b}{perl}; # so that test doesn't fail with miniperl
     s{is perl}{is $perl}; # for systems where $^X is only a basename
diff --git a/toke.c b/toke.c
index 8d8ac54..bfc6436 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -450,7 +450,7 @@ Perl_lex_start(pTHX_ SV *line)
     if (SvREADONLY(PL_linestr))
        PL_linestr = sv_2mortal(newSVsv(PL_linestr));
     s = SvPV(PL_linestr, len);
-    if (len && s[len-1] != ';') {
+    if (!len || s[len-1] != ';') {
        if (!(SvFLAGS(PL_linestr) & SVs_TEMP))
            PL_linestr = sv_2mortal(newSVsv(PL_linestr));
        sv_catpvn(PL_linestr, "\n;", 2);
diff --git a/util.c b/util.c
index 2668755..623c44c 100644 (file)
--- a/util.c
+++ b/util.c
@@ -3391,6 +3391,7 @@ Perl_my_fflush_all(pTHX)
     return PerlIO_flush(NULL);
 #else
 # if defined(HAS__FWALK)
+    extern int fflush(FILE *);
     /* undocumented, unprototyped, but very useful BSDism */
     extern void _fwalk(int (*)(FILE *));
     _fwalk(&fflush);
index cc360f8..0877f4d 100644 (file)
@@ -661,12 +661,12 @@ STORABLE          = $(EXTDIR)\Storable\Storable
 FILTER                 = $(EXTDIR)\Filter\Util\Call\Call
 ENCODE                 = $(EXTDIR)\Encode\Encode
 MD5                    = $(EXTDIR)\Digest\MD5\MD5
-PERLIOSCALAR           = $(EXTDIR)\PerlIO\Scalar\Scalar
+PERLIOSCALAR           = $(EXTDIR)\PerlIO\scalar\scalar
 MIMEBASE64             = $(EXTDIR)\MIME\Base64\Base64
 TIMEHIRES              = $(EXTDIR)\Time\HiRes\HiRes
 CWD                    = $(EXTDIR)\Cwd\Cwd
 LISTUTIL               = $(EXTDIR)\List\Util\Util
-PERLIOVIA              = $(EXTDIR)\PerlIO\Via\Via
+PERLIOVIA              = $(EXTDIR)\PerlIO\via\via
 XSAPITEST              = $(EXTDIR)\XS\APItest\APItest
 XSTYPEMAP              = $(EXTDIR)\XS\Typemap\Typemap
 UNICODENORMALIZE       = $(EXTDIR)\Unicode\Normalize\Normalize
@@ -691,12 +691,12 @@ STORABLE_DLL              = $(AUTODIR)\Storable\Storable.dll
 FILTER_DLL             = $(AUTODIR)\Filter\Util\Call\Call.dll
 ENCODE_DLL             = $(AUTODIR)\Encode\Encode.dll
 MD5_DLL                        = $(AUTODIR)\Digest\MD5\MD5.dll
-PERLIOSCALAR_DLL       = $(AUTODIR)\PerlIO\Scalar\Scalar.dll
+PERLIOSCALAR_DLL       = $(AUTODIR)\PerlIO\scalar\scalar.dll
 MIMEBASE64_DLL         = $(AUTODIR)\MIME\Base64\Base64.dll
 TIMEHIRES_DLL          = $(AUTODIR)\Time\HiRes\HiRes.dll
 CWD_DLL                        = $(AUTODIR)\Cwd\Cwd.dll
 LISTUTIL_DLL           = $(AUTODIR)\List\Util\Util.dll
-PERLIOVIA_DLL          = $(AUTODIR)\PerlIO\Via\Via.dll
+PERLIOVIA_DLL          = $(AUTODIR)\PerlIO\via\via.dll
 XSAPITEST_DLL          = $(AUTODIR)\XS\APItest\APItest.dll
 XSTYPEMAP_DLL          = $(AUTODIR)\XS\Typemap\Typemap.dll
 UNICODENORMALIZE_DLL   = $(AUTODIR)\Unicode\Normalize\Normalize.dll
@@ -1017,8 +1017,8 @@ distclean: clean
        -del /f $(LIBDIR)\Storable.pm
        -del /f $(LIBDIR)\Filter\Util\Call.pm
        -del /f $(LIBDIR)\Digest\MD5.pm
-       -del /f $(LIBDIR)\PerlIO\Scalar.pm
-       -del /f $(LIBDIR)\PerlIO\Via.pm
+       -del /f $(LIBDIR)\PerlIO\scalar.pm
+       -del /f $(LIBDIR)\PerlIO\via.pm
        -del /f $(LIBDIR)\MIME\Base64.pm
        -del /f $(LIBDIR)\MIME\QuotedPrint.pm
        -del /f $(LIBDIR)\List\Util.pm
index 80a0415..d2f76e7 100644 (file)
@@ -783,7 +783,7 @@ SETARGV_OBJ = setargv$(o)
 DYNAMIC_EXT    = Socket IO Fcntl Opcode SDBM_File POSIX attrs Thread B re \
                Data/Dumper Devel/Peek ByteLoader Devel/DProf File/Glob \
                Sys/Hostname Storable Filter/Util/Call Encode \
-               Digest/MD5 PerlIO/Scalar MIME/Base64 Time/HiRes \
+               Digest/MD5 PerlIO/scalar MIME/Base64 Time/HiRes \
                Unicode/Normalize
 STATIC_EXT     = DynaLoader
 NONXS_EXT      = Errno
@@ -1153,7 +1153,7 @@ distclean: clean
        -del /f $(LIBDIR)\SDBM_File.pm $(LIBDIR)\Socket.pm $(LIBDIR)\POSIX.pm
        -del /f $(LIBDIR)\B.pm $(LIBDIR)\O.pm $(LIBDIR)\re.pm
        -del /f $(LIBDIR)\Data\Dumper.pm $(LIBDIR)\ByteLoader.pm
-       -del /f $(LIBDIR)\PerlIO\Scalar.pm
+       -del /f $(LIBDIR)\PerlIO\scalar.pm
        -del /f $(LIBDIR)\Devel\Peek.pm $(LIBDIR)\Devel\DProf.pm
        -del /f $(LIBDIR)\File\Glob.pm
        -del /f $(LIBDIR)\Storable.pm