diff options
38 files changed, 1358 insertions, 915 deletions
@@ -1128,7 +1128,10 @@ lib/newgetopt.pl A perl library supporting long option parsing lib/NEXT.pm Pseudo-class NEXT for method redispatch lib/NEXT/Changes NEXT lib/NEXT/README NEXT -lib/NEXT/test.pl See if NEXT works +lib/NEXT/t/actual.t NEXT +lib/NEXT/t/actuns.t NEXT +lib/NEXT/t/next.t NEXT +lib/NEXT/t/unseen.t NEXT lib/open.pm Pragma to specify default I/O disciplines lib/open.t See if the open pragma works lib/open2.pl Open a two-ended pipe (uses IPC::Open2) diff --git a/README.threads b/README.threads index 414ca5a2ad..89a202e18b 100644 --- a/README.threads +++ b/README.threads @@ -1,16 +1,28 @@ NOTE: This documentation describes the style of threading that was -available in 5.005. Perl v5.6 also has the early beginnings of -interpreter-based threads support (which is what will be enabled by -default when you simply ask for -Dusethreads). However, be advised -that interpreter threads cannot as yet be created from the Perl level -yet. If you're looking to create threads from within Perl, chances -are you _don't_ want interpreter threads, but want the older support -for threads described below, enabled with: +available in Perl 5.005. Perl 5.6.0 introduced the early beginnings of +interpreter-based threads support, also known as ithreads, and in Perl +5.8.0 the interpeter threads became available from perl level through +the threads and threads::shared modules (in Perl 5.6 ithreads are +available only internally and to XS extension builders, and used +by the Win32 port for emulating fork()). + +If you really want the older support for threads described below, +it is enabled with: sh Configure -Dusethreads -Duse5005threads +Be warned that the old 5.005 implementation of threads is known +to be quite buggy, and unmaintained, which means that the bugs +are there to stay. (We are not mean by not fixing the bugs: +the bugs are just really, really, really hard to fix. Honest.) + The rest of this document only applies to the use5005threads style of -threads. +threads, and the comments on what works on which platform are highly +obsolete and preserved here for archaeology buffs only. The +architecture specific hints files do all the necessary option +tweaking automatically during Configure, both for the 5.005 threads +and for the new interpreter threads. + --------------------------------------------------------------------------- Support for threading is still in the highly experimental stages. There diff --git a/embedvar.h b/embedvar.h index 89c21e5ceb..dfa0b33185 100644 --- a/embedvar.h +++ b/embedvar.h @@ -223,6 +223,7 @@ #define PL_dbargs (PERL_GET_INTERP->Idbargs) #define PL_debstash (PERL_GET_INTERP->Idebstash) #define PL_debug (PERL_GET_INTERP->Idebug) +#define PL_debug_pad (PERL_GET_INTERP->Idebug_pad) #define PL_def_layerlist (PERL_GET_INTERP->Idef_layerlist) #define PL_defgv (PERL_GET_INTERP->Idefgv) #define PL_diehook (PERL_GET_INTERP->Idiehook) @@ -516,6 +517,7 @@ #define PL_dbargs (vTHX->Idbargs) #define PL_debstash (vTHX->Idebstash) #define PL_debug (vTHX->Idebug) +#define PL_debug_pad (vTHX->Idebug_pad) #define PL_def_layerlist (vTHX->Idef_layerlist) #define PL_defgv (vTHX->Idefgv) #define PL_diehook (vTHX->Idiehook) @@ -812,6 +814,7 @@ #define PL_Idbargs PL_dbargs #define PL_Idebstash PL_debstash #define PL_Idebug PL_debug +#define PL_Idebug_pad PL_debug_pad #define PL_Idef_layerlist PL_def_layerlist #define PL_Idefgv PL_defgv #define PL_Idiehook PL_diehook diff --git a/ext/re/Makefile.PL b/ext/re/Makefile.PL index f54f1cd726..51573af05c 100644 --- a/ext/re/Makefile.PL +++ b/ext/re/Makefile.PL @@ -6,15 +6,6 @@ my $object = 're_exec$(OBJ_EXT) re_comp$(OBJ_EXT) re$(OBJ_EXT)'; my $defines = '-DPERL_EXT_RE_BUILD -DPERL_EXT_RE_DEBUG'; -# We need to pretend that DEBUGGING is in effect even if it's -# not but we need to remember that we pretended so we can avoid -# linking to things that aren't there. - -if ( (($Config{'ccflags'} !~ /DEBUGGING/) && $^O ne 'VMS') || - (exists($Config{'usedebugging_perl'}) && $Config{'usedebugging_perl'} ne 'Y') ) { - $defines .= ' -DDEBUGGING -DWAS_NOT_DEBUGGING'; -} - WriteMakefile( NAME => 're', VERSION_FROM => 're.pm', diff --git a/ext/re/re.xs b/ext/re/re.xs index 31887255a1..98b7b822a8 100644 --- a/ext/re/re.xs +++ b/ext/re/re.xs @@ -1,12 +1,12 @@ +#if defined(PERL_EXT_RE_DEBUG) && !defined(DEBUGGING) +# define DEBUGGING +#endif + #define PERL_NO_GET_CONTEXT #include "EXTERN.h" #include "perl.h" #include "XSUB.h" -#ifdef WAS_NOT_DEBUGGING -void Perl_deb(pTHX_ const char* pat, ...) { } -#endif - extern regexp* my_regcomp (pTHX_ char* exp, char* xend, PMOP* pm); extern I32 my_regexec (pTHX_ regexp* prog, char* stringarg, char* strend, char* strbeg, I32 minend, SV* screamer, diff --git a/intrpvar.h b/intrpvar.h index 2d47c8bcd1..a8695f52b5 100644 --- a/intrpvar.h +++ b/intrpvar.h @@ -502,6 +502,10 @@ PERLVARI(Idef_layerlist, PerlIO_list_t *,NULL) PERLVARI(Iencoding, SV*, Nullsv) /* character encoding */ +#ifdef DEBUGGING +PERLVAR(Idebug_pad, struct perl_debug_pad) +#endif + /* New variables must be added to the very end for binary compatibility. * XSUB.h provides wrapper functions via perlapi.h that make this * irrelevant, but not all code may be expected to #include XSUB.h. */ diff --git a/lib/NEXT.pm b/lib/NEXT.pm index e41065c86d..68b3df2547 100644 --- a/lib/NEXT.pm +++ b/lib/NEXT.pm @@ -1,13 +1,14 @@ package NEXT; +$VERSION = '0.50'; use Carp; use strict; sub ancestors { - my @inlist = @_; + my @inlist = shift; my @outlist = (); - while (@inlist) { - push @outlist, shift @inlist; + while (my $next = shift @inlist) { + push @outlist, $next; no strict 'refs'; unshift @inlist, @{"$outlist[-1]::ISA"}; } @@ -25,11 +26,13 @@ sub AUTOLOAD croak "Can't call $wanted from $caller" unless $caller_method eq $wanted_method; - local $NEXT::NEXT{$self,$wanted_method} = - $NEXT::NEXT{$self,$wanted_method}; + local ($NEXT::NEXT{$self,$wanted_method}, $NEXT::SEEN) = + ($NEXT::NEXT{$self,$wanted_method}, $NEXT::SEEN); - unless (@{$NEXT::NEXT{$self,$wanted_method}||[]}) { - my @forebears = ancestors ref $self; + + unless ($NEXT::NEXT{$self,$wanted_method}) { + my @forebears = + ancestors ref $self || $self, $wanted_class; while (@forebears) { last if shift @forebears eq $caller_class } @@ -38,22 +41,34 @@ sub AUTOLOAD map { *{"${_}::$caller_method"}{CODE}||() } @forebears unless $wanted_method eq 'AUTOLOAD'; @{$NEXT::NEXT{$self,$wanted_method}} = - map { (*{"${_}::AUTOLOAD"}{CODE}) ? - "${_}::AUTOLOAD" : () } @forebears + map { (*{"${_}::AUTOLOAD"}{CODE}) ? "${_}::AUTOLOAD" : ()} @forebears unless @{$NEXT::NEXT{$self,$wanted_method}||[]}; } my $call_method = shift @{$NEXT::NEXT{$self,$wanted_method}}; - return unless defined $call_method; - if (ref $call_method eq 'CODE') { - return shift()->$call_method(@_) - } - else { # AN AUTOLOAD - no strict 'refs'; - ${$call_method} = $caller_method eq 'AUTOLOAD' && ${"${caller_class}::AUTOLOAD"} || $wanted; - return $call_method->(@_); + while ($wanted_class =~ /^NEXT:.*:UNSEEN/ && defined $call_method + && $NEXT::SEEN->{$self,$call_method}++) { + $call_method = shift @{$NEXT::NEXT{$self,$wanted_method}}; } + unless (defined $call_method) { + return unless $wanted_class =~ /^NEXT:.*:ACTUAL/; + (local $Carp::CarpLevel)++; + croak qq(Can't locate object method "$wanted_method" ), + qq(via package "$caller_class"); + }; + return shift()->$call_method(@_) if ref $call_method eq 'CODE'; + no strict 'refs'; + ($wanted_method=${$caller_class."::AUTOLOAD"}) =~ s/.*::// + if $wanted_method eq 'AUTOLOAD'; + $$call_method = $caller_class."::NEXT::".$wanted_method; + return $call_method->(@_); } +no strict 'vars'; +package NEXT::UNSEEN; @ISA = 'NEXT'; +package NEXT::ACTUAL; @ISA = 'NEXT'; +package NEXT::ACTUAL::UNSEEN; @ISA = 'NEXT'; +package NEXT::UNSEEN::ACTUAL; @ISA = 'NEXT'; + 1; __END__ @@ -65,36 +80,36 @@ NEXT.pm - Provide a pseudo-class NEXT that allows method redispatch =head1 SYNOPSIS - use NEXT; + use NEXT; - package A; - sub A::method { print "$_[0]: A method\n"; $_[0]->NEXT::method() } - sub A::DESTROY { print "$_[0]: A dtor\n"; $_[0]->NEXT::DESTROY() } + package A; + sub A::method { print "$_[0]: A method\n"; $_[0]->NEXT::method() } + sub A::DESTROY { print "$_[0]: A dtor\n"; $_[0]->NEXT::DESTROY() } - package B; - use base qw( A ); - sub B::AUTOLOAD { print "$_[0]: B AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } - sub B::DESTROY { print "$_[0]: B dtor\n"; $_[0]->NEXT::DESTROY() } + package B; + use base qw( A ); + sub B::AUTOLOAD { print "$_[0]: B AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } + sub B::DESTROY { print "$_[0]: B dtor\n"; $_[0]->NEXT::DESTROY() } - package C; - sub C::method { print "$_[0]: C method\n"; $_[0]->NEXT::method() } - sub C::AUTOLOAD { print "$_[0]: C AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } - sub C::DESTROY { print "$_[0]: C dtor\n"; $_[0]->NEXT::DESTROY() } + package C; + sub C::method { print "$_[0]: C method\n"; $_[0]->NEXT::method() } + sub C::AUTOLOAD { print "$_[0]: C AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } + sub C::DESTROY { print "$_[0]: C dtor\n"; $_[0]->NEXT::DESTROY() } - package D; - use base qw( B C ); - sub D::method { print "$_[0]: D method\n"; $_[0]->NEXT::method() } - sub D::AUTOLOAD { print "$_[0]: D AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } - sub D::DESTROY { print "$_[0]: D dtor\n"; $_[0]->NEXT::DESTROY() } + package D; + use base qw( B C ); + sub D::method { print "$_[0]: D method\n"; $_[0]->NEXT::method() } + sub D::AUTOLOAD { print "$_[0]: D AUTOLOAD\n"; $_[0]->NEXT::AUTOLOAD() } + sub D::DESTROY { print "$_[0]: D dtor\n"; $_[0]->NEXT::DESTROY() } - package main; + package main; - my $obj = bless {}, "D"; + my $obj = bless {}, "D"; - $obj->method(); # Calls D::method, A::method, C::method - $obj->missing_method(); # Calls D::AUTOLOAD, B::AUTOLOAD, C::AUTOLOAD + $obj->method(); # Calls D::method, A::method, C::method + $obj->missing_method(); # Calls D::AUTOLOAD, B::AUTOLOAD, C::AUTOLOAD - # Clean-up calls D::DESTROY, B::DESTROY, A::DESTROY, C::DESTROY + # Clean-up calls D::DESTROY, B::DESTROY, A::DESTROY, C::DESTROY =head1 DESCRIPTION @@ -126,10 +141,150 @@ particular call, it might choose to redispatch that call, in the hope that some other C<AUTOLOAD> (above it, or to its left) might do better. +By default, if a redispatch attempt fails to find another method +elsewhere in the objects class hierarchy, it quietly gives up and does +nothing (but see L<"Enforcing redispatch">). This gracious acquiesence +is also unlike the (generally annoying) behaviour of C<SUPER>, which +throws an exception if it cannot redispatch. + Note that it is a fatal error for any method (including C<AUTOLOAD>) -to attempt to redispatch any method except itself. For example: +to attempt to redispatch any method that does not have the +same name. For example: + + sub D::oops { print "oops!\n"; $_[0]->NEXT::other_method() } + + +=head2 Enforcing redispatch + +It is possible to make C<NEXT> redispatch more demandingly (i.e. like +C<SUPER> does), so that the redispatch throws an exception if it cannot +find a "next" method to call. + +To do this, simple invoke the redispatch as: + + $self->NEXT::ACTUAL::method(); + +rather than: + + $self->NEXT::method(); + +The C<ACTUAL> tells C<NEXT> that there must actually be a next method to call, +or it should throw an exception. + +C<NEXT::ACTUAL> is most commonly used in C<AUTOLOAD> methods, as a means to +decline an C<AUTOLOAD> request, but preserve the normal exception-on-failure +semantics: + + sub AUTOLOAD { + if ($AUTOLOAD =~ /foo|bar/) { + # handle here + } + else { # try elsewhere + shift()->NEXT::ACTUAL::AUTOLOAD(@_); + } + } + +By using C<NEXT::ACTUAL>, if there is no other C<AUTOLOAD> to handle the +method call, an exception will be thrown (as usually happens in the absence of +a suitable C<AUTOLOAD>). + + +=head2 Avoiding repetitions + +If C<NEXT> redispatching is used in the methods of a "diamond" class hierarchy: + + # A B + # / \ / + # C D + # \ / + # E + + use NEXT; + + package A; + sub foo { print "called A::foo\n"; shift->NEXT::foo() } + + package B; + sub foo { print "called B::foo\n"; shift->NEXT::foo() } + + package C; @ISA = qw( A ); + sub foo { print "called C::foo\n"; shift->NEXT::foo() } + + package D; @ISA = qw(A B); + sub foo { print "called D::foo\n"; shift->NEXT::foo() } + + package E; @ISA = qw(C D); + sub foo { print "called E::foo\n"; shift->NEXT::foo() } + + E->foo(); + +then derived classes may (re-)inherit base-class methods through two or +more distinct paths (e.g. in the way C<E> inherits C<A::foo> twice -- +through C<C> and C<D>). In such cases, a sequence of C<NEXT> redispatches +will invoke the multiply inherited method as many times as it is +inherited. For example, the above code prints: + + called E::foo + called C::foo + called A::foo + called D::foo + called A::foo + called B::foo + +(i.e. C<A::foo> is called twice). + +In some cases this I<may> be the desired effect within a diamond hierarchy, +but in others (e.g. for destructors) it may be more appropriate to +call each method only once during a sequence of redispatches. + +To cover such cases, you can redispatch methods via: + + $self->NEXT::UNSEEN::method(); + +rather than: + + $self->NEXT::method(); + +This causes the redispatcher to skip any classes in the hierarchy that it has +already visited in an earlier redispatch. So, for example, if the +previous example were rewritten: + + package A; + sub foo { print "called A::foo\n"; shift->NEXT::UNSEEN::foo() } + + package B; + sub foo { print "called B::foo\n"; shift->NEXT::UNSEEN::foo() } + + package C; @ISA = qw( A ); + sub foo { print "called C::foo\n"; shift->NEXT::UNSEEN::foo() } + + package D; @ISA = qw(A B); + sub foo { print "called D::foo\n"; shift->NEXT::UNSEEN::foo() } + + package E; @ISA = qw(C D); + sub foo { print "called E::foo\n"; shift->NEXT::UNSEEN::foo() } + + E->foo(); + +then it would print: + + called E::foo + called C::foo + called A::foo + called D::foo + called B::foo + +and omit the second call to C<A::foo>. + +Note that you can also use: + + $self->NEXT::UNSEEN::ACTUAL::method(); + +or: + + $self->NEXT::ACTUAL::UNSEEN::method(); - sub D::oops { print "oops!\n"; $_[0]->NEXT::other_method() } +to get both unique invocation I<and> exception-on-failure. =head1 AUTHOR diff --git a/lib/NEXT/Changes b/lib/NEXT/Changes index bb5e27a7b8..f6f7bff1b2 100644 --- a/lib/NEXT/Changes +++ b/lib/NEXT/Changes @@ -20,3 +20,20 @@ Revision history for Perl extension NEXT.pm. - Fixed setting of $AUTOLOAD in NEXT'd AUTOLOADS (thanks Leonid) - Changed licence for inclusion in core distribution + + +0.50 Fri Nov 16 11:20:40 2001 + + - Added a $VERSION (oops!) + + - Fixed handling of diamond patterns (thanks Paul) + + - Added NEXT::ACTUAL to require existence of next method (thanks Paul) + + - Added NEXT::UNSEEN to avoid calling multiply inherited + methods twice (thanks Paul) + + - Re-fixed setting of $AUTOLOAD in NEXT'd AUTOLOADS to be + consistent with more useful SUPER:: behaviour + + - Corified tests diff --git a/lib/NEXT/README b/lib/NEXT/README index 7202d00fde..ad750bcdb4 100644 --- a/lib/NEXT/README +++ b/lib/NEXT/README @@ -1,5 +1,5 @@ ============================================================================== - Release of version 0.02 of NEXT + Release of version 0.50 of NEXT ============================================================================== @@ -31,10 +31,9 @@ DESCRIPTION redispatch that call, in the hope that some other C<AUTOLOAD> (above it, or to its left) might do better. - Note that it is a fatal error for any method (including C<AUTOLOAD>) - to attempt to redispatch any method except itself. For example: - - sub D::oops { $_[0]->NEXT::other_method() } # BANG! + The module also allows you to specify that multiply inherited + methods should only be redispatched once, and what should + happen if no redispatch is possible. AUTHOR @@ -51,12 +50,22 @@ COPYRIGHT ============================================================================== -CHANGES IN VERSION 0.02 +CHANGES IN VERSION 0.50 + + + - Added a $VERSION (oops!) + + - Fixed handling of diamond patterns (thanks Paul) + + - Added NEXT::ACTUAL to require existence of next method (thanks Paul) + - Added NEXT::UNSEEN to avoid calling multiply inherited + methods twice (thanks Paul) - - Fixed setting of $AUTOLOAD in NEXT'd AUTOLOADS (thanks Leonid) + - Re-fixed setting of $AUTOLOAD in NEXT'd AUTOLOADS to be + consistent with more useful SUPER:: behaviour - - Changed licence for inclusion in core distribution + - Corified tests ============================================================================== diff --git a/lib/NEXT/t/actual.t b/lib/NEXT/t/actual.t new file mode 100644 index 0000000000..e45184052b --- /dev/null +++ b/lib/NEXT/t/actual.t @@ -0,0 +1,37 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + +BEGIN { print "1..9\n"; } +use NEXT; + +my $count=1; + +package A; +@ISA = qw/B C D/; + +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::test;} + +package B; +@ISA = qw/C D/; +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::test;} + +package C; +@ISA = qw/D/; +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::test;} + +package D; + +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::test;} + +package main; + +my $foo = {}; + +bless($foo,"A"); + +eval { $foo->test } and print "not "; +print "ok 9\n"; diff --git a/lib/NEXT/t/actuns.t b/lib/NEXT/t/actuns.t new file mode 100644 index 0000000000..3795681bc2 --- /dev/null +++ b/lib/NEXT/t/actuns.t @@ -0,0 +1,37 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + +BEGIN { print "1..5\n"; } +use NEXT; + +my $count=1; + +package A; +@ISA = qw/B C D/; + +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::ACTUAL::test;} + +package B; +@ISA = qw/C D/; +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::UNSEEN::test;} + +package C; +@ISA = qw/D/; +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::ACTUAL::test;} + +package D; + +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::ACTUAL::UNSEEN::test;} + +package main; + +my $foo = {}; + +bless($foo,"A"); + +eval { $foo->test } and print "not "; +print "ok 5\n"; diff --git a/lib/NEXT/test.pl b/lib/NEXT/t/next.t index 0ba0b663bf..8cc493f318 100644 --- a/lib/NEXT/test.pl +++ b/lib/NEXT/t/next.t @@ -1,4 +1,9 @@ -#! /usr/local/bin/perl -w +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} BEGIN { print "1..25\n"; } diff --git a/lib/NEXT/t/unseen.t b/lib/NEXT/t/unseen.t new file mode 100644 index 0000000000..af8d1f7612 --- /dev/null +++ b/lib/NEXT/t/unseen.t @@ -0,0 +1,36 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + +BEGIN { print "1..4\n"; } +use NEXT; + +my $count=1; + +package A; +@ISA = qw/B C D/; + +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::test;} + +package B; +@ISA = qw/C D/; +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::test;} + +package C; +@ISA = qw/D/; +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::test;} + +package D; + +sub test { print "ok ", $count++, "\n"; $_[0]->NEXT::UNSEEN::test;} + +package main; + +my $foo = {}; + +bless($foo,"A"); + +$foo->test; diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm index 515a4820e3..9586f8e373 100644 --- a/lib/Pod/Html.pm +++ b/lib/Pod/Html.pm @@ -10,6 +10,7 @@ $VERSION = 1.04; use Carp; use Config; use Cwd; +use File::Spec; use File::Spec::Unix; use Getopt::Long; @@ -220,7 +221,7 @@ my $htmlfileurl = "" ; # The url that other files would use to # other files. my $podfile = ""; # read from stdin by default my @podpath = (); # list of directories containing library pods. -my $podroot = "."; # filesystem base directory from which all +my $podroot = File::Spec->curdir; # filesystem base directory from which all # relative paths in $podpath stem. my $css = ''; # Cascading style sheet my $recurse = 1; # recurse on subdirectories in $podpath. @@ -267,7 +268,7 @@ $htmldir = ""; # The directory to which the html pages $htmlfile = ""; # write to stdout by default $podfile = ""; # read from stdin by default @podpath = (); # list of directories containing library pods. -$podroot = "."; # filesystem base directory from which all +$podroot = File::Spec->curdir; # filesystem base directory from which all # relative paths in $podpath stem. $css = ''; # Cascading style sheet $recurse = 1; # recurse on subdirectories in $podpath. diff --git a/lib/Text/Balanced.pm b/lib/Text/Balanced.pm index b9a33cb01f..06e4fe1003 100644 --- a/lib/Text/Balanced.pm +++ b/lib/Text/Balanced.pm @@ -10,7 +10,7 @@ use Exporter; use SelfLoader; use vars qw { $VERSION @ISA %EXPORT_TAGS }; -$VERSION = '1.86'; +$VERSION = '1.89'; @ISA = qw ( Exporter ); %EXPORT_TAGS = ( ALL => [ qw( @@ -429,6 +429,9 @@ sub extract_variable (;$$) sub _match_variable($$) { +# $# +# $^ +# $$ my ($textref, $pre) = @_; my $startpos = pos($$textref) = pos($$textref)||0; unless ($$textref =~ m/\G($pre)/gc) @@ -437,19 +440,24 @@ sub _match_variable($$) return; } my $varpos = pos($$textref); - unless ($$textref =~ m/\G(\$#?|[*\@\%]|\\&)+/gc) + unless ($$textref =~ m{\G\$\s*(\d+|[][&`'+*./|,";%=~:?!\@<>()-]|\^[a-z]?)}gci) { + unless ($$textref =~ m/\G((\$#?|[*\@\%]|\\&)+)/gc) + { _failmsg "Did not find leading dereferencer", pos $$textref; pos $$textref = $startpos; return; - } + } + my $deref = $1; - unless ($$textref =~ m/\G\s*(?:::|')?(?:[_a-z]\w*(?:::|'))*[_a-z]\w*/gci - or _match_codeblock($textref, "", '\{', '\}', '\{', '\}', 0)) - { + unless ($$textref =~ m/\G\s*(?:::|')?(?:[_a-z]\w*(?:::|'))*[_a-z]\w*/gci + or _match_codeblock($textref, "", '\{', '\}', '\{', '\}', 0) + or $deref eq '$#' or $deref eq '$$' ) + { _failmsg "Bad identifier after dereferencer", pos $$textref; pos $$textref = $startpos; return; + } } while (1) @@ -854,13 +862,13 @@ sub extract_multiple (;$$$$) # ($text, $functions_ref, $max_fields, $ignoreunkno my ($lastpos, $firstpos); my @fields = (); - for ($$textref) + #for ($$textref) { my @func = defined $_[1] ? @{$_[1]} : @{$def_func}; my $max = defined $_[2] && $_[2]>0 ? $_[2] : 1_000_000_000; my $igunk = $_[3]; - pos ||= 0; + pos $$textref ||= 0; unless (wantarray) { @@ -888,51 +896,57 @@ sub extract_multiple (;$$$$) # ($text, $functions_ref, $max_fields, $ignoreunkno } } - FIELD: while (pos() < length()) + FIELD: while (pos($$textref) < length($$textref)) { my $field; + my @bits; foreach my $i ( 0..$#func ) { + my $pref; $func = $func[$i]; $class = $class[$i]; - $lastpos = pos; + $lastpos = pos $$textref; if (ref($func) eq 'CODE') - { ($field) = $func->($_) } + { ($field,undef,$pref) = @bits = $func->($$textref) } elsif (ref($func) eq 'Text::Balanced::Extractor') - { $field = $func->extract($_) } - elsif( m/\G$func/gc ) - { $field = defined($1) ? $1 : $& } - + { @bits = $field = $func->extract($$textref) } + elsif( $$textref =~ m/\G$func/gc ) + { @bits = $field = defined($1) ? $1 : $& } + $pref ||= ""; if (defined($field) && length($field)) { - if (defined($unkpos) && !$igunk) - { - push @fields, substr($_, $unkpos, $lastpos-$unkpos); - $firstpos = $unkpos unless defined $firstpos; - undef $unkpos; - last FIELD if @fields == $max; + if (!$igunk) { + $unkpos = pos $$textref + if length($pref) && !defined($unkpos); + if (defined $unkpos) + { + push @fields, substr($$textref, $unkpos, $lastpos-$unkpos).$pref; + $firstpos = $unkpos unless defined $firstpos; + undef $unkpos; + last FIELD if @fields == $max; + } } - push @fields, $class - ? bless(\$field, $class) + push @fields, $class + ? bless (\$field, $class) : $field; $firstpos = $lastpos unless defined $firstpos; - $lastpos = pos; + $lastpos = pos $$textref; last FIELD if @fields == $max; next FIELD; } } - if (/\G(.)/gcs) + if ($$textref =~ /\G(.)/gcs) { - $unkpos = pos()-1 + $unkpos = pos($$textref)-1 unless $igunk || defined $unkpos; } } if (defined $unkpos) { - push @fields, substr($_, $unkpos); + push @fields, substr($$textref, $unkpos); $firstpos = $unkpos unless defined $firstpos; - $lastpos = length; + $lastpos = length $$textref; } last; } @@ -1925,13 +1939,18 @@ such substrings are skipped. Otherwise, they are returned. =back The extraction process works by applying each extractor in -sequence to the text string. If the extractor is a subroutine it -is called in a list -context and is expected to return a list of a single element, namely -the extracted text. -Note that the value returned by an extractor subroutine need not bear any -relationship to the corresponding substring of the original text (see -examples below). +sequence to the text string. + +If the extractor is a subroutine it is called in a list context and is +expected to return a list of a single element, namely the extracted +text. It may optionally also return two further arguments: a string +representing the text left after extraction (like $' for a pattern +match), and a string representing any prefix skipped before the +extraction (like $` in a pattern match). Note that this is designed +to facilitate the use of other Text::Balanced subroutines with +C<extract_multiple>. Note too that the value returned by an extractor +subroutine need not bear any relationship to the corresponding substring +of the original text (see examples below). If the extractor is a precompiled regular expression or a string, it is matched against the text in a scalar context with a leading diff --git a/lib/Text/Balanced/Changes b/lib/Text/Balanced/Changes index 5b34b73abb..2b42f94402 100644 --- a/lib/Text/Balanced/Changes +++ b/lib/Text/Balanced/Changes @@ -246,3 +246,18 @@ Revision history for Perl extension Text::Balanced. - Consolidated POD in .pm file - renamed tests to let DOS cope with them + + +1.87 Thu Nov 15 21:25:35 2001 + + - Made extract_multiple aware of skipped prefixes returned + by subroutine extractors (such as extract_quotelike, etc.) + + - Made extract_variable aware of punctuation variables + + - Corified tests + + +1.89 Sun Nov 18 22:49:50 2001 + + - Fixed extvar.t tests diff --git a/lib/Text/Balanced/README b/lib/Text/Balanced/README index feba188b38..ef2f376fa4 100755 --- a/lib/Text/Balanced/README +++ b/lib/Text/Balanced/README @@ -1,5 +1,5 @@ ============================================================================== - Release of version 1.86 of Text::Balanced + Release of version 1.89 of Text::Balanced ============================================================================== @@ -66,14 +66,10 @@ COPYRIGHT ============================================================================== -CHANGES IN VERSION 1.86 +CHANGES IN VERSION 1.89 - - Revised licence for inclusion in core distribution - - - Consolidated POD in .pm file - - - renamed tests to let DOS cope with them + - Fixed extvar.t tests ============================================================================== diff --git a/lib/Text/Balanced/t/extbrk.t b/lib/Text/Balanced/t/extbrk.t index a36025ddb0..e2763e83ae 100644 --- a/lib/Text/Balanced/t/extbrk.t +++ b/lib/Text/Balanced/t/extbrk.t @@ -1,3 +1,10 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' diff --git a/lib/Text/Balanced/t/extcbk.t b/lib/Text/Balanced/t/extcbk.t index 10f974187b..69957ed758 100644 --- a/lib/Text/Balanced/t/extcbk.t +++ b/lib/Text/Balanced/t/extcbk.t @@ -1,3 +1,10 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' diff --git a/lib/Text/Balanced/t/extdel.t b/lib/Text/Balanced/t/extdel.t index c5ca88eebf..6db547f43a 100644 --- a/lib/Text/Balanced/t/extdel.t +++ b/lib/Text/Balanced/t/extdel.t @@ -1,3 +1,10 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' diff --git a/lib/Text/Balanced/t/extmul.t b/lib/Text/Balanced/t/extmul.t index 46addcc8b4..34207df2f3 100644 --- a/lib/Text/Balanced/t/extmul.t +++ b/lib/Text/Balanced/t/extmul.t @@ -1,3 +1,10 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' @@ -172,7 +179,7 @@ expect [ $text ], [ substr($stdtext2,4) ]; # TESTS 38-40 $text = $stdtext2; expect [ extract_multiple($text,[\&extract_bracketed]) ], - [ substr($stdtext2,0,15), substr($stdtext2,16,7), substr($stdtext2,23) ]; + [ substr($stdtext2,0,16), substr($stdtext2,16,7), substr($stdtext2,23) ]; expect [ pos $text], [ 24 ]; expect [ $text ], [ $stdtext2 ]; @@ -180,7 +187,7 @@ expect [ $text ], [ $stdtext2 ]; # TESTS 41-43 $text = $stdtext2; expect [ scalar extract_multiple($text,[\&extract_bracketed]) ], - [ substr($stdtext2,0,15) ]; + [ substr($stdtext2,0,16) ]; expect [ pos $text], [ 0 ]; expect [ $text ], [ substr($stdtext2,15) ]; @@ -206,7 +213,7 @@ expect [ $text ], [ substr($stdtext2,4) ]; # TESTS 50-52 $text = $stdtext2; expect [ extract_multiple($text,[\&extract_quotelike]) ], - [ substr($stdtext2,0,6), substr($stdtext2,7,5), substr($stdtext2,12) ]; + [ substr($stdtext2,0,7), substr($stdtext2,7,5), substr($stdtext2,12) ]; expect [ pos $text], [ length($text) ]; expect [ $text ], [ $stdtext2 ]; @@ -214,7 +221,7 @@ expect [ $text ], [ $stdtext2 ]; # TESTS 53-55 $text = $stdtext2; expect [ scalar extract_multiple($text,[\&extract_quotelike]) ], - [ substr($stdtext2,0,6) ]; + [ substr($stdtext2,0,7) ]; expect [ pos $text], [ 0 ]; expect [ $text ], [ substr($stdtext2,6) ]; diff --git a/lib/Text/Balanced/t/extqlk.t b/lib/Text/Balanced/t/extqlk.t index 217d7d1fd3..b5d9fe6782 100644 --- a/lib/Text/Balanced/t/extqlk.t +++ b/lib/Text/Balanced/t/extqlk.t @@ -1,3 +1,10 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + #! /usr/local/bin/perl -ws # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' diff --git a/lib/Text/Balanced/t/exttag.t b/lib/Text/Balanced/t/exttag.t index 764e7906bb..79a4e2e793 100644 --- a/lib/Text/Balanced/t/exttag.t +++ b/lib/Text/Balanced/t/exttag.t @@ -1,3 +1,10 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' diff --git a/lib/Text/Balanced/t/extvar.t b/lib/Text/Balanced/t/extvar.t index 93bd22b41c..f8a46bb4fa 100644 --- a/lib/Text/Balanced/t/extvar.t +++ b/lib/Text/Balanced/t/extvar.t @@ -1,3 +1,10 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' @@ -6,7 +13,7 @@ # Change 1..1 below to 1..last_test_to_print . # (It may become useful if the test is moved to ./t subdirectory.) -BEGIN { $| = 1; print "1..81\n"; } +BEGIN { $| = 1; print "1..181\n"; } END {print "not ok 1\n" unless $loaded;} use Text::Balanced qw ( extract_variable ); $loaded = 1; @@ -58,6 +65,7 @@ $a->; $a (1..3) { print $a }; # USING: extract_variable($str); +$obj->nextval; *var; *$var; *{var}; @@ -91,6 +99,55 @@ $#_; $#array; $#{array}; $var[$#var]; +$1; +$11; +$&; +$`; +$'; +$+; +$*; +$.; +$/; +$|; +$,; +$"; +$;; +$#; +$%; +$=; +$-; +$~; +$^; +$:; +$^L; +$^A; +$?; +$!; +$^E; +$@; +$$; +$<; +$>; +$(; +$); +$[; +$]; +$^C; +$^D; +$^F; +$^H; +$^I; +$^M; +$^O; +$^P; +$^R; +$^S; +$^T; +$^V; +$^W; +${^WARNING_BITS}; +${^WIDE_SYSTEM_CALLS}; +$^X; # THESE SHOULD FAIL $a->; diff --git a/lib/Text/Balanced/t/gentag.t b/lib/Text/Balanced/t/gentag.t index 4e68b4117a..ae94c54567 100644 --- a/lib/Text/Balanced/t/gentag.t +++ b/lib/Text/Balanced/t/gentag.t @@ -1,3 +1,10 @@ +BEGIN { + if ($ENV{PERL_CORE}) { + chdir('t') if -d 't'; + @INC = qw(../lib); + } +} + # Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' diff --git a/lib/open.t b/lib/open.t index 5ee8ab9de0..9f1a8607f2 100644 --- a/lib/open.t +++ b/lib/open.t @@ -6,7 +6,7 @@ BEGIN { require Config; import Config; } -use Test::More tests => 13; +use Test::More tests => 16; # open::import expects 'open' as its first argument, but it clashes with open() sub import { @@ -26,11 +26,13 @@ is( $^H & $open::hint_bits, 0, 'hint bits should not be set in $^H before open import' ); # prevent it from loading I18N::Langinfo, so we can test encoding failures -local @INC; -$ENV{LC_ALL} = $ENV{LANG} = ''; -eval { import( 'IN', 'locale' ) }; -like( $@, qr/Cannot figure out an encoding/, - 'no encoding should be found without $ENV{LANG} or $ENV{LC_ALL}' ); +{ + local @INC; + $ENV{LC_ALL} = $ENV{LANG} = ''; + eval { import( 'IN', 'locale' ) }; + like( $@, qr/Cannot figure out an encoding/, + 'no encoding should be found without $ENV{LANG} or $ENV{LC_ALL}' ); +} my $warn; local $SIG{__WARN__} = sub { @@ -69,19 +71,106 @@ is( ${^OPEN}, ":raw :crlf\0:raw :crlf", is( $^H{'open_IO'}, 'crlf', 'should record last layer set in %^H' ); SKIP: { - skip("no perlio, no :utf8", 1) unless $Config{'useperlio'}; -# the special :utf8 layer + skip("no perlio, no :utf8", 4) unless $Config{'useperlio'}; + use open ':utf8'; open(O, ">utf8"); print O chr(0x100); close O; open(I, "<utf8"); - is(ord(<I>), 0x100, ":utf8"); + is(ord(<I>), 0x100, ":utf8 single wide character round-trip"); close I; + + open F, ">a"; + @a = map { chr(1 << ($_ << 2)) } 0..5; # 0x1, 0x10, .., 0x100000 + unshift @a, chr(0); # ... and a null byte in front just for fun + print F @a; + close F; + + sub systell { + use Fcntl 'SEEK_CUR'; + sysseek($_[0], 0, SEEK_CUR); + } + + require bytes; # not use + + my $ok; + + open F, "<:utf8", "a"; + $ok = $a = 0; + for (@a) { + unless ( + ($c = sysread(F, $b, 1)) == 1 && + length($b) == 1 && + ord($b) == ord($_) && + systell(F) == ($a += bytes::length($b)) + ) { + print '# ord($_) == ', ord($_), "\n"; + print '# ord($b) == ', ord($b), "\n"; + print '# length($b) == ', length($b), "\n"; + print '# bytes::length($b) == ', bytes::length($b), "\n"; + print '# systell(F) == ', systell(F), "\n"; + print '# $a == ', $a, "\n"; + print '# $c == ', $c, "\n"; + last; + } + $ok++; + } + close F; + ok($ok == @a, + "on :utf8 streams sysread() should work on characters, not bytes"); + + # syswrite() on should work on characters, not bytes + open G, ">:utf8", "b"; + $ok = $a = 0; + for (@a) { + unless ( + ($c = syswrite(G, $_, 1)) == 1 && + systell(G) == ($a += bytes::length($_)) + ) { + print '# ord($_) == ', ord($_), "\n"; + print '# bytes::length($_) == ', bytes::length($_), "\n"; + print '# systell(G) == ', systell(G), "\n"; + print '# $a == ', $a, "\n"; + print '# $c == ', $c, "\n"; + print "not "; + last; + } + $ok++; + } + close G; + ok($ok == @a, + "on :utf8 streams syswrite() should work on characters, not bytes"); + + open G, "<:utf8", "b"; + $ok = $a = 0; + for (@a) { + unless ( + ($c = sysread(G, $b, 1)) == 1 && + length($b) == 1 && + ord($b) == ord($_) && + systell(G) == ($a += bytes::length($_)) + ) { + print '# ord($_) == ', ord($_), "\n"; + print '# ord($b) == ', ord($b), "\n"; + print '# length($b) == ', length($b), "\n"; + print '# bytes::length($b) == ', bytes::length($b), "\n"; + print '# systell(G) == ', systell(G), "\n"; + print '# $a == ', $a, "\n"; + print '# $c == ', $c, "\n"; + last; + } + $ok++; + } + close G; + ok($ok == @a, + "checking syswrite() output on :utf8 streams by reading it back in"); } END { 1 while unlink "utf8"; + 1 while unlink "a"; + 1 while unlink "b"; } # the test cases beyond __DATA__ need to be executed separately @@ -273,6 +273,12 @@ perl_construct(pTHXx) New(31337, PL_reentrant_buffer->tmbuff,1, struct tm); #endif +#ifdef DEBUGGING + sv_setpvn(PERL_DEBUG_PAD(0), "", 0); + sv_setpvn(PERL_DEBUG_PAD(1), "", 0); + sv_setpvn(PERL_DEBUG_PAD(2), "", 0); +#endif + /* Note that strtab is a rather special HV. Assumptions are made about not iterating on it, and not adding tie magic to it. It is properly deallocated in perl_destruct() */ @@ -2770,6 +2776,11 @@ sed %s -e \"/^[^#]/b\" \ Perl_croak(aTHX_ "Can't do seteuid!\n"); } #endif /* IAMSUID */ + + DEBUG_P(PerlIO_printf(Perl_debug_log, + "PL_preprocess: cmd=\"%s\"\n", + SvPVX(cmd))); + PL_rsfp = PerlProc_popen(SvPVX(cmd), "r"); SvREFCNT_dec(cmd); SvREFCNT_dec(cpp); @@ -3106,6 +3106,18 @@ enum { /* pass one of these to get_vtbl */ #define RsPARA(sv) (SvPOK(sv) && ! SvCUR(sv)) #define RsRECORD(sv) (SvROK(sv) && (SvIV(SvRV(sv)) > 0)) +#ifdef DEBUGGING +/* A struct for keeping various DEBUGGING related stuff + * neatly packed. Currently only scratch variables for + * constructing debug output are included. */ +struct perl_debug_pad { + SV pad[3]; +}; + +#define PERL_DEBUG_PAD(i) &(PL_debug_pad.pad[i]) +#define PERL_DEBUG_PAD_ZERO(i) (sv_setpvn(PERL_DEBUG_PAD(i), "", 0), PERL_DEBUG_PAD(i)) +#endif + /* Enable variables which are pointers to functions */ typedef void (CPERLscope(*peep_t))(pTHX_ OP* o); typedef regexp*(CPERLscope(*regcomp_t)) (pTHX_ char* exp, char* xend, PMOP* pm); @@ -183,6 +183,8 @@ END_EXTERN_C #define PL_debstash (*Perl_Idebstash_ptr(aTHX)) #undef PL_debug #define PL_debug (*Perl_Idebug_ptr(aTHX)) +#undef PL_debug_pad +#define PL_debug_pad (*Perl_Idebug_pad_ptr(aTHX)) #undef PL_def_layerlist #define PL_def_layerlist (*Perl_Idef_layerlist_ptr(aTHX)) #undef PL_defgv diff --git a/pod/perldelta.pod b/pod/perldelta.pod index f2505e8dac..0a4c558d87 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -9,87 +9,13 @@ This document describes differences between the 5.6.0 release and the =head1 Incompatible Changes -=over 4 - -=item * - -The semantics of bless(REF, REF) were unclear and until someone proves -it to make some sense, it is forbidden. - -=item * - -A reference to a reference now stringify as "REF(0x81485ec)" instead -of "SCALAR(0x81485ec)" in order to be more consistent with the return -value of ref(). - -=item * - -The very dusty examples in the eg/ directory have been removed. -Suggestions for new shiny examples welcome but the main issue is that -the examples need to be documented, tested and (most importantly) -maintained. - -=item * - -The obsolete chat2 library that should never have been allowed -to escape the laboratory has been decommissioned. - -=item * - -The unimplemented POSIX regex features [[.cc.]] and [[=c=]] are still -recognised but now cause fatal errors. The previous behaviour of -ignoring them by default and warning if requested was unacceptable -since it, in a way, falsely promised that the features could be used. - -=item * - -The (bogus) escape sequences \8 and \9 now give an optional warning -("Unrecognized escape passed through"). There is no need to \-escape -any C<\w> character. - -=item * - -lstat(FILEHANDLE) now gives a warning because the operation makes no sense. -In future releases this may become a fatal error. - -=item * - -The long deprecated uppercase aliases for the string comparison -operators (EQ, NE, LT, LE, GE, GT) have now been removed. - -=item * - -The regular expression captured submatches ($1, $2, ...) are now -more consistently unset if the match fails, instead of leaving false -data lying around in them. - -=item * - -The tr///C and tr///U features have been removed and will not return; -the interface was a mistake. Sorry about that. For similar -functionality, see pack('U0', ...) and pack('C0', ...). - -=item * - -Although "you shouldn't do that", it was possible to write code that -depends on Perl's hashed key order (Data::Dumper does this). The new -algorithm "One-at-a-Time" produces a different hashed key order. -More details are in L</"Performance Enhancements">. - -=item * - -The list of filenames from glob() (or <...>) is now by default sorted -alphabetically to be csh-compliant. (bsd_glob() does still sort platform -natively, ASCII or EBCDIC, unless GLOB_ALPHASORT is specified.) - -=back - =head2 64-bit platforms and malloc If your pointers are 64 bits wide, the Perl malloc is no more being used because it simply does not work with 8-byte pointers. Also, -usually the system malloc on such platforms are much better optimized -for such large memory models than the Perl malloc. +usually the system mallocs on such platforms are much better optimized +for such large memory models than the Perl malloc. Such platforms +include 64-bit Alpha, MIPS, HPPA, PPC, and Sparc. =head2 AIX Dynaloading @@ -134,6 +60,12 @@ though, by appending C<Block> to the name: C<\p{InHebrewBlock}> means what C<\p{InHebrew}> meant in perl 5.6.0. For the full list of affected character classes, see L<perlunicode/Blocks>. +=head2 Perl Parser Stress Tested + +The Perl parser has been stress tested using both random input and +Markov chain input and the few found crashes and lockups have been +fixed. + =head2 Deprecations The current user-visible implementation of pseudo-hashes (the weird @@ -146,55 +78,92 @@ available. The syntaxes C<@a->[...]> and C<@h->{...}> have now been deprecated. -The suidperl is also considered to be too much a risk to continue -maintaining and the suidperl code is likely to be removed in a future -release. +After years of trying the suidperl is considered to be too complex to +ever be considered truly secure. The suidperl functionality is likely +to be removed in a future release. The C<package;> syntax (C<package> without an argument has been deprecated. Its semantics were never that clear and its implementation even less so. If you have used that feature to disallow all but fully qualified variables, C<use strict;> instead. -The chdir(undef) and chdir('') behaviors to match chdir() has been -deprecated. In future versions, chdir(undef) and chdir('') will -simply fail. +=over 4 -=head1 Core Enhancements +=item * -=over 4 +The semantics of bless(REF, REF) were unclear and until someone proves +it to make some sense, it is forbidden. =item * -C<perl -d:Module=arg,arg,arg> now works (previously one couldn't pass -in multiple arguments.) +A reference to a reference now stringify as "REF(0x81485ec)" instead +of "SCALAR(0x81485ec)" in order to be more consistent with the return +value of ref(). =item * -my __PACKAGE__ $obj now works. +The very dusty examples in the eg/ directory have been removed. +Suggestions for new shiny examples welcome but the main issue is that +the examples need to be documented, tested and (most importantly) +maintained. =item * -C<no Module;> now works even if there is no "sub unimport" in the Module. +The obsolete chat2 library that should never have been allowed +to escape the laboratory has been decommissioned. =item * -The numerical comparison operators return C<undef> if either operand -is a NaN. Previously the behaviour was unspecified. +The unimplemented POSIX regex features [[.cc.]] and [[=c=]] are still +recognised but now cause fatal errors. The previous behaviour of +ignoring them by default and warning if requested was unacceptable +since it, in a way, falsely promised that the features could be used. =item * -C<pack('U0a*', ...)> can now be used to force a string to UTF8. +The (bogus) escape sequences \8 and \9 now give an optional warning +("Unrecognized escape passed through"). There is no need to \-escape +any C<\w> character. =item * -prototype(\&) is now available. +lstat(FILEHANDLE) now gives a warning because the operation makes no sense. +In future releases this may become a fatal error. + +=item * + +The long deprecated uppercase aliases for the string comparison +operators (EQ, NE, LT, LE, GE, GT) have now been removed. + +=item * + +The regular expression captured submatches ($1, $2, ...) are now +more consistently unset if the match fails, instead of leaving false +data lying around in them. + +=item * + +The tr///C and tr///U features have been removed and will not return; +the interface was a mistake. Sorry about that. For similar +functionality, see pack('U0', ...) and pack('C0', ...). + +=item * + +Although "you shouldn't do that", it was possible to write code that +depends on Perl's hashed key order (Data::Dumper does this). The new +algorithm "One-at-a-Time" produces a different hashed key order. +More details are in L</"Performance Enhancements">. =item * -There is now an UNTIE method. +The list of filenames from glob() (or <...>) is now by default sorted +alphabetically to be csh-compliant. (bsd_glob() does still sort platform +natively, ASCII or EBCDIC, unless GLOB_ALPHASORT is specified.) =back +=head1 Core Enhancements + =head2 AUTOLOAD Is Now Lvaluable AUTOLOAD is now lvaluable, meaning that you can add the :lvalue attribute @@ -344,14 +313,16 @@ deficiencies. This results hopefully in more accurate numbers. =item * -The rules for allowing underscores (underbars) in numeric constants -have been relaxed and simplified: now you can have an underscore -B<between digits>. +C<perl -d:Module=arg,arg,arg> now works (previously one couldn't pass +in multiple arguments.) =item * -GMAGIC (right-hand side magic) could in many cases such as string -concatenation be invoked too many times. +END blocks are now run even if you exit/die in a BEGIN block. +Internally, the execution of END blocks is now controlled by +PL_exit_flags & PERL_EXIT_DESTRUCT_END. This enables the new +behaviour for Perl embedders. This will default in 5.10. See +L<perlembed>. =item * @@ -370,38 +341,53 @@ Lvalue subroutines can now return C<undef> in list context. =item * -The C<op_clear> and C<op_null> are now exported. +A new special regular expression variable has been introduced: +C<$^N>, which contains the most-recently closed group (submatch). =item * -A new special regular expression variable has been introduced: -C<$^N>, which contains the most-recently closed group (submatch). +C<no Module;> now works even if there is no "sub unimport" in the Module. =item * -L<utime> now supports C<utime undef, undef, @files> to change the -file timestamps to the current time. +The numerical comparison operators return C<undef> if either operand +is a NaN. Previously the behaviour was unspecified. =item * -The Perl parser has been stress tested using both random input and -Markov chain input. +C<pack('U0a*', ...)> can now be used to force a string to UTF8. =item * -C<eval "v200"> now works. +my __PACKAGE__ $obj now works. =item * -VMS now works under PerlIO. +prototype(\&) is now available. =item * -END blocks are now run even if you exit/die in a BEGIN block. -The execution of END blocks is now controlled by -PL_exit_flags & PERL_EXIT_DESTRUCT_END. This enables the new -behaviour for perl embedders. This will default in 5.10. See -L<perlembed>. +Right-hand side magic (GMAGIC) could in many cases such as string +concatenation be invoked too many times. + +=item * + +The rules for allowing underscores (underbars) in numeric constants +have been relaxed and simplified: now you can have an underscore +simply B<between digits>. + +=item * + +An UNTIE method is now available. + +=item * + +L<utime> now supports C<utime undef, undef, @files> to change the +file timestamps to the current time. + +=item * + +C<eval "v200"> now works. =back @@ -413,47 +399,46 @@ L<perlembed>. =item * -File::Temp allows one to create temporary files and directories in an -easy, portable, and secure way. +C<Attribute::Handlers> allows a class to define attribute handlers. -=item * + package MyPack; + use Attribute::Handlers; + sub Wolf :ATTR(SCALAR) { print "howl!\n" } -Storable gives persistence to Perl data structures by allowing the -storage and retrieval of Perl data to and from files in a fast and -compact binary format. + # later, in some package using or inheriting from MyPack... -=item * + my MyPack $Fluffy : Wolf; # the attribute handler Wolf will be called -B::Concise, by Stephen McCamant, is a new compiler backend for -walking the Perl syntax tree, printing concise info about ops. -The output is highly customisable. - -See L<B::Concise> for more information. +Both variables and routines can have attribute handlers. Handlers can +be specific to type (SCALAR, ARRAY, HASH, or CODE), or specific to the +exact compilation phase (BEGIN, CHECK, INIT, or END). =item * -Class::ISA, by Sean Burke, for reporting the search path for a -class's ISA tree, has been added. - -See L<Class::ISA> for more information. +B<B::Concise> is a new compiler backend for walking the Perl syntax +tree, printing concise info about ops, from Stephen McCamant. The +output is highly customisable. See L<B::Concise>. =item * -Cwd has now a split personality: if possible, an extension is used, -(this will hopefully be both faster and more secure and robust) but -if not possible, the familiar Perl library implementation is used. +C<Class::ISA> for reporting the search path for a class's ISA tree, +by Sean Burke, has been added. See L<Class::ISA>. =item * -Digest, a frontend module for calculating digests (checksums), -from Gisle Aas, has been added. +C<Cwd> has now a split personality: if possible, an XS extension is +used, (this will hopefully be faster, more secure, and more robust) +but if not possible, the familiar Perl implementation is used. -See L<Digest> for more information. +=item * + +C<Digest>, frontend module for calculating digests (checksums), from +Gisle Aas, has been added. See L<Digest>. =item * -Digest::MD5 for calculating MD5 digests (checksums), by Gisle Aas, -has been added. +C<Digest::MD5> for calculating MD5 digests (checksums) as defined in +RFC 1321, from Gisle Aas, has been added. See L<Digest::MD5>. use Digest::MD5 'md5_hex'; @@ -461,29 +446,41 @@ has been added. print $digest, "\n"; # 01d19d9d2045e005c3f1b80e8b164de1 -NOTE: the MD5 backward compatibility module is deliberately not +NOTE: the C<MD5> backward compatibility module is deliberately not included since its use is discouraged. -See L<Digest::MD5> for more information. - =item * -Encode, by Nick Ing-Simmons, provides a mechanism to translate +C<Encode>, by Nick Ing-Simmons, provides a mechanism to translate between different character encodings. Support for Unicode, ISO-8859-*, ASCII, CP*, KOI8-R, and three variants of EBCDIC are compiled in to the module. Several other encodings (like Japanese, Chinese, and MacIntosh encodings) are included and will be loaded at -runtime. +runtime. See L<Encode>. Any encoding supported by Encode module is also available to the ":encoding()" layer if PerlIO is used. -See L<Encode> for more information. +=item * + +C<I18N::Langinfo> can be use to query locale information. +See L<I18N::Langinfo>. =item * -Filter::Simple is an easy-to-use frontend to Filter::Util::Call, -from Damian Conway. +C<I18N::LangTags> has functions for dealing with RFC3066-style +language tags, by Sean Burke. See <I18N::LangTags>. + +=item * + +C<ExtUtils::Constant> is a new tool for extension writers for +generating XS code to import C header constants, by Nicholas Clark. +See L<ExtUtils::Constant>. + +=item * + +C<Filter::Simple> is an easy-to-use frontend to Filter::Util::Call, +from Damian Conway. See L<Filter::Simple>. # in MyFilter.pm: @@ -508,21 +505,36 @@ from Damian Conway. print "red\n"; # this code is not filtered, will print "red\n" -See L<Filter::Simple> for more information. +=item * + +C<File::Temp> allows one to create temporary files and directories in +an easy, portable, and secure way, by Tim Jenness. See L<File::Temp>. =item * -Filter::Util::Call, by Paul Marquess, provides you with the -framework to write I<Source Filters> in Perl. For most uses -the frontend Filter::Simple is to be preferred. -See L<Filter::Util::Call> for more information. +C<Filter::Util::Call> provides you with the framework to write +I<Source Filters> in Perl, from Paul Marquess. For most uses the +frontend Filter::Simple is to be preferred. See L<Filter::Util::Call>. =item * -Locale::Constants, Locale::Country, Locale::Currency, and Locale::Language, -from Neil Bowers, have been added. They provide the codes for various -locale standards, such as "fr" for France, "usd" for US Dollar, and -"jp" for Japanese. +L<libnet> is a collection of perl5 modules related to network +programming, from Graham Barr. See L<Net::FTP>, L<Net::NNTP>, +L<Net::Ping>, L<Net::POP3>, L<Net::SMTP>, and L<Net::Time>. + +Perl installation leaves libnet unconfigured, use F<libnetcfg> to configure. + +=item * + +C<List::Util> is a selection of general-utility list subroutines, like +sum(), min(), first(), and shuffle(), by Graham barr. See L<List::Util>. + +=item * + +C<Locale::Constants>, C<Locale::Country>, C<Locale::Currency>, and +C<Locale::Language>, from Neil Bowers, have been added. They provide the +codes for various locale standards, such as "fr" for France, "usd" for +US Dollar, and "jp" for Japanese. use Locale::Country; @@ -530,11 +542,25 @@ locale standards, such as "fr" for France, "usd" for US Dollar, and $code = country2code('Norway'); # $code gets 'no' See L<Locale::Constants>, L<Locale::Country>, L<Locale::Currency>, -and L<Locale::Language> for more information. +and L<Locale::Language>. =item * -MIME::Base64, by Gisle Aas, allows you to encode data in base64. +C<Locale::Maketext> is localization framework from Sean Burke. See +L<Locale::Maketext>, and L<Locale::Maketext::TPJ13>. The latter is an +article about software localization, originally published in The Perl +Journal #13, republished here with kind permission. + +=item * + +C<Memoize> can make your functions faster by trading space for time, +from Mark-Jason Dominus. See L<Memoize>. + +=item * + +C<MIME::Base64> allows you to encode data in base64, from Gisle Aas, +as defined in RFC 2045 - I<MIME (Multipurpose Internet Mail +Extensions)>. use MIME::Base64; @@ -543,12 +569,13 @@ MIME::Base64, by Gisle Aas, allows you to encode data in base64. print $encoded, "\n"; # "QWxhZGRpbjpvcGVuIHNlc2FtZQ==" -See L<MIME::Base64> for more information. +See L<MIME::Base64>. =item * -MIME::QuotedPrint, by Gisle Aas, allows you to encode data in -quoted-printable encoding. +C<MIME::QuotedPrint> allows you to encode data in quoted-printable +encoding, as defined in RFC 2045 - I<MIME (Multipurpose Internet Mail +Extensions)>, from Gisle Aas. use MIME::QuotedPrint; @@ -563,37 +590,53 @@ necessary to use it with PerlIO::Via as in : use MIME::QuotedPrint; open($fh,">Via(MIME::QuotedPrint)",$path) -See L<MIME::QuotedPrint> for more information. +See L<MIME::QuotedPrint>. + +=item * + +C<NEXT> is pseudo-class for method redispatch, from Damian Conway. +See L<NEXT>. =item * -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 layer. Other future possibilities include -PerlIO::Array and PerlIO::Code. See L<PerlIO::Scalar> for more -information. +C<PerlIO::Scalar> provides the implementation of IO to "in memory" +Perl scalars as discussed above, from Nick Ing-Simmons. It also +serves as an example of a loadable PerlIO layer. Other future +possibilities include PerlIO::Array and PerlIO::Code. +See L<PerlIO::Scalar>. =item * -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). +C<PerlIO::Via> acts as a PerlIO layer and wraps PerlIO layer +functionality provided by a class (typically implemented in perl +code), from Nick Ing-Simmons. use MIME::QuotedPrint; open($fh,">Via(MIME::QuotedPrint)",$path) This will automatically convert everything output to C<$fh> -to Quoted-Printable. See L<PerlIO::Via> for more information. +to Quoted-Printable. See L<PerlIO::Via>. =item * -Pod::Text::Overstrike, by Joe Smith, has been added. +C<Pod::Text::Overstrike>, by Joe Smith, has been added. It converts POD data to formatted overstrike text. -See L<Pod::Text::Overstrike> for more information. +See L<Pod::Text::Overstrike>. + +=item * + +C<Scalar::Util> is a selection of general-utility scalar subroutines, +like blessed(), reftype(), and tainted(). See L<Scalar::Util>. =item * -Switch from Damian Conway has been added. Just by saying +C<Storable> gives persistence to Perl data structures by allowing the +storage and retrieval of Perl data to and from files in a fast and +compact binary format, from Raphael Manfredi. See L<Storable>. + +=item * + +C<Switch>, from Damian Conway, has been added. Just by saying use Switch; @@ -615,12 +658,22 @@ you have C<switch> and C<case> available in Perl. else { print "previous case not true" } } -See L<Switch> for more information. +See L<Switch>. =item * -Text::Balanced from Damian Conway has been added, for -extracting delimited text sequences from strings. +C<Test::More> is yet another framework for writing test scripts, +more extensive than Test::Simple, by Michael Schwern. See L<Test::More>. + +=item * + +C<Test::Simple> has the- basic utilities for writing tests, by Michael +Schwern. See L<Test::Simple>. + +=item * + +C<Text::Balanced> has been added, for extracting delimited text +sequences from strings, from Damian Conway. use Text::Balanced 'extract_delimited'; @@ -632,87 +685,53 @@ In addition to extract_delimited() there are also extract_bracketed(), extract_quotelike(), extract_codeblock(), extract_variable(), extract_tagged(), extract_multiple(), gen_delimited_pat(), and gen_extract_tagged(). With these you can implement rather advanced -parsing algorithms. See L<Text::Balanced> for more information. - -=item * - -Tie::RefHash::Nestable, by Edward Avis, allows storing hash references -(unlike the standard Tie::RefHash) The module is contained within -Tie::RefHash. - -=item * - -XS::Typemap, by Tim Jenness, is a test extension that exercises XS -typemaps. Nothing gets installed but for extension writers the code -is worth studying. - -=item * - -L<Attribute::Handlers> - Simpler definition of attribute handlers - -=item * - -L<ExtUtils::Constant> - generate XS code to import C header constants - -=item * - -L<I18N::Langinfo> - query locale information - -=item * - -L<I18N::LangTags> - functions for dealing with RFC3066-style language tags - -=item * - -L<libnet> - a collection of perl5 modules related to network programming - -Perl installation leaves libnet unconfigured, use F<libnetcfg> to configure. - -=item * - -L<List::Util> - selection of general-utility list subroutines +parsing algorithms. See L<Text::Balanced>. =item * -L<Locale::Maketext> - framework for localization +C<threads> is an interface interpreter threads, by Arthur Bergman. +Interpreter threads (ithreads) is the new thread model introduced in +Perl 5.6 but then available only as an internal interface for +extension writers. See L<threads>. =item * -L<Memoize> - Make your functions faster by trading space for time +C<threads::shared> allows data sharing for interpreter threads, from +Arthur Bergman. In the ithreads model any data sharing between +threads must be explicit, as opposed to the old 5.005 thread model +where data sharing was implicit. See L<threads::shared>. =item * -L<NEXT> - pseudo-class for method redispatch +C<Tie::RefHash::Nestable>, by Edward Avis, allows storing hash +references (unlike the standard Tie::RefHash) The module is contained +within Tie::RefHash, see L<Tie::RefHash>. =item * -L<Scalar::Util> - selection of general-utility scalar subroutines +C<Time::HiRes> provides high resolution timing (ualarm, usleep, +and gettimeofday), from Douglas E. Wegscheid. See L<Time::HiRes>. =item * -L<Test::More> - yet another framework for writing test scripts +C<Unicode::UCD> offers a querying interface to the Unicode Character +Database. See L<Unicode::UCD>. =item * -L<Test::Simple> - Basic utilities for writing tests +C<Unicode::Collate> implements the UCA (Unicode Collation Algorithm) +for sorting Unicode strings, by SADAHIRO Tomoyuki. See L<Unicode::Collate>. =item * -L<Time::HiRes> - high resolution ualarm, usleep, and gettimeofday +C<Unicode::Normalize> implements the various Unicode normalization +forms, by SADAHIRO Tomoyuki. See L<Unicode::Normalize>. =item * -L<Time::Piece> - Object Oriented time objects - -(Previously known as L<Time::Object>.) - -=item * - -L<Time::Seconds> - a simple API to convert seconds to other date values - -=item * - -L<UnicodeCD> - Unicode Character Database +C<XS::Typemap>, by Tim Jenness, is a test extension that exercises XS +typemaps. Nothing gets installed but for extension writers the code +is worth studying. =back @@ -722,25 +741,23 @@ L<UnicodeCD> - Unicode Character Database =item * -The following independently supported modules have been updated to -newer versions from CPAN: CGI, CPAN, DB_File, File::Spec, Getopt::Long, -the podlators bundle, Pod::LaTeX, Pod::Parser, Term::ANSIColor, Test. +The following independently supported modules have been updated to the +newest versions from CPAN: CGI, CPAN, DB_File, File::Spec, File::Temp, +Getopt::Long, Math::BigFloat, Math::BigInt, the podlators bundle +(Pod::Man, Pod::Text), Pod::LaTeX, Pod::Parser, Storable, +Term::ANSIColor, Test, Text-Tabs+Wrap. =item * -Bug fixes and minor enhancements have been applied to B::Deparse, -Data::Dumper, IO::Poll, IO::Socket::INET, Math::BigFloat, -Math::Complex, Math::Trig, Net::protoent, the re pragma, SelfLoader, -Sys::SysLog, Test::Harness, Text::Wrap, UNIVERSAL, and the warnings -pragma. +The attributes::reftype() now works on tied arguments. =item * -The attributes::reftype() now works on tied arguments. +AutoLoader can now be disabled with C<no AutoLoader;>, =item * -AutoLoader can now be disabled with C<no AutoLoader;>, +Data::Dumper has now an option to sort hashes. =item * @@ -783,9 +800,9 @@ The Shell module now has an OO interface. =item * -B::Deparse should be now more robust. It still far from providing a full -round trip for any random piece of Perl code, though, and is under active -development: expect more robustness in 5.7.2. +B::Deparse has been significantly enhanced. It now can deparse almost +all of the standard test suite (so that the tests still succeed). +There is a make target "test.deparse" for trying this out. =item * @@ -793,11 +810,23 @@ Class::Struct can now define the classes in compile time. =item * -Math::BigFloat has undergone much fixing, and in addition the fmod() -function now supports modulus operations. +Class::Struct now assigns the array/hash element if the accessor +is called with an array/hash element as the B<sole> argument. + +=item * -(The fixed Math::BigFloat module is also available in CPAN for those -who can't upgrade their Perl: http://www.cpan.org/authors/id/J/JP/JPEACOCK/) +Fcntl, Socket, and Sys::Syslog have been rewritten to use the +new-style constant dispatch section (see L<ExtUtils::Constant>). + +=item * + +File::Find is now (again) reentrant. It also has been made +more portable. + +=item * + +File::Glob now supports C<GLOB_LIMIT> constant to limit the size of +the returned list of filenames. =item * @@ -819,6 +848,17 @@ you may want to prefer ReuseAddr. =item * +IO::Socket::INET now supports C<LocalPort> of zero (usually meaning +that the operating system will make one up.) + +=item * + +Math::BigFloat and Math::BigInt have undergone much fixing, +they are now magnitudes faster, and they support various +bignum libraries such as GMP and PARI as their backends. + +=item * + Net::Ping has been enhanced. There is now "external" protocol which uses Net::Ping::External module which runs external ping(1) and parses the output. An alpha version of Net::Ping::External is available in @@ -837,8 +877,12 @@ handlers, installing new handlers was not atomic. =item * -The Test module has been significantly enhanced. Its use is -greatly recommended for module writers. +The Test module has been significantly enhanced. + +=item * + +The C<vars> pragma now supports declaring fully qualified variables. +(Something that C<our()> does not and will not support.) =item * @@ -849,84 +893,61 @@ has been implemented. =back -The following modules have been upgraded from the versions at CPAN: -CPAN, CGI, DB_File, File::Temp, Getopt::Long, Pod::Man, Pod::Text, -Storable, Text-Tabs+Wrap. - -=item * - -L<B::Deparse> module has been significantly enhanced. It now -can deparse almost all of the standard test suite (so that the -tests still succeed). There is a make target "test.deparse" -for trying this out. - -=item * - -L<Class::Struct> now assigns the array/hash element if the accessor -is called with an array/hash element as the B<sole> argument. - -=item * - -L<Cwd> extension is now (even) faster. - -=item * +=head1 Utility Changes -L<DB_File> extension has been updated to version 1.77. +=over 4 =item * -L<Fcntl>, L<Socket>, and L<Sys::Syslog> have been rewritten to use the -new-style constant dispatch section (see L<ExtUtils::Constant>). +Emacs perl mode (emacs/cperl-mode.el) has been updated to version +4.31. =item * -L<File::Find> is now (again) reentrant. It also has been made -more portable. +F<emacs/e2ctags.pl> is now much faster. =item * -L<File::Glob> now supports C<GLOB_LIMIT> constant to limit the -size of the returned list of filenames. +h2xs now produces a template README. =item * -L<IO::Socket::INET> now supports C<LocalPort> of zero (usually meaning -that the operating system will make one up.) +L<h2ph> now supports C trigraphs. =item * -The L<vars> pragma now supports declaring fully qualified variables. -(Something that C<our()> does not and will not support.) - -=back - -=head1 Utility Changes - -=over 4 +L<h2xs> uses the new L<ExtUtils::Constant> module which will affect +newly created extensions that define constants. Since the new code is +more correct (if you have two constants where the first one is a +prefix of the second one, the first constant B<never> gets defined), +less lossy (it uses integers for integer constant, as opposed to the +old code that used floating point numbers even for integer constants), +and slightly faster, you might want to consider regenerating your +extension code (the new scheme makes regenerating easy). +L<h2xs> now also supports C trigraphs. =item * -The Emacs perl mode (emacs/cperl-mode.el) has been updated to version -4.31. +L<libnetcfg> has been added to configure the libnet. =item * -Perlbug is now much more robust. It also sends the bug report to +perlbug is now much more robust. It also sends the bug report to perl.org, not perl.com. =item * -The perlcc utility has been rewritten and its user interface (that is, +perlcc has been rewritten and its user interface (that is, command line) is much more like that of the UNIX C compiler, cc. =item * -The xsubpp utility for extension writers now understands POD -documentation embedded in the *.xs files. +perlivp is a new utility for doing Installation Verification +Procedure after installing Perl. =item * -h2xs now produces template README. +pod2html now allows specifying a cache directory. =item * @@ -935,36 +956,11 @@ implementation of sed in Perl.) =item * -xsubpp now supports OUT keyword. - -=item * - -The F<emacs/e2ctags.pl> is now much faster. - -=item * - -L<h2ph> now supports C trigraphs. - -=item * - -L<h2xs> uses the new L<ExtUtils::Constant> module which will affect -newly created extensions that define constants. Since the new code is -more correct (if you have two constants where the first one is a -prefix of the second one, the first constant B<never> gets defined), -less lossy (it uses integers for integer constant, as opposed to the -old code that used floating point numbers even for integer constants), -and slightly faster, you might want to consider regenerating your -extension code (the new scheme makes regenerating easy). -L<h2xs> now also supports C trigraphs. - -=item * - -L<libnetcfg> has been added to configure the libnet. +xsubpp now understands POD documentation embedded in the *.xs files. =item * -The F<Pod::Html> (and thusly L<pod2html>) now allows specifying -a cache directory. +xsubpp now supports OUT keyword. =back @@ -979,6 +975,12 @@ perl56delta details the changes between the 5.005 release and the =item * +perlclib documents the internal replacements for standard C library +functions. (Interesting only for extension writers and Perl core +hackers.) + +=item * + perldebtut is a Perl debugging tutorial. =item * @@ -990,107 +992,87 @@ bring them back to the fold. =item * -perlnewmod tells about writing and submitting a new module. +perlintro is a gentle introduction to Perl. =item * -perlposix-bc explains using Perl on the POSIX-BC platform -(an EBCDIC mainframe platform). +perliol documents the internals of PerlIO with layers. =item * -perlretut is a regular expression tutorial. +perlmodstyle is a style guide for writing modules. =item * -perlrequick is a regular expressions quick-start guide. -Yes, much quicker than perlretut. +perlnewmod tells about writing and submitting a new module. =item * -perlutil explains the command line utilities packaged with the Perl -distribution. +perlpod has been rewritten to be clearer and to record the best +practices gathered over the years. -=back - -=head2 perlclib +=item * -Internal replacements for standard C library functions. -(Interesting only for extension writers and Perl core hackers.) +perlpodstyle is a more formal specification of the pod format, +mainly of interest for writers of pod applications, not to +people writing in pod. -=head2 perliol +=item * -Internals of PerlIO with layers. +perlposix-bc explains using Perl on the POSIX-BC platform +(an EBCDIC mainframe platform). -=head2 README.aix +=item * -Documentation on compiling Perl on AIX has been added. AIX has -several different C compilers and getting the right patch level -is essential. On install README.aix will be installed as L<perlaix>. +perlretut is a regular expression tutorial. -=head2 README.bs2000 +=item * -Documentation on compiling Perl on the POSIX-BC platform (an EBCDIC -mainframe environment) has been added. +perlrequick is a regular expressions quick-start guide. +Yes, much quicker than perlretut. -This was formerly known as README.posix-bc but the name was considered -to be too confusing (it has nothing to do with the POSIX module or the -POSIX standard). On install README.bs2000 will be installed as L<perlbs2000>. +=item * -=head2 README.macos +perltodo has been updated. -In perl 5.7.1 (and in the 5.6.1) the MacPerl sources have been -synchronised with the standard Perl sources. To compile MacPerl -some additional steps are required, and this file documents those -steps. On install README.macos will be installed as L<perlmacos>. +=item * -=head2 README.mpeix +perltootc has been renamed as perltooc (to not to conflict +with perltoot in filesystems restricted to "8.3" names) -The README.mpeix has been podified, which means that this information -about compiling and using Perl on the MPE/iX miniframe platform will -be installed as L<perlmpeix>. +=item * -=head2 README.solaris +perluniintro is an introduction to using Unicode in Perl +(perlunicode is more of a reference) -README.solaris has been created and Solaris wisdom from elsewhere -in the Perl documentation has been collected there. On install -README.solaris will be installed as L<perlsolaris>. +=item * -=head2 README.vos +perlutil explains the command line utilities packaged with the Perl +distribution. -The README.vos has been podified, which means that this information -about compiling and using Perl on the Stratus VOS miniframe platform -will be installed as L<perlvos>. +=back -=head2 Porting/repository.pod +The following platform-specific documents are available before +the installation as README.I<platform>, and after the installation +as perlI<platform>: -Documentation on how to use the Perl source repository has been added. + perlaix perlamiga perlapollo perlbeos perlbs2000 + perlce perlcygwin perldgux perldos perlepoc perlhpux + perlhurd perlmachten perlmacos perlmint perlmpeix + perlnetware perlos2 perlos390 perlplan9 perlqnx perlsolaris + perltru64 perluts perlvmesa perlvms perlvos perlwin32 =over 4 =item * -L<Locale::Maketext::TPJ13> is an article about software localization, -originally published in The Perl Journal #13, republished here with -kind permission. +The documentation for the POSIX-BC platform is called "BS2000", to avoid +confusion with the Perl POSIX module. =item * -More README.$PLATFORM files have been converted into pod, which also -means that they also be installed as perl$PLATFORM documentation -files. The new files are L<perlapollo>, L<perlbeos>, L<perldgux>, -L<perlhurd>, L<perlmint>, L<perlnetware>, L<perlplan9>, L<perlqnx>, -and L<perltru64>. - -=item * - -The F<Todo> and F<Todo-5.6> files have been merged into L<perltodo>. - -=item * - -Use of the F<gprof> tool to profile Perl has been documented in -L<perlhack>. There is a make target "perl.gprof" for generating a -gprofiled Perl executable. +The documentation for the WinCE platform is called "CE", to avoid +confusion with the perlwin32 documentation on 8.3-restricted filesystems. =back @@ -1208,34 +1190,74 @@ pointers are 64 bits wide. (To be exact, the use64bitall is ignored.) =item * +In AFS installations one can configure the root of the AFS to be +somewhere else than the default F</afs> by using the Configure +parameter C<-Dafsroot=/some/where/else>. + +=item * + APPLLIB_EXP, a less-know configuration-time definition, has been documented. It can be used to prepend site-specific directories to Perl's default search path (@INC), see INSTALL for information. =item * +The version of Berkeley DB used when the Perl (and, presumably, the +DB_File extension) was built is now available as +C<@Config{qw(db_version_major db_version_minor db_version_patch)}> +from Perl and as C<DB_VERSION_MAJOR_CFG DB_VERSION_MINOR_CFG +DB_VERSION_PATCH_CFG> from C. + +=item * + Building Berkeley DB3 for compatibility modes for DB, NDBM, and ODBM has been documented in INSTALL. =item * +If you have CPAN access (either network or a local copy such as a +CD-ROM) you can during specify extra modules to Configure to build and +install with Perl using the -Dextras=... option. See INSTALL for +more details. + +=item * + +In addition to config.over a new override file, config.arch, is +available. That is supposed to be used by hints file writers for +architecture-wide changes (as opposed to config.over which is for +site-wide changes). + +=item * + +For Perl developers several new make targets for profiling +and debugging have been added, see L<perlhack>. + +=over 8 + +=item * + +Use of the F<gprof> tool to profile Perl has been documented in +L<perlhack>. There is a make target called "perl.gprof" for +generating a gprofiled Perl executable. + +=item * + +If you have GCC 3, there is a make target called "perl.gcov" for +creating a gcoved Perl executable for coverage analysis. See +L<perlhack>. + +=item * + If you are on IRIX or Tru64 platforms, new profiling/debugging options have been added, see L<perlhack> for more information about pixie and Third Degree. -=item * - -In AFS installations one can configure the root of the AFS to be -somewhere else than the default F</afs> by using the Configure -parameter C<-Dafsroot=/some/where/else>. +=back =item * -The version of Berkeley DB used when the Perl (and, presumably, the -DB_File extension) was built is now available as -C<@Config{qw(db_version_major db_version_minor db_version_patch)}> -from Perl and as C<DB_VERSION_MAJOR_CFG DB_VERSION_MINOR_CFG -DB_VERSION_PATCH_CFG> from C. +Guidelines of how to construct minimal Perl installations have +been added to INSTALL. =item * @@ -1243,11 +1265,8 @@ The Thread extension is now not built at all under ithreads (C<Configure -Duseithreads>) because it wouldn't work anyway (the Thread extension requires being Configured with C<-Duse5005threads>). -=item * - -The C<B::Deparse> compiler backend has been so significantly improved -that almost the whole Perl test suite passes after being deparsed. A -make target has been added to help in further testing: C<make test.deparse>. +But note that the Thread.pm interface is now shared by both +thread models. =back @@ -1264,86 +1283,83 @@ AIX dynamic loading should be now better supported. =item * -After a long pause, AmigaOS has been verified to be happy with Perl. - -=item * - -EBCDIC platforms (z/OS, also known as OS/390, POSIX-BC, and VM/ESA) -have been regained. Many test suite tests still fail and the -co-existence of Unicode and EBCDIC isn't quite settled, but the -situation is much better than with Perl 5.6. See L<perlos390>, -L<perlbs2000> (for POSIX-BC), and L<perlvmesa> for more information. +AIX should now work better with gcc, threads, and 64-bitness. Also the +long doubles support in AIX should be better now. See L<perlaix>. =item * -Building perl with -Duseithreads or -Duse5005threads now works under -HP-UX 10.20 (previously it only worked under 10.30 or later). You will -need a thread library package installed. See README.hpux. +After a long pause, AmigaOS has been verified to be happy with Perl. =item * -MacOS Classic (MacPerl has of course been available since -perl 5.004 but now the source code bases of standard Perl -and MacPerl have been synchronised) +AtheOS (http://www.atheos.cx/) is a new platform. =item * -NCR MP-RAS is now supported. +DG/UX platform now supports the 5.005-style threads. See L<perldgux>. =item * -NonStop-UX is now supported. +DYNIX/ptx platform (a.k.a. dynixptx) is supported at or near osvers 4.5.2. =item * -Amdahl UTS is now supported. +EBCDIC platforms (z/OS, also known as OS/390, POSIX-BC, and VM/ESA) +have been regained. Many test suite tests still fail and the +co-existence of Unicode and EBCDIC isn't quite settled, but the +situation is much better than with Perl 5.6. See L<perlos390>, +L<perlbs2000> (for POSIX-BC), and L<perlvmesa> for more information. =item * -z/OS (formerly known as OS/390, formerly known as MVS OE) has now -support for dynamic loading. This is not selected by default, -however, you must specify -Dusedl in the arguments of Configure. +Building perl with -Duseithreads or -Duse5005threads now works under +HP-UX 10.20 (previously it only worked under 10.30 or later). You will +need a thread library package installed. See README.hpux. =item * -AIX should now work better with gcc, threads, and 64-bitness. Also the -long doubles support in AIX should be better now. See L<perlaix>. +MacOS Classic (MacPerl has of course been available since +perl 5.004 but now the source code bases of standard Perl +and MacPerl have been synchronised) =item * -AtheOS (http://www.atheos.cx/) is a new platform. +MacOS X (or Darwin) should now be able to build Perl even on HFS+ +filesystems. (The case-insensitivity confused the Perl build process.) =item * -DG/UX platform now supports the 5.005-style threads. See L<perldgux>. +NCR MP-RAS is now supported. =item * -DYNIX/ptx platform (a.k.a. dynixptx) is supported at or near osvers 4.5.2. +NetWare from Novell is now supported. See L<perlnetware>. =item * -Several MacOS (Classic) portability patches have been applied. We -hope to get a fully working port by 5.8.0. (The remaining problems -relate to the changed IO model of Perl.) See L<perlmacos>. +NonStop-UX is now supported. =item * -MacOS X (or Darwin) should now be able to build Perl even on HFS+ -filesystems. (The case-insensitivity confused the Perl build process.) +Amdahl UTS UNIX mainframe platform is now supported. =item * -NetWare from Novell is now supported. See L<perlnetware>. +WinCE is now supported. See L<perlce>. =item * -The Amdahl UTS UNIX mainframe platform is now supported. +z/OS (formerly known as OS/390, formerly known as MVS OE) has now +support for dynamic loading. This is not selected by default, +however, you must specify -Dusedl in the arguments of Configure. =back =head1 Selected Bug Fixes +Numerous memory leaks and uninitialized memory accesses have been hunted down. +Most importantly anonymous subs used to leak quite a bit. + =over 4 =item * @@ -1485,77 +1501,134 @@ vec() now refuses to deal with characters >255. Zero entries were missing from the Unicode classes like C<IsDigit>. -=back +=item * + +chop(@list) in list context returned the characters chopped in +reverse order. This has been reversed to be in the right order. =item * -UNIVERSAL::isa no longer caches methods incorrectly. (This broke -the Tk extension with 5.6.0.) +The order of DESTROYs has been made more predictable. =item * -Configure no longer includes the DBM libraries (dbm, gdbm, db, ndbm) -when building the Perl binary. The only exception to this is SunOS 4.x, -which needs them. +mkdir() now ignores trailing slashes in the directory name, +as mandated by POSIX. =item * -Some new Configure symbols, useful for extension writers: +Attributes (like :shared) didn't work with our(). -=over 8 +=item * + +The PERL5OPT environment variable (for passing command line arguments +to Perl) didn't work for more than a single group of options. + +=item * + +The tainting behaviour of sprintf() has been rationalized. It does +not taint the result of floating point formats anymore, making the +behaviour consistent with that of string interpolation. + +=item * + +All but the first argument of the IO syswrite() method are now optional. + +=item * + +Tie::ARRAY SPLICE method was broken. + +=item * -=item d_cmsghdr +vec() now tries to work with characters <= 255 when possible, but it leaves +higher character values in place. In that case, if vec() was used to modify +the string, it is no longer considered to be utf8-encoded. -For struct cmsghdr. +=item * -=item d_fcntl_can_lock +The autouse pragma didn't work for Multi::Part::Function::Names. + +=item * -Whether fcntl() can be used for file locking. +The behaviour of non-decimal but numeric string constants such as +"0x23" was platform-dependent: in some platforms that was seen as 35, +in some as 0, in some as a floating point number (don't ask). This +was caused by Perl using the operating system libraries in a situation +where the result of the string to number conversion is undefined: now +Perl consistently handles such strings as zero in numeric contexts. -=item d_fsync +=item * -=item d_getitimer +L<dprofpp> -R didn't work. -=item d_getpagsz +=item * -For getpagesize(), though you should prefer POSIX::sysconf(_SC_PAGE_SIZE)) +PERL5OPT with embedded spaces didn't work. -=item d_msghdr_s +=item * -For struct msghdr. +L<Sys::Syslog> ignored the C<LOG_AUTH> constant. -=item need_va_copy +=item * -Whether one needs to use Perl_va_copy() to copy varargs. +Some versions of glibc have a broken modfl(). This affects builds +with C<-Duselongdouble>. This version of Perl detects this brokenness +and has a workaround for it. The glibc release 2.2.2 is known to have +fixed the modfl() bug. -=item d_readv +=item * -=item d_recvmsg +Linux previously had problems related to sockaddrlen when using +accept(), revcfrom() (in Perl: recv()), getpeername(), and getsockname(). -=item d_sendmsg +=item * -=item sig_size +Previously DYNIX/ptx had problems in its Configure probe for non-blocking I/O. -The number of elements in an array needed to hold all the available signals. +=item * -=item d_sockatmark +Windows -=item d_strtoq +=over 8 -=item d_u32align +=item * -Whether one needs to access character data aligned by U32 sized pointers. +Borland C++ v5.5 is now a supported compiler that can build Perl. +However, the generated binaries continue to be incompatible with those +generated by the other supported compilers (GCC and Visual C++). -=item d_ualarm +=item * -=item d_usleep +Win32::GetCwd() correctly returns C:\ instead of C: when at the drive root. +Other bugs in chdir() and Cwd::cwd() have also been fixed. + +=item * + +Duping socket handles with open(F, ">&MYSOCK") now works under Windows 9x. + +=item * + +HTML files will be installed in c:\perl\html instead of c:\perl\lib\pod\html + +=item * + +The makefiles now provide a single switch to bulk-enable all the features +enabled in ActiveState ActivePerl (a popular Win32 binary distribution). + +=back =back =item * -Removed Configure symbols: the PDP-11 memory model settings: huge, -large, medium, models. +UNIVERSAL::isa no longer caches methods incorrectly. (This broke +the Tk extension with 5.6.0.) + +=item * + +Configure no longer includes the DBM libraries (dbm, gdbm, db, ndbm) +when building the Perl binary. The only exception to this is SunOS 4.x, +which needs them. =item * @@ -1757,19 +1830,27 @@ winsock handle leak fixed. =head1 New or Changed Diagnostics +=over 4 + +=item * + All regular expression compilation error messages are now hopefully easier to understand both because the error message now comes before the failed regex and because the point of failure is now clearly -marked. +marked by a C<E<lt>-- HERE> marker. + +=item * The various "opened only for", "on closed", "never opened" warnings drop the C<main::> prefix for filehandles in the C<main> package, for example C<STDIN> instead of <main::STDIN>. +=item * + The "Unrecognized escape" warning has been extended to include C<\8>, C<\9>, and C<\_>. There is no need to escape any of the C<\w> characters. -=over 4 +=item * Two new debugging options have been added: if you have compiled your Perl with debugging, you can use the -DT and -DR options to trace @@ -1787,6 +1868,22 @@ C<push @a;> and C<unshift @a;> (with no values to push or unshift) now give a warning. This may be a problem for generated and evaled code. +=item * + +If you try to L<perlfunc/pack> a number less than 0 or larger than 255 +using the C<"C"> format you will get an optional warning. Similarly +for the C<"c"> format and a number less than -128 or more than 127. + +=item * + +Certain regex modifiers such as C<(?o)> make sense only if applied to +the entire regex. You will an optional warning if you try to do otherwise. + +=item * + +Using arrays or hashes as references (e.g. C<%foo->{bar}> has been +deprecated for a while. Now you will get an optional warning. + =back =head1 Changed Internals @@ -1835,180 +1932,77 @@ a no-op) and the latter replaced with dSP. =item * -Perl now uses system malloc instead of Perl malloc on all 64-bit -platforms, and even in some not-always-64-bit platforms like AIX, -IRIX, and Solaris. This change breaks backward compatibility but -Perl's malloc has problems with large address spaces and also the -speed of vendors' malloc is generally better in large address space -machines (Perl's malloc is mostly tuned for space). - -=back - -=head1 Security Vulnerability Closed - -(This change was already made in 5.7.0 but bears repeating here.) - -A potential security vulnerability in the optional suidperl component -of Perl was identified in August 2000. suidperl is neither built nor -installed by default. As of November 2001 the only known vulnerable -platform is Linux, most likely all Linux distributions. CERT and -various vendors and distributors have been alerted about the vulnerability. -See http://www.cpan.org/src/5.0/sperl-2000-08-05/sperl-2000-08-05.txt -for more information. - -The problem was caused by Perl trying to report a suspected security -exploit attempt using an external program, /bin/mail. On Linux -platforms the /bin/mail program had an undocumented feature which -when combined with suidperl gave access to a root shell, resulting in -a serious compromise instead of reporting the exploit attempt. If you -don't have /bin/mail, or if you have 'safe setuid scripts', or if -suidperl is not installed, you are safe. - -The exploit attempt reporting feature has been completely removed from -Perl 5.8.0 (and the maintenance release 5.6.1, and it was removed also -from all the Perl 5.7 releases), so that particular vulnerability -isn't there anymore. However, further security vulnerabilities are, -unfortunately, always possible. The suidperl code is being reviewed -and if deemed too risky to continue to be supported, it may be -completely removed from future releases. In any case, suidperl should -only be used by security experts who know exactly what they are doing -and why they are using suidperl instead of some other solution such as -sudo (see http://www.courtesan.com/sudo/). - -=head1 Selected Bug Fixes - -Numerous memory leaks and uninitialized memory accesses have been hunted down. -Most importantly anonymous subs used to leak quite a bit. - -=over 4 - -=item * - -chop(@list) in list context returned the characters chopped in -reverse order. This has been reversed to be in the right order. - -=item * - -The order of DESTROYs has been made more predictable. +PERL_OBJECT has been completely removed. =item * -mkdir() now ignores trailing slashes in the directory name, -as mandated by POSIX. - -=item * - -Attributes (like :shared) didn't work with our(). - -=item * - -The PERL5OPT environment variable (for passing command line arguments -to Perl) didn't work for more than a single group of options. - -=item * - -The tainting behaviour of sprintf() has been rationalized. It does -not taint the result of floating point formats anymore, making the -behaviour consistent with that of string interpolation. - -=item * - -All but the first argument of the IO syswrite() method are now optional. - -=item * - -Tie::ARRAY SPLICE method was broken. - -=item * - -vec() now tries to work with characters <= 255 when possible, but it leaves -higher character values in place. In that case, if vec() was used to modify -the string, it is no longer considered to be utf8-encoded. +The MAGIC constants (e.g. C<'P'>) have been macrofied +(e.g. C<PERL_MAGIC_TIED>) for better source code readability +and maintainability. =item * -The autouse pragma didn't work for Multi::Part::Function::Names. +The regex compiler now maintains a structure that identifies nodes in +the compiled bytecode with the corresponding syntactic features of the +original regex expression. The information is attached to the new +C<offsets> member of the C<struct regexp>. See L<perldebguts> for more +complete information. =item * -The behaviour of non-decimal but numeric string constants such as -"0x23" was platform-dependent: in some platforms that was seen as 35, -in some as 0, in some as a floating point number (don't ask). This -was caused by Perl using the operating system libraries in a situation -where the result of the string to number conversion is undefined: now -Perl consistently handles such strings as zero in numeric contexts. +The C code has been made much more C<gcc -Wall> clean. Some warning +messages still remain in some platforms, so if you are compiling with +gcc you may see some warnings about dubious practices. The warnings +are being worked on. =item * -L<dprofpp> -R didn't work. +F<perly.c>, F<sv.c>, and F<sv.h> have now been extensively commented. =item * -PERL5OPT with embedded spaces didn't work. +Documentation on how to use the Perl source repository has been added +to F<Porting/repository.pod>. =item * -L<Sys::Syslog> ignored the C<LOG_AUTH> constant. - -=back - -=head2 Platform Specific Changes and Fixes - -=over 4 +There are now several profiling make targets =item * -Some versions of glibc have a broken modfl(). This affects builds -with C<-Duselongdouble>. This version of Perl detects this brokenness -and has a workaround for it. The glibc release 2.2.2 is known to have -fixed the modfl() bug. +The C<op_clear> and C<op_null> are now exported. =back -=head2 Platform Specific Changes and Fixes - -=over 4 - -=item * - -Linux previously had problems related to sockaddrlen when using -accept(), revcfrom() (in Perl: recv()), getpeername(), and getsockname(). - -=item * - -Previously DYNIX/ptx had problems in its Configure probe for non-blocking I/O. - -=item * - -Windows - -=over 8 - -=item * - -Borland C++ v5.5 is now a supported compiler that can build Perl. -However, the generated binaries continue to be incompatible with those -generated by the other supported compilers (GCC and Visual C++). - -=item * - -Win32::GetCwd() correctly returns C:\ instead of C: when at the drive root. -Other bugs in chdir() and Cwd::cwd() have also been fixed. - -=item * - -Duping socket handles with open(F, ">&MYSOCK") now works under Windows 9x. - -=item * +=head1 Security Vulnerability Closed -HTML files will be installed in c:\perl\html instead of c:\perl\lib\pod\html +(This change was already made in 5.7.0 but bears repeating here.) -=item * +A potential security vulnerability in the optional suidperl component +of Perl was identified in August 2000. suidperl is neither built nor +installed by default. As of November 2001 the only known vulnerable +platform is Linux, most likely all Linux distributions. CERT and +various vendors and distributors have been alerted about the vulnerability. +See http://www.cpan.org/src/5.0/sperl-2000-08-05/sperl-2000-08-05.txt +for more information. -The makefiles now provide a single switch to bulk-enable all the features -enabled in ActiveState ActivePerl (a popular binary distribution). +The problem was caused by Perl trying to report a suspected security +exploit attempt using an external program, /bin/mail. On Linux +platforms the /bin/mail program had an undocumented feature which +when combined with suidperl gave access to a root shell, resulting in +a serious compromise instead of reporting the exploit attempt. If you +don't have /bin/mail, or if you have 'safe setuid scripts', or if +suidperl is not installed, you are safe. -=back +The exploit attempt reporting feature has been completely removed from +Perl 5.8.0 (and the maintenance release 5.6.1, and it was removed also +from all the Perl 5.7 releases), so that particular vulnerability +isn't there anymore. However, further security vulnerabilities are, +unfortunately, always possible. The suidperl functionality is most +probably going to be removed in Perl 5.10. In any case, suidperl +should only be used by security experts who know exactly what they are +doing and why they are using suidperl instead of some other solution +such as sudo (see http://www.courtesan.com/sudo/). =head1 New Tests @@ -2018,62 +2012,6 @@ The tests are now reported in a different order than in earlier Perls. (This happens because the test scripts from under t/lib have been moved to be closer to the library/extension they are testing.) -=head1 New or Changed Diagnostics - -=over 4 - -=item * - -In the regular expression diagnostics the C<E<lt>E<lt> HERE> marker -introduced in 5.7.0 has been changed to be C<E<lt>-- HERE> since too -many people found the C<E<lt>E<lt>> to be too similar to here-document -starters. - -=item * - -If you try to L<perlfunc/pack> a number less than 0 or larger than 255 -using the C<"C"> format you will get an optional warning. Similarly -for the C<"c"> format and a number less than -128 or more than 127. - -=item * - -Certain regex modifiers such as C<(?o)> make sense only if applied to -the entire regex. You will an optional warning if you try to do otherwise. - -=item * - -Using arrays or hashes as references (e.g. C<%foo->{bar}> has been -deprecated for a while. Now you will get an optional warning. - -=back - -=head1 Source Code Enhancements - -=head2 MAGIC constants - -The MAGIC constants (e.g. C<'P'>) have been macrofied -(e.g. C<PERL_MAGIC_TIED>) for better source code readability -and maintainability. - -=head2 Better commented code - -F<perly.c>, F<sv.c>, and F<sv.h> have now been extensively commented. - -=head2 Regex pre-/post-compilation items matched up - -The regex compiler now maintains a structure that identifies nodes in -the compiled bytecode with the corresponding syntactic features of the -original regex expression. The information is attached to the new -C<offsets> member of the C<struct regexp>. See L<perldebguts> for more -complete information. - -=head2 gcc -Wall - -The C code has been made much more C<gcc -Wall> clean. Some warning -messages still remain, though, so if you are compiling with gcc you -will see some warnings about dubious practices. The warnings are -being worked on. - =head1 Known Problems Note that unlike other sections in this document (which describe @@ -2227,7 +2165,7 @@ many more tests than there used to be. Here are the known failures from some compiler/platform combinations. DEC C V5.3-006 on OpenVMS VAX V6.2 - + [-.ext.list.util.t]tainted..............FAILED on test 3 [-.ext.posix]sigaction..................FAILED on test 7 [-.ext.time.hires]hires.................FAILED on test 14 diff --git a/pod/perlfaq4.pod b/pod/perlfaq4.pod index f602d24b27..f9f722bf02 100644 --- a/pod/perlfaq4.pod +++ b/pod/perlfaq4.pod @@ -136,13 +136,15 @@ functions is that it works with numbers of ANY size, that it is optimized for speed on some operations, and for at least some programmers the notation might be familiar. +=over 4 + =item B<How do I convert Hexadecimal into decimal:> Using perl's built in conversion of 0x notation: $int = 0xDEADBEEF; $dec = sprintf("%d", $int); - + Using the hex function: $int = hex("DEADBEEF"); @@ -247,6 +249,7 @@ Using Bit::Vector: The remaining transformations (e.g. hex -> oct, bin -> hex, etc.) are left as an exercise to the inclined reader. +=back =head2 Why doesn't & work the way I want it to? diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 679fe3734f..3feb50daf5 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -5244,10 +5244,15 @@ C<print>, C<write>, C<seek>, C<tell>, or C<eof> may cause confusion. FILEHANDLE may be an expression whose value gives the name of the filehandle. The values for WHENCE are C<0> to set the new position to POSITION, C<1> to set the it to the current position plus POSITION, -and C<2> to set it to EOF plus POSITION (typically negative). For -WHENCE, you may also use the constants C<SEEK_SET>, C<SEEK_CUR>, and -C<SEEK_END> (start of the file, current position, end of the file) -from the Fcntl module. +and C<2> to set it to EOF plus POSITION (typically negative). + +For WHENCE, you may also use the constants C<SEEK_SET>, C<SEEK_CUR>, +and C<SEEK_END> (start of the file, current position, end of the file) +from the Fcntl module. Use of the constants is also more portable +than relying on 0, 1, and 2. For example to define a "systell" function: + + use Fnctl 'SEEK_CUR'; + sub systell { sysseek($_[0], 0, SEEK_CUR) } Returns the new position, or the undefined value on failure. A position of zero is returned as the string C<"0 but true">; thus C<sysseek> returns diff --git a/pod/perlvar.pod b/pod/perlvar.pod index 2f39d561c2..a48d943397 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -965,6 +965,12 @@ built, as determined during the configuration process. The value is identical to C<$Config{'osname'}>. See also L<Config> and the B<-V> command-line switch documented in L<perlrun>. +=item ${^OPEN} + +An internal variable used by PerlIO. A string in two parts, separated +by a C<\0> byte, the first part is the input disciplines, the second +part is the output disciplines. + =item $PERLDB =item $^P @@ -252,49 +252,40 @@ PP(pp_eq) bool auvok = SvUOK(TOPm1s); bool buvok = SvUOK(TOPs); - if (!auvok && !buvok) { /* ## IV == IV ## */ - IV aiv = SvIVX(TOPm1s); - IV biv = SvIVX(TOPs); + if (auvok == buvok) { /* ## IV == IV or UV == UV ## */ + /* Casting IV to UV before comparison isn't going to matter + on 2s complement. On 1s complement or sign&magnitude + (if we have any of them) it could to make negative zero + differ from normal zero. As I understand it. (Need to + check - is negative zero implementation defined behaviour + anyway?). NWC */ + UV buv = SvUVX(POPs); + UV auv = SvUVX(TOPs); - SP--; - SETs(boolSV(aiv == biv)); - RETURN; - } - if (auvok && buvok) { /* ## UV == UV ## */ - UV auv = SvUVX(TOPm1s); - UV buv = SvUVX(TOPs); - - SP--; SETs(boolSV(auv == buv)); RETURN; } { /* ## Mixed IV,UV ## */ + SV *ivp, *uvp; IV iv; - UV uv; - /* == is commutative so swap if needed (save code) */ + /* == is commutative so doesn't matter which is left or right */ if (auvok) { - /* swap. top of stack (b) is the iv */ - iv = SvIVX(TOPs); - SP--; - if (iv < 0) { - /* As (a) is a UV, it's >0, so it cannot be == */ - SETs(&PL_sv_no); - RETURN; - } - uv = SvUVX(TOPs); - } else { - iv = SvIVX(TOPm1s); - SP--; - if (iv < 0) { - /* As (b) is a UV, it's >0, so it cannot be == */ - SETs(&PL_sv_no); - RETURN; - } - uv = SvUVX(*(SP+1)); /* Do I want TOPp1s() ? */ - } + /* top of stack (b) is the iv */ + ivp = *SP; + uvp = *--SP; + } else { + uvp = *SP; + ivp = *--SP; + } + iv = SvIVX(ivp); + if (iv < 0) { + /* As uv is a UV, it's >0, so it cannot be == */ + SETs(&PL_sv_no); + RETURN; + } /* we know iv is >= 0 */ - SETs(boolSV((UV)iv == uv)); + SETs(boolSV((UV)iv == SvUVX(uvp))); RETURN; } } @@ -390,7 +390,7 @@ Perl_re_intuit_start(pTHX_ regexp *prog, SV *sv, char *strpos, char *check_at = Nullch; /* check substr found at this pos */ #ifdef DEBUGGING char *i_strpos = strpos; - SV *dsv = sv_2mortal(newSVpvn("", 0)); + SV *dsv = PERL_DEBUG_PAD_ZERO(0); #endif DEBUG_r({ @@ -1465,7 +1465,7 @@ Perl_regexec_flags(pTHX_ register regexp *prog, char *stringarg, register char * SV* oreplsv = GvSV(PL_replgv); bool do_utf8 = DO_UTF8(sv); #ifdef DEBUGGING - SV *dsv = sv_2mortal(newSVpvn("", 0)); + SV *dsv = PERL_DEBUG_PAD_ZERO(0); #endif PL_regcc = 0; @@ -2050,9 +2050,9 @@ S_regmatch(pTHX_ regnode *prog) #endif register bool do_utf8 = PL_reg_match_utf8; #ifdef DEBUGGING - SV *dsv0 = sv_2mortal(newSVpvn("", 0)); - SV *dsv1 = sv_2mortal(newSVpvn("", 0)); - SV *dsv2 = sv_2mortal(newSVpvn("", 0)); + SV *dsv0 = PERL_DEBUG_PAD_ZERO(0); + SV *dsv1 = PERL_DEBUG_PAD_ZERO(1); + SV *dsv2 = PERL_DEBUG_PAD_ZERO(2); #endif #ifdef DEBUGGING diff --git a/t/io/utf8.t b/t/io/utf8.t index 71c0d06797..e8caf722f2 100755 --- a/t/io/utf8.t +++ b/t/io/utf8.t @@ -12,7 +12,7 @@ BEGIN { no utf8; # needed for use utf8 not griping about the raw octets $| = 1; -print "1..29\n"; +print "1..26\n"; open(F,"+>:utf8",'a'); print F chr(0x100).'£'; @@ -216,75 +216,11 @@ for (@a) { close F; print "ok 26\n"; -# Set to 0 to fail on Linux as of 13096. -my $skiptell = 1; - -# sysread() should work on characters, not bytes -open F, "<:utf8", "a"; -$a = 0; -for (@a) { - unless (($c = sysread(F, $b, 1)) == 1 && - length($b) == 1 && - ord($b) == ord($_) && - ($skiptell || tell(F) == ($a += bytes::length($b))) - ) { - print '# ord($_) == ', ord($_), "\n"; - print '# ord($b) == ', ord($b), "\n"; - print '# length($b) == ', length($b), "\n"; - print '# bytes::length($b) == ', bytes::length($b), "\n"; - print '# tell(F) == ', tell(F), "\n"; - print '# $a == ', $a, "\n"; - print '# $c == ', $c, "\n"; - print "not "; - last; - } -} -close F; -print "ok 27\n"; - -# syswrite() on should work on characters, not bytes -open G, ">:utf8", "b"; -$a = 0; -for (@a) { - unless (($c = syswrite(G, $_, 1)) == 1 && - ($skiptell || tell(G) == ($a += bytes::length($_))) - ) { - print '# ord($_) == ', ord($_), "\n"; - print '# bytes::length($_) == ', bytes::length($_), "\n"; - print '# tell(G) == ', tell(G), "\n"; - print '# $a == ', $a, "\n"; - print '# $c == ', $c, "\n"; - print "not "; - last; - } -} -close G; -print "ok 28\n"; - -# did syswrite() get it right? -open G, "<:utf8", "b"; -$a = 0; -for (@a) { - unless (($c = sysread(G, $b, 1)) == 1 && - length($b) == 1 && - ord($b) == ord($_) && - ($skiptell || tell(G) == ($a += bytes::length($_))) - ) { - print '# ord($_) == ', ord($_), "\n"; - print '# ord($b) == ', ord($b), "\n"; - print '# length($b) == ', length($b), "\n"; - print '# bytes::length($b) == ', bytes::length($b), "\n"; - print '# tell(G) == ', tell(G), "\n"; - print '# $a == ', $a, "\n"; - print '# $c == ', $c, "\n"; - print "not "; - last; - } -} -close G; -print "ok 29\n"; +# sysread() and syswrite() tested in lib/open.t since Fnctl is used END { 1 while unlink "a"; 1 while unlink "b"; } + + diff --git a/t/lib/filter-util.pl b/t/lib/filter-util.pl index 824924bb89..826d85307e 100644 --- a/t/lib/filter-util.pl +++ b/t/lib/filter-util.pl @@ -49,6 +49,7 @@ foreach (@INC) $Perl = '' ; $Perl = ($ENV{'FULLPERL'} or $^X or 'perl') ; +$Perl = "$Perl -MMac::err=unix" if $^O eq 'MacOS'; $Perl = "$Perl -w" ; 1; diff --git a/vms/descrip_mms.template b/vms/descrip_mms.template index d303d2d681..7ccf7ce8c1 100644 --- a/vms/descrip_mms.template +++ b/vms/descrip_mms.template @@ -374,7 +374,7 @@ pod16 = [.lib.pod]perlreftut.pod [.lib.pod]perlrun.pod [.lib.pod]perlsec.pod pod17 = [.lib.pod]perlstyle.pod [.lib.pod]perlsub.pod [.lib.pod]perlsyn.pod pod18 = [.lib.pod]perlthrtut.pod [.lib.pod]perltie.pod [.lib.pod]perltoc.pod pod19 = [.lib.pod]perltodo.pod [.lib.pod]perltoot.pod [.lib.pod]perltooc.pod -pod20 = [.lib.pod]perltrap.pod [.lib.pod]perlunicode.pod [.lib.pod]perlvar.pod +pod20 = [.lib.pod]perltrap.pod [.lib.pod]perlunicode.pod [.lib.pod]perluniintro.pod [.lib.pod]perlvar.pod pod21 = [.lib.pod]perlxs.pod [.lib.pod]perlxstut.pod [.lib.pod]win32.pod [.lib.pod]perlvms.pod pod22 = [.lib.pod]perldebguts.pod [.lib.pod]perldebtut.pod [.lib.pod]perlebcdic.pod [.lib.pod]perliol.pod pod23 = [.lib.pod]perlnewmod.pod [.lib.pod]perlnumber.pod [.lib.pod]perlrequick.pod [.lib.pod]perlretut.pod [.lib.pod]perlutil.pod @@ -823,6 +823,9 @@ preplibrary : $(MINIPERL_EXE) $(LIBPREREQ) [.lib.pod]perlunicode.pod : [.pod]perlunicode.pod @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod] Copy/Log $(MMS$SOURCE) $(MMS$TARGET) +[.lib.pod]perluniintro.pod : [.pod]perluniintro.pod + @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod] + Copy/Log $(MMS$SOURCE) $(MMS$TARGET) [.lib.pod]perlutil.pod : [.pod]perlutil.pod @ If F$Search("[.lib]pod.dir").eqs."" Then Create/Directory [.lib.pod] Copy/Log $(MMS$SOURCE) $(MMS$TARGET) @@ -1323,7 +1326,6 @@ realclean : clean - If F$Search("[.t.lib]vms_stdio.t").nes."" Then Delete/NoConfirm/Log [.t.lib]vms_stdio.t;* cleansrc : clean -!GROK!THIS! - If F$Search("*.C;-1").nes."" Then Purge/NoConfirm/Log *.C - If F$Search("*.H;-1").nes."" Then Purge/NoConfirm/Log *.H - If F$Search("*.VMS;-1").nes."" Then Purge/NoConfirm/Log *.VMS @@ -1334,3 +1336,4 @@ cleansrc : clean - If F$Search("[.VMS]*.VMS;-1").nes."" Then Purge/NoConfirm/Log [.VMS]*.VMS - If F$Search("[.VMS...]*.pm;-1").nes."" Then Purge/NoConfirm/Log [.VMS...]*.pm - If F$Search("[.VMS...]*.xs;-1").nes."" Then Purge/NoConfirm/Log [.VMS...]*.xs +!GROK!THIS! |