This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
PerlIO::Via: check arg is non-NULL before using it.
[perl5.git] / pod / perl5100delta.pod
index e4ead03..6728559 100644 (file)
@@ -2,7 +2,7 @@
 
 =head1 NAME
 
-perldelta - what is new for perl 5.10.0
+perl5100delta - what is new for perl 5.10.0
 
 =head1 DESCRIPTION
 
@@ -103,7 +103,7 @@ nested balanced angle brackets:
        <                   #   match an opening angle bracket
        (?:                 #   match one of:
            (?>             #     don't backtrack over the inside of this group
-               [^<>]+      #       one or more non angle brackets
+               [^<>]+      #       one or more non angle brackets
            )               #     end non backtracking group
        |                   #     ... or ...
            (?1)            #     recurse to bracket 1 and try it again
@@ -200,6 +200,23 @@ logically match their complements.
 C<\R> matches a generic linebreak, that is, vertical whitespace, plus
 the multi-character sequence C<"\x0D\x0A">.
 
+=item Optional pre-match and post-match captures with the /p flag
+
+There is a new flag C</p> for regular expressions.  Using this
+makes the engine preserve a copy of the part of the matched string before
+the matching substring to the new special variable C<${^PREMATCH}>, the
+part after the matching substring to C<${^POSTMATCH}>, and the matched
+substring itself to C<${^MATCH}>.
+
+Perl is still able to store these substrings to the special variables
+C<$`>, C<$'>, C<$&>, but using these variables anywhere in the program
+adds a penalty to all regular expression matches, whereas if you use
+the C</p> flag and the new special variables instead, you pay only for
+the regular expressions where the flag is used.
+
+For more detail on the new variables, see L<perlvar>; for the use of
+the regular expression flag, see L<perlop> and L<perlre>.
+
 =back
 
 =head2 C<say()>
@@ -228,9 +245,9 @@ overriding the lexical declaration with C<our $_>. (Rafael Garcia-Suarez)
 =head2 The C<_> prototype
 
 A new prototype character has been added. C<_> is equivalent to C<$> but
-defaults to C<$_> if the corresponding argument isn't supplied. (both C<$>
-and C<_> denote a scalar). Due to the optional nature of the argument, you
-can only use it at the end of a prototype, or before a semicolon.
+defaults to C<$_> if the corresponding argument isn't supplied (both C<$>
+and C<_> denote a scalar). Due to the optional nature of the argument, 
+you can only use it at the end of a prototype, or before a semicolon.
 
 This has a small incompatible consequence: the prototype() function has
 been adjusted to return C<_> for some built-ins in appropriate cases (for
@@ -260,7 +277,10 @@ available: the C3 algorithm. See L<mro> for more information.
 Note that, due to changes in the implementation of class hierarchy search,
 code that used to undef the C<*ISA> glob will most probably break. Anyway,
 undef'ing C<*ISA> had the side-effect of removing the magic on the @ISA
-array and should not have been done in the first place.
+array and should not have been done in the first place. Also, the
+cache C<*::ISA::CACHE::> no longer exists; to force reset the @ISA cache,
+you now need to use the C<mro> API, or more simply to assign to @ISA
+(e.g. with C<@ISA = @ISA>).
 
 =head2 readdir() may return a "short filename" on Windows
 
@@ -310,7 +330,7 @@ To use state variables, one needs to enable them by using
     use feature 'state';
 
 or by using the C<-E> command-line switch in one-liners.
-See L<perlsub/"Persistent variables via state()">.
+See L<perlsub/"Persistent Private Variables">.
 
 =head2 Stacked filetest operators
 
@@ -393,7 +413,7 @@ details.
 
 This variable gives the native status returned by the last pipe close,
 backtick command, successful call to wait() or waitpid(), or from the
-system() operator. See L<perlrun> for details. (Contributed by Gisle Aas.)
+system() operator. See L<perlvar> for details. (Contributed by Gisle Aas.)
 
 =item C<${^RE_TRIE_MAXBUF}>
 
@@ -437,15 +457,13 @@ with it. (Larry Wall, Nicholas Clark)
 =head2 kill() on Windows
 
 On Windows platforms, C<kill(-9, $pid)> now kills a process tree.
-(On UNIX, this delivers the signal to all processes in the same process
+(On Unix, this delivers the signal to all processes in the same process
 group.)
 
 =head1 Incompatible Changes
 
 =head2 Packing and UTF-8 strings
 
-=for XXX update this
-
 The semantics of pack() and unpack() regarding UTF-8-encoded data has been
 changed. Processing is now by default character per character instead of
 byte per byte on the underlying encoding. Notably, code that used things
@@ -542,6 +560,14 @@ Previously, F<.pmc> files were loaded only if more recent than the
 matching F<.pm> file. Starting with 5.9.4, they'll be always loaded if
 they exist.
 
+=head2 $^V is now a C<version> object instead of a v-string
+
+$^V can still be used with the C<%vd> format in printf, but any
+character-level operations will now access the string representation
+of the C<version> object and not the ordinals of a v-string.
+Expressions like C<< substr($^V, 0, 2) >> or C<< split //, $^V >>
+no longer work and must be rewritten.
+
 =head2 @- and @+ in patterns
 
 The special arrays C<@-> and C<@+> are no longer interpolated in regular
@@ -616,8 +642,37 @@ Previously, the exception would not occur until Perl attempted to make
 use of the recursive inheritance while resolving a method or doing a
 C<$foo-E<gt>isa($bar)> lookup.
 
+=head2 warnings::enabled and warnings::warnif changed to favor users of modules
+
+The behaviour in 5.10.x favors the person using the module;
+The behaviour in 5.8.x favors the module writer;
+
+Assume the following code:
+
+  main calls Foo::Bar::baz()
+  Foo::Bar inherits from Foo::Base
+  Foo::Bar::baz() calls Foo::Base::_bazbaz()
+  Foo::Base::_bazbaz() calls: warnings::warnif('substr', 'some warning 
+message');
+
+On 5.8.x, the code warns when Foo::Bar contains C<use warnings;>
+It does not matter if Foo::Base or main have warnings enabled
+to disable the warning one has to modify Foo::Bar.
+
+On 5.10.0 and newer, the code warns when main contains C<use warnings;>
+It does not matter if Foo::Base or Foo::Bar have warnings enabled
+to disable the warning one has to modify main.
+
 =head1 Modules and Pragmata
 
+=head2 Upgrading individual core modules
+
+Even more core modules are now also available separately through the
+CPAN.  If you wish to update one of these modules, you don't need to
+wait for a new perl release.  From within the cpan shell, running the
+'r' command will report on modules with upgrades available.  See
+C<perldoc CPAN> for more information.
+
 =head2 Pragmata Changes
 
 =over 4
@@ -806,7 +861,7 @@ of C<CPANPLUS>.
 =item *
 
 C<Archive::Extract> is a generic archive extraction mechanism
-for F<.tar> (plain, gziped or bzipped) or F<.zip> files.
+for F<.tar> (plain, gzipped or bzipped) or F<.zip> files.
 
 =item *
 
@@ -834,6 +889,9 @@ included with Perl.
 C<Attribute::Handlers> can now report the caller's file and line number.
 (David Feldman)
 
+All interpreted attributes are now passed as array references. (Damian
+Conway)
+
 =item C<B::Lint>
 
 C<B::Lint> is now based on C<Module::Pluggable>, and so can be extended
@@ -957,7 +1015,7 @@ The L<perlreapi> manpage describes the interface to the perl interpreter
 used to write pluggable regular expression engines (by Ævar Arnfjörð
 Bjarmason).
 
-The L<perlunitut> manpage is an tutorial for programming with Unicode and
+The L<perlunitut> manpage is a tutorial for programming with Unicode and
 string encodings in Perl, courtesy of Juerd Waalboer.
 
 A new manual page, L<perlunifaq> (the Perl Unicode FAQ), has been added
@@ -1010,7 +1068,7 @@ their system dependent constants - as a result C<use POSIX;> now takes about
 
 The new compilation flag C<PERL_DONT_CREATE_GVSV>, introduced as an option
 in perl 5.8.8, is turned on by default in perl 5.9.3. It prevents perl
-from creating an empty scalar with every new typeglob. See L<perl588delta>
+from creating an empty scalar with every new typeglob. See L<perl589delta>
 for details.
 
 =head2 Weak references are cheaper
@@ -1201,6 +1259,9 @@ z/OS.
 
 Perl has been reported to work on DragonFlyBSD and MidnightBSD.
 
+Perl has also been reported to work on NexentaOS
+( http://www.gnusolaris.org/ ).
+
 The VMS port has been improved. See L<perlvms>.
 
 Support for Cray XT4 Catamount/Qk has been added. See
@@ -1259,7 +1320,7 @@ D. Hedden)
 
 chr() on a negative value now gives C<\x{FFFD}>, the Unicode replacement
 character, unless when the C<bytes> pragma is in effect, where the low
-eight bytes of the value are used.
+eight bits of the value are used.
 
 =item PERL5SHELL and tainting
 
@@ -1445,7 +1506,7 @@ to reflect this.)
 
 =head2 Elimination of SVt_PVBM
 
-Related to this, the internal type C<SVt_PVBM> has been been removed. This
+Related to this, the internal type C<SVt_PVBM> has been removed. This
 dedicated type of C<SV> was used by the C<index> operator and parts of the
 regexp engine to facilitate fast Boyer-Moore matches. Its use internally has
 been replaced by C<SV>s of type C<SVt_PVGV>.
@@ -1515,7 +1576,7 @@ inherits from C<B::SV> (it used to inherit from C<B::IV>).
 
 The anonymous hash and array constructors now take 1 op in the optree
 instead of 3, now that pp_anonhash and pp_anonlist return a reference to
-an hash/array when the op is flagged with OPf_SPECIAL (Nicholas Clark).
+a hash/array when the op is flagged with OPf_SPECIAL. (Nicholas Clark)
 
 =head1 Known Problems
 
@@ -1523,10 +1584,37 @@ There's still a remaining problem in the implementation of the lexical
 C<$_>: it doesn't work inside C</(?{...})/> blocks. (See the TODO test in
 F<t/op/mydef.t>.)
 
+Stacked filetest operators won't work when the C<filetest> pragma is in
+effect, because they rely on the stat() buffer C<_> being populated, and
+filetest bypasses stat().
+
+=head2 UTF-8 problems
+
+The handling of Unicode still is unclean in several places, where it's
+dependent on whether a string is internally flagged as UTF-8. This will
+be made more consistent in perl 5.12, but that won't be possible without
+a certain amount of backwards incompatibility.
+
 =head1 Platform Specific Problems
 
+When compiled with g++ and thread support on Linux, it's reported that the
+C<$!> stops working correctly. This is related to the fact that the glibc
+provides two strerror_r(3) implementation, and perl selects the wrong
+one.
+
 =head1 Reporting Bugs
 
+If you find what you think is a bug, you might check the articles
+recently posted to the comp.lang.perl.misc newsgroup and the perl
+bug database at http://rt.perl.org/rt3/ .  There may also be
+information at http://www.perl.org/ , the Perl Home Page.
+
+If you believe you have an unreported bug, please run the B<perlbug>
+program included with your release.  Be sure to trim your bug down
+to a tiny but sufficient test case.  Your bug report, along with the
+output of C<perl -V>, will be sent off to perlbug@perl.org to be
+analysed by the Perl porting team.
+
 =head1 SEE ALSO
 
 The F<Changes> file and the perl590delta to perl595delta man pages for