d072de028ebaca2bd68692acd1f224c525decfb7
[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 Tainting and printf
15
16 When perl is run under taint mode, C<printf()> and C<sprintf()> will now
17 reject any tainted format argument. (Rafael Garcia-SUarez)
18
19 =head2 Removal of the bytecode compiler and of perlcc
20
21 C<perlcc>, the byteloader and the supporting modules (B::C, B::CC,
22 B::Bytecode, etc.) are no longer distributed with the perl sources. Those
23 experimental tools have never worked reliably, and, due to the lack of
24 volunteers to keep them in line with the perl interpreter developments, it
25 was decided to remove them instead of shipping a broken version of those.
26 The last version of those modules can be found with perl 5.9.4.
27
28 However the B compiler framework stays supported in the perl core, as with
29 the more useful modules it has permitted (among others, B::Deparse and
30 B::Concise).
31
32 =head2 Removal of the JPL
33
34 The JPL (Java-Perl Linguo) has been removed from the perl sources tarball.
35
36 =head1 Core Enhancements
37
38 =head2 Regular expressions
39
40 =over 4
41
42 =item Recursive Patterns
43
44 It is now possible to write recursive patterns without using the C<(??{})>
45 construct. This new way is more efficient, and in many cases easier to
46 read.
47
48 Each capturing parenthesis can now be treated as an independent pattern
49 that can be entered by using the C<(?PARNO)> syntax (C<PARNO> standing for
50 "parenthesis number"). For example, the following pattern will match
51 nested balanced angle brackets:
52
53     /
54      ^                      # start of line
55      (                      # start capture buffer 1
56         <                   #   match an opening angle bracket
57         (?:                 #   match one of:
58             (?>             #     don't backtrack over the inside of this group
59                 [^<>]+      #       one or more non angle brackets
60             )               #     end non backtracking group
61         |                   #     ... or ...
62             (?1)            #     recurse to bracket 1 and try it again
63         )*                  #   0 or more times.
64         >                   #   match a closing angle bracket
65      )                      # end capture buffer one
66      $                      # end of line
67     /x
68
69 Note, users experienced with PCRE will find that the Perl implementation
70 of this feature differs from the PCRE one in that it is possible to
71 backtrack into a recursed pattern, whereas in PCRE the recursion is
72 atomic or "possessive" in nature. (Yves Orton)
73
74 =item Named Capture Buffers
75
76 It is now possible to name capturing parenthesis in a pattern and refer to
77 the captured contents by name. The naming syntax is C<< (?<NAME>....) >>.
78 It's possible to backreference to a named buffer with the C<< \k<NAME> >>
79 syntax. In code, the new magical hash C<%+> can be used to access the
80 contents of the buffers.
81
82 Thus, to replace all doubled chars, one could write
83
84     s/(?<letter>.)\k<letter>/$+{letter}/g
85
86 Only buffers with defined contents will be "visible" in the hash, so
87 it's possible to do something like
88
89     foreach my $name (keys %+) {
90         print "content of buffer '$name' is $+{$name}\n";
91     }
92
93 Users exposed to the .NET regex engine will find that the perl
94 implementation differs in that the numerical ordering of the buffers
95 is sequential, and not "unnamed first, then named". Thus in the pattern
96
97    /(A)(?<B>B)(C)(?<D>D)/
98
99 $1 will be 'A', $2 will be 'B', $3 will be 'C' and $4 will be 'D' and not
100 $1 is 'A', $2 is 'C' and $3 is 'B' and $4 is 'D' that a .NET programmer
101 would expect. This is considered a feature. :-) (Yves Orton)
102
103 =item Possessive Quantifiers
104
105 Perl now supports the "possessive quantifier" syntax of the "atomic match" 
106 pattern. Basically a possessive quantifier matches as much as it can and never
107 gives any back. Thus it can be used to control backtracking. The syntax is 
108 similar to non-greedy matching, except instead of using a '?' as the modifier
109 the '+' is used. Thus C<?+>, C<*+>, C<++>, C<{min,max}+> are now legal
110 quantifiers. (Yves Orton)
111
112 =item Backtracking control verbs
113
114 The regex engine now supports a number of special purpose backtrack
115 control verbs: (*COMMIT), (*MARK), (*CUT), (*ERROR), (*FAIL) and
116 (*ACCEPT). See L<perlre> for their descriptions. (Yves Orton)
117
118 =back
119
120 =head2 The C<_> prototype
121
122 A new prototype character has been added. C<_> is equivalent to C<$> (it
123 denotes a scalar), but defaults to C<$_> if the corresponding argument
124 isn't supplied. Due to the optional nature of the argument, you can only
125 use it at the end of a prototype, or before a semicolon.
126
127 This has a small incompatible consequence: the prototype() function has
128 been adjusted to return C<_> for some built-ins in appropriate cases (for
129 example, C<prototype('CORE::rmdir')>). (Rafael Garcia-Suarez)
130
131 =head2 UNITCHECK blocks
132
133 C<UNITCHECK>, a new special code block has been introduced, in addition to
134 C<BEGIN>, C<CHECK>, C<INIT> and C<END>.
135
136 C<CHECK> and C<INIT> blocks, while useful for some specialized purposes,
137 are always executed at the transition between the compilation and the
138 execution of the main program, and thus are useless whenever code is
139 loaded at runtime. On the other hand, C<UNITCHECK> blocks are executed
140 just after the unit which defined them has been compiled. See L<perlmod>
141 for more information. (Alex Gough)
142
143 =head2 readpipe() is now overridable
144
145 The built-in function readpipe() is now overridable. Overriding it permits
146 also to override its operator counterpart, C<qx//> (a.k.a. C<``>). (Rafael
147 Garcia-Suarez)
148
149 =head2 UCD 5.0.0
150
151 The copy of the Unicode Character Database included in Perl 5.9 has
152 been updated to version 5.0.0.
153
154 =head1 Modules and Pragmas
155
156 =head2 New Core Modules
157
158 =over 4
159
160 =item *
161
162 C<Locale::Maketext::Simple>, needed by CPANPLUS, is a simple wrapper around
163 C<Locale::Maketext::Lexicon>. Note that C<Locale::Maketext::Lexicon> isn't
164 included in the perl core; the behaviour of C<Locale::Maketext::Simple>
165 gracefully degrades when the later isn't present.
166
167 =item *
168
169 C<Params::Check> implements a generic input parsing/checking mechanism. It
170 is used by CPANPLUS.
171
172 =item *
173
174 C<Term::UI> simplifies the task to ask questions at a terminal prompt.
175
176 =item *
177
178 C<Object::Accessor> provides an interface to create per-object accessors.
179
180 =back
181
182 =head2 Module changes
183
184 =over 4
185
186 =item C<base>
187
188 The C<base> pragma now warns if a class tries to inherit from itself.
189
190 =item C<warnings>
191
192 The C<warnings> pragma doesn't load C<Carp> anymore. That means that code
193 that used C<Carp> routines without having loaded it at compile time might
194 need to be adjusted; typically, the following (faulty) code won't work
195 anymore, and will require parentheses to be added after the function name:
196
197     use warnings;
198     require Carp;
199     Carp::confess "argh";
200
201 =back
202
203 =head1 Utility Changes
204
205 =head1 Documentation
206
207 =head1 Performance Enhancements
208
209 =head1 Installation and Configuration Improvements
210
211 =head2 C++ compatibility
212
213 Efforts have been made to make perl and the core XS modules compilable
214 with various C++ compilers (although the situation is not perfect with
215 some of the compilers on some of the platforms tested.)
216
217 =head2 Ports
218
219 Perl has been reported to work on MidnightBSD.
220
221 =head1 Selected Bug Fixes
222
223 PerlIO::scalar will now prevent writing to read-only scalars. Moreover,
224 seek() is now supported with PerlIO::scalar-based filehandles, the
225 underlying string being zero-filled as needed.
226
227 study() never worked for UTF-8 strings, but could lead to false results.
228 It's now a no-op on UTF-8 data. (Yves Orton)
229
230 The signals SIGILL, SIGBUS and SIGSEGV are now always delivered in an
231 "unsafe" manner (contrary to other signals, that are deferred until the
232 perl interpreter reaches a reasonably stable state; see
233 L<perlipc/"Deferred Signals (Safe Signals)">).
234
235 When a module or a file is loaded through an @INC-hook, and when this hook
236 has set a filename entry in %INC, __FILE__ is now set for this module
237 accordingly to the contents of that %INC entry.
238
239 =head1 New or Changed Diagnostics
240
241 =head2 Variable length character upgraded in print
242
243 This new UTF-8 warning indicates a situation where a non-Unicode string is
244 sent to a UTF-8 output layer, but given what the string contains, encoding
245 problems such as double UTF-8 encoding might arise. See L<perldiag>.
246
247 =head1 Changed Internals
248
249 The anonymous hash and array constructors now take 1 op in the optree
250 instead of 3, now that pp_anonhash and pp_anonlist return a reference to
251 an hash/array when the op is flagged with OPf_SPECIAL (Nicholas Clark).
252
253 =head1 Known Problems
254
255 =head2 Platform Specific Problems
256
257 =head1 Reporting Bugs
258
259 If you find what you think is a bug, you might check the articles
260 recently posted to the comp.lang.perl.misc newsgroup and the perl
261 bug database at http://rt.perl.org/rt3/ .  There may also be
262 information at http://www.perl.org/ , the Perl Home Page.
263
264 If you believe you have an unreported bug, please run the B<perlbug>
265 program included with your release.  Be sure to trim your bug down
266 to a tiny but sufficient test case.  Your bug report, along with the
267 output of C<perl -V>, will be sent off to perlbug@perl.org to be
268 analysed by the Perl porting team.
269
270 =head1 SEE ALSO
271
272 The F<Changes> file for exhaustive details on what changed.
273
274 The F<INSTALL> file for how to build Perl.
275
276 The F<README> file for general stuff.
277
278 The F<Artistic> and F<Copying> files for copyright information.
279
280 =cut