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