doc 742adb
[p5sagit/p5-mst-13.2.git] / pod / perl5131delta.pod
CommitLineData
d4438f94 1=encoding utf8
2
3=head1 NAME
4
f83c51e5 5perl5131delta - what is new for perl v5.13.1
d4438f94 6
7=head1 DESCRIPTION
8
9This document describes differences between the 5.13.0 release and
10the 5.13.1 release.
11
12If you are upgrading from an earlier release such as 5.10, first read
13L<perl5120delta>, which describes differences between 5.10 and
145.12.
15
d4438f94 16=head1 Incompatible Changes
17
df5278db 18=head2 "C<\cI<X>>"
d4438f94 19
df5278db 20The backslash-c construct was designed as a way of specifying
21non-printable characters, but there were no restrictions (on ASCII
22platforms) on what the character following the C<c> could be. Now, that
23character must be one of the ASCII characters.
d4438f94 24
72ecaef9 25=head2 localised tied hashes, arrays and scalars are no longed tied
26
27In the following:
28
29 tie @a, ...;
30 {
31 local @a;
32 # here, @a is a now a new, untied array
33 }
34 # here, @a refers again to the old, tied array
35
36The new local array used to be made tied too, which was fairly pointless,
37and has now been fixed. This fix could however potentially cause a change
38in behaviour of some code.
39
06b608b9 40=head2 C<given> return values
41
42Starting from this release, C<given> blocks returns the last evaluated
43expression, or an empty list if the block was exited by C<break>. Thus you
44can now write:
45
46 my $type = do {
47 given ($num) {
48 break when undef;
49 'integer' when /^[+-]?[0-9]+$/;
50 'float' when /^[+-]?[0-9]+(?:\.[0-9]+)?$/;
51 'unknown';
52 }
53 };
54
55See L<perlsyn/Return value> for details.
56
d4438f94 57=head1 Core Enhancements
58
9d5401ce 59=head2 Exception Handling Reliability
60
61Several changes have been made to the way C<die>, C<warn>, and C<$@>
62behave, in order to make them more reliable and consistent.
63
64When an exception is thrown inside an C<eval>, the exception is no
65longer at risk of being clobbered by code running during unwinding
66(e.g., destructors). Previously, the exception was written into C<$@>
67early in the throwing process, and would be overwritten if C<eval> was
68used internally in the destructor for an object that had to be freed
69while exiting from the outer C<eval>. Now the exception is written
70into C<$@> last thing before exiting the outer C<eval>, so the code
71running immediately thereafter can rely on the value in C<$@> correctly
72corresponding to that C<eval>.
73
74Likewise, a C<local $@> inside an C<eval> will no longer clobber any
75exception thrown in its scope. Previously, the restoration of C<$@> upon
76unwinding would overwrite any exception being thrown. Now the exception
77gets to the C<eval> anyway. So C<local $@> is safe inside an C<eval>,
78albeit of rather limited use.
79
80Exceptions thrown from object destructors no longer modify the C<$@>
81of the surrounding context. (If the surrounding context was exception
82unwinding, this used to be another way to clobber the exception being
83thrown. Due to the above change it no longer has that significance,
84but there are other situations where C<$@> is significant.) Previously
85such an exception was sometimes emitted as a warning, and then either
86string-appended to the surrounding C<$@> or completely replaced the
87surrounding C<$@>, depending on whether that exception and the surrounding
88C<$@> were strings or objects. Now, an exception in this situation is
89always emitted as a warning, leaving the surrounding C<$@> untouched.
90In addition to object destructors, this also affects any function call
91performed by XS code using the C<G_KEEPERR> flag.
92
93C<$@> is also no longer used as an internal temporary variable when
94preparing to C<die>. Previously it was internally necessary to put
95any exception object (any non-string exception) into C<$@> first,
96before it could be used as an exception. (The C API still offers the
97old option, so an XS module might still clobber C<$@> in the old way.)
98This change together with the foregoing means that, in various places,
99C<$@> may be observed to contain its previously-assigned value, rather
100than having been overwritten by recent exception-related activity.
101
102Warnings for C<warn> can now be objects, in the same way as exceptions
103for C<die>. If an object-based warning gets the default handling,
104of writing to standard error, it will of course still be stringified
105along the way. But a C<$SIG{__WARN__}> handler will now receive an
106object-based warning as an object, where previously it was passed the
107result of stringifying the object.
108
d4438f94 109=head1 Modules and Pragmata
110
fcc05cd0 111=head2 Updated Modules
d4438f94 112
d41251f5 113=over
114
115=item C<Errno>
116
117The implementation of C<Errno> has been refactored to use about 55% less memory.
118There should be no user-visible changes.
119
f8a182a2 120=item Perl 4 C<.pl> libraries
121
122These historical libraries have been minimally modified to avoid using
123C<$[>. This is to prepare them for the deprecation of C<$[>.
124
d6445baf 125=item C<B::Deparse>
126
127A bug has been fixed when deparsing a nextstate op that has both a
128change of package (relative to the previous nextstate), or a change of
129C<%^H> or other state, and a label. Previously the label was emitted
130first, leading to syntactically invalid output because a label is not
131permitted immediately before a package declaration, B<BEGIN> block,
132or some other things. Now the label is emitted last.
133
134=back
135
d4438f94 136=head2 Removed Modules and Pragmata
137
d41251f5 138The following modules have been removed from the core distribution, and if
139needed should be installed from CPAN instead.
140
141=over
142
143=item C<Class::ISA>
144
145=item C<Pod::Plainer>
146
147=item C<Switch>
148
149=back
150
151The removal of C<Shell> has been deferred until after 5.14, as the
152implementation of C<Shell> shipped with 5.12.0 did not correctly issue the
153warning that it was to be removed from core.
154
d4438f94 155=head1 New Documentation
156
d4438f94 157=over 4
158
fcc05cd0 159=item perlgpl
d4438f94 160
fcc05cd0 161L<perlgpl> has been updated to contain GPL version 1, as is included in the
162F<README> distributed with perl.
d4438f94 163
164=back
165
166=head1 Selected Bug Fixes
167
d4438f94 168=over 4
169
170=item *
171
fcc05cd0 172Naming a deprecated character in \N{...} will not leak memory.
d4438f94 173
fcc05cd0 174=item *
d4438f94 175
fcc05cd0 176FETCH is no longer called needlessly on some tied variables.
d4438f94 177
fcc05cd0 178=item *
d4438f94 179
fcc05cd0 180The trie runtime code should no longer allocate massive amounts of memory,
181fixing #74484.
d4438f94 182
183=back
184
185=head1 Changed Internals
186
d4438f94 187=over 4
188
189=item *
190
5149cfce 191The protocol for unwinding the C stack at the last stage of a C<die>
192has changed how it identifies the target stack frame. This now uses
193a separate variable C<PL_restartjmpenv>, where previously it relied on
194the C<blk_eval.cur_top_env> pointer in the C<eval> context frame that
195has nominally just been discarded. This change means that code running
196during various stages of Perl-level unwinding no longer needs to take
197care to avoid destroying the ghost frame.
198
199=item *
200
d41251f5 201The format of entries on the scope stack has been changed, resulting in a
202reduction of memory usage of about 10%. In particular, the memory used by
203the scope stack to record each active lexical variable has been halved.
204
205=item *
206
207Memory allocation for pointer tables has been changed. Previously
208C<Perl_ptr_table_store> allocated memory from the same arena system as C<SV>
209bodies and C<HE>s, with freed memory remaining bound to those arenas until
210interpreter exit. Now it allocates memory from arenas private to the specific
211pointer table, and that memory is returned to the system when
212C<Perl_ptr_table_free> is called. Additionally, allocation and release are both
213less CPU intensive.
214
215=item *
216
fcc05cd0 217A new function, Perl_magic_methcall has been added that wraps the setup needed
218to call a magic method like FETCH (the existing S_magic_methcall function has
219been renamed S_magic_methcall1).
d4438f94 220
221=back
222
223=head1 Deprecations
224
d4438f94 225The following items are now deprecated.
226
227=over 4
228
d41251f5 229=item C<Perl_ptr_table_clear>
230
231C<Perl_ptr_table_clear> is no longer part of Perl's public API. Calling it now
232generates a deprecation warning, and it will be removed in a future
233release.
234
d4438f94 235=back
236
d4438f94 237=head1 Acknowledgements
238
fcc05cd0 239Perl 5.13.1 represents thirty days of development since Perl 5.13.0 and
240contains 15390 lines of changes across 289 files from 34 authors and
241committers.
242
243Thank you to the following for contributing to this release:
d4438f94 244
fcc05cd0 245Ævar Arnfjörð Bjarmason, Arkturuz, Chris 'BinGOs' Williams, Craig A. Berry,
246Curtis Jewell, Dan Dascalescu, David Golden, David Mitchell, Father
247Chrysostomos, Gene Sullivan, gfx, Gisle Aas, H.Merijn Brand, James E Keenan,
248James Mastros, Jan Dubois, Jesse Vincent, Karl Williamson, Leon Brocard,
249Lubomir Rintel (GoodData), Nicholas Clark, Philippe Bruhat (BooK), Rafael
250Garcia-Suarez, Rainer Tammer, Ricardo Signes, Richard Soderberg, Robin Barker,
251Ruslan Zakirov, Steffen Mueller, Todd Rinaldo, Tony Cook, Vincent Pit, Zefram
d4438f94 252
253=head1 Reporting Bugs
254
255If you find what you think is a bug, you might check the articles
256recently posted to the comp.lang.perl.misc newsgroup and the perl
257bug database at http://rt.perl.org/perlbug/ . There may also be
258information at http://www.perl.org/ , the Perl Home Page.
259
260If you believe you have an unreported bug, please run the B<perlbug>
261program included with your release. Be sure to trim your bug down
262to a tiny but sufficient test case. Your bug report, along with the
263output of C<perl -V>, will be sent off to perlbug@perl.org to be
264analysed by the Perl porting team.
265
266If the bug you are reporting has security implications, which make it
267inappropriate to send to a publicly archived mailing list, then please send
268it to perl5-security-report@perl.org. This points to a closed subscription
269unarchived mailing list, which includes all the core committers, who be able
270to help assess the impact of issues, figure out a resolution, and help
271co-ordinate the release of patches to mitigate or fix the problem across all
272platforms on which Perl is supported. Please only use this address for
273security issues in the Perl core, not for modules independently
274distributed on CPAN.
275
276=head1 SEE ALSO
277
278The F<Changes> file for an explanation of how to view exhaustive details
279on what changed.
280
281The F<INSTALL> file for how to build Perl.
282
283The F<README> file for general stuff.
284
285The F<Artistic> and F<Copying> files for copyright information.
286
287=cut