5d7e68609f4ba1080f9f850b35d3e7ca006bec08
[p5sagit/p5-mst-13.2.git] / pod / perl595delta.pod
1 =head1 NAME
2
3 perldelta - what is new for perl v5.9.5
4
5 =head1 DESCRIPTION
6
7 This document describes differences between the 5.9.4 and the 5.9.5
8 development releases. See L<perl590delta>, L<perl591delta>,
9 L<perl592delta>, L<perl593delta> and L<perl594delta> for the differences
10 between 5.8.0 and 5.9.4.
11
12 =head1 Incompatible Changes
13
14 =head2 Removal of the bytecode compiler and of perlcc
15
16 C<perlcc>, the byteloader and the supporting modules (B::C, B::CC,
17 B::Bytecode, etc.) are no longer distributed with the perl sources. Those
18 experimental tools have never worked reliably, and, due to the lack of
19 volunteers to keep them in line with the perl interpreter developments, it
20 was decided to remove them instead of shipping a broken version of those.
21 The last version of those modules can be found with perl 5.9.4.
22
23 However the B compiler framework stays supported in the perl core, as with
24 the more useful modules it has permitted (among others, B::Deparse and
25 B::Concise).
26
27 =head2 Removal of the JPL
28
29 The JPL (Java-Perl Linguo) has been removed from the perl sources tarball.
30
31 =head1 Core Enhancements
32
33 =head2 Regular expressions
34
35 =over 4
36
37 =item Recursive Patterns
38
39 It is now possible to write recursive patterns without using the C<(??{})>
40 construct. This new way is more efficient, and in many cases easier to
41 read.
42
43 Each capturing parenthesis can now be treated as an independent pattern
44 that can be entered by using the C<(?PARNO)> syntax (C<PARNO> standing for
45 "parenthesis number"). For example, the following pattern will match
46 nested balanced angle brackets:
47
48     /
49      ^                      # start of line
50      (                      # start capture buffer 1
51         <                   #   match an opening angle bracket
52         (?:                 #   match one of:
53             (?>             #     don't backtrack over the inside of this group
54                 [^<>]+      #       one or more non angle brackets
55             )               #     end non backtracking group
56         |                   #     ... or ...
57             (?1)            #     recurse to bracket 1 and try it again
58         )*                  #   0 or more times.
59         >                   #   match a closing angle bracket
60      )                      # end capture buffer one
61      $                      # end of line
62     /x
63
64 Note, users experienced with PCRE will find that the Perl implementation
65 of this feature differs from the PCRE one in that it is possible to
66 backtrack into a recursed pattern, whereas in PCRE the recursion is
67 atomic or "possessive" in nature. (Yves Orton)
68
69 =item Named Capture Buffers
70
71 It is now possible to name capturing parenthesis in a pattern and refer to
72 the captured contents by name. The naming syntax is C<< (?<NAME>....) >>.
73 It's possible to backreference to a named buffer with the C<< \k<NAME> >>
74 syntax. In code, the new magical hash C<%+> can be used to access the
75 contents of the buffers.
76
77 Thus, to replace all doubled chars, one could write
78
79     s/(?<letter>.)\k<letter>/$+{letter}/g
80
81 Only buffers with defined contents will be "visible" in the hash, so
82 it's possible to do something like
83
84     foreach my $name (keys %+) {
85         print "content of buffer '$name' is $+{$name}\n";
86     }
87
88 Users exposed to the .NET regex engine will find that the perl
89 implementation differs in that the numerical ordering of the buffers
90 is sequential, and not "unnamed first, then named". Thus in the pattern
91
92    /(A)(?<B>B)(C)(?<D>D)/
93
94 $1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not
95 $1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmer
96 would expect. This is considered a feature. :-) (Yves Orton)
97
98 =item Possessive Quantifiers
99
100 Perl now supports the "possessive quantifier" syntax of the "atomic match" 
101 pattern. Basically a possessive quantifier matches as much as it can and never
102 gives any back. Thus it can be used to control backtracking. The syntax is 
103 similar to non-greedy matching, except instead of using a '?' as the modifier
104 the '+' is used. Thus C<?+>, C<*+>, C<++>, C<{min,max}+> are now legal
105 quantifiers. (Yves Orton)
106
107 =back
108
109 =head2 The C<_> prototype
110
111 A new prototype character has been added. C<_> is equivalent to C<$> (it
112 denotes a scalar), but defaults to C<$_> if the corresponding argument
113 isn't supplied. Due to the optional nature of the argument, you can only
114 use it at the end of a prototype, or before a semicolon.
115
116 This has a small incompatible consequence: the prototype() function has
117 been adjusted to return C<_> for some built-ins in appropriate cases (for
118 example, C<prototype('CORE::rmdir')>). (Rafael Garcia-Suarez)
119
120 =head2 UCD 5.0.0
121
122 The copy of the Unicode Character Database included in Perl 5.9 has
123 been updated to version 5.0.0.
124
125 =head1 Modules and Pragmas
126
127 =head2 New Core Modules
128
129 =over 4
130
131 =item *
132
133 C<Locale::Maketext::Simple>, needed by CPANPLUS, is a simple wrapper around
134 C<Locale::Maketext::Lexicon>. Note that C<Locale::Maketext::Lexicon> isn't
135 included in the perl core; the behaviour of C<Locale::Maketext::Simple>
136 gracefully degrades when the later isn't present.
137
138 =item *
139
140 C<Params::Check> implements a generic input parsing/checking mechanism. It
141 is used by CPANPLUS.
142
143 =back
144
145 =head2 Module changes
146
147 =over 4
148
149 =item C<base>
150
151 The C<base> pragma now warns if a class tries to inherit from itself.
152
153 =item C<warnings>
154
155 The C<warnings> pragma doesn't load C<Carp> anymore. That means that code
156 that used C<Carp> routines without having loaded it at compile time might
157 need to be adjusted; typically, the following (faulty) code won't work
158 anymore, and will require parentheses to be added after the function name:
159
160     use warnings;
161     require Carp;
162     Carp::confess "argh";
163
164 =back
165
166 =head1 Utility Changes
167
168 =head1 Documentation
169
170 =head1 Performance Enhancements
171
172 =head1 Installation and Configuration Improvements
173
174 =head2 C++ compatibility
175
176 Efforts have been made to make perl and the core XS modules compilable
177 with various C++ compilers (although the situation is not perfect with
178 some of the compilers on some of the platforms tested.)
179
180 =head2 Ports
181
182 Perl has been reported to work on MidnightBSD.
183
184 =head1 Selected Bug Fixes
185
186 PerlIO::scalar will now prevent writing to read-only scalars.
187
188 study() never worked for UTF-8 strings, but could lead to false results.
189 It's now a no-op on UTF-8 data. (Yves Orton)
190
191 =head1 New or Changed Diagnostics
192
193 =head1 Changed Internals
194
195 The anonymous hash and array constructors now take 1 op in the optree
196 instead of 3, now that pp_anonhash and pp_anonlist return a reference to
197 an hash/array when the op is flagged with OPf_SPECIAL (Nicholas Clark).
198
199 =head1 Known Problems
200
201 =head2 Platform Specific Problems
202
203 =head1 Reporting Bugs
204
205 If you find what you think is a bug, you might check the articles
206 recently posted to the comp.lang.perl.misc newsgroup and the perl
207 bug database at http://rt.perl.org/rt3/ .  There may also be
208 information at http://www.perl.org/ , the Perl Home Page.
209
210 If you believe you have an unreported bug, please run the B<perlbug>
211 program included with your release.  Be sure to trim your bug down
212 to a tiny but sufficient test case.  Your bug report, along with the
213 output of C<perl -V>, will be sent off to perlbug@perl.org to be
214 analysed by the Perl porting team.
215
216 =head1 SEE ALSO
217
218 The F<Changes> file for exhaustive details on what changed.
219
220 The F<INSTALL> file for how to build Perl.
221
222 The F<README> file for general stuff.
223
224 The F<Artistic> and F<Copying> files for copyright information.
225
226 =cut