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