remove an 'if $a if 0' from AutoSplit.t
[p5sagit/p5-mst-13.2.git] / pod / perl591delta.pod
CommitLineData
1400179b 1=head1 NAME
2
3perldelta - what is new for perl v5.9.1
4
5=head1 DESCRIPTION
6
7This document describes differences between the 5.9.0 release and
9b11ae5e 8the 5.9.1 release. See L<perl590delta> for the differences between
95.8.0 and 5.9.0.
1400179b 10
11=head1 Incompatible Changes
12
13=head1 Core Enhancements
14
59f00321 15=head2 Lexical C<$_>
16
17The default variable C<$_> can now be lexicalized, by declaring it like
18any other lexical variable, with a simple
19
20 my $_;
21
22The operations that default on C<$_> will use the lexically-scoped
23version of C<$_> when it exists, instead of the global C<$_>.
24
25In a C<map> or a C<grep> block, if C<$_> was previously my'ed, then the
26C<$_> inside the block is lexical as well (and scoped to the block).
27
28In a scope where C<$_> has been lexicalized, you can still have access to
29the global version of C<$_> by using C<$::_>, or, more simply, by
30overriding the lexical declaration with C<our $_>.
31
1400179b 32=head2 Tied hashes in scalar context
33
34As of perl 5.8.2, tied hashes did not return anything useful in scalar
35context, for example when used as boolean tests:
36
37 if (%tied_hash) { ... }
38
39The old nonsensical behaviour was always to return false,
40regardless of whether the hash is empty or has elements.
41
42There is now an interface for the implementors of tied hashes to implement
43the behaviour of a hash in scalar context, via the SCALAR method (see
44L<perltie>). Without a SCALAR method, perl will try to guess whether
45the hash is empty, by testing if it's inside an iteration (in this case
46it can't be empty) or by calling FIRSTKEY.
47
f0f92e3c 48=head2 Formats
49
50Formats were improved in several ways. A new field, C<^*>, can be used for
51variable-width, one-line-at-a-time text. Null characters are now handled
52correctly in picture lines. Using C<@#> and C<~~> together will now
53produce a compile-time error, as those format fields are incompatible.
54L<perlform> has been improved, and miscellaneous bugs fixed.
55
56=head2 The C<:unique> attribute is only meaningful for globals
57
58Now applying C<:unique> to lexical variables and to subroutines will
59result in a compilation error.
60
fbb0b3b3 61=head2 Stacked filetest operators
62
63As a new form of syntactic sugar, it's now possible to stack up filetest
64operators. You can now write C<-f -w -x $file> in a row to mean
65C<-x $file && -w _ && -f _>. See L<perlfunc/-X>.
66
1400179b 67=head1 Modules and Pragmata
68
f0f92e3c 69=over 4
70
a1686c72 71=item Benchmark
72
73In C<Benchmark>, cmpthese() and timestr() now use the time statistics of
74children instead of parent when the selected style is 'nop'.
75
f0f92e3c 76=item Carp
77
78The error messages produced by C<Carp> now include spaces between the
79arguments in function argument lists: this makes long error messages
80appear more nicely in browsers and other tools.
81
82=item Exporter
83
84C<Exporter> will now recognize grouping tags (such as C<:name>) anywhere
85in the import list, not only at the beginning.
86
87=item FindBin
88
89A function C<again> is provided to resolve problems where modules in different
90directories wish to use FindBin.
91
92=item List::Util
93
94You can now weaken references to read only values.
95
96=item threads::shared
97
98C<cond_wait> has a new two argument form. C<cond_timedwait> has been added.
99
100=back
101
1400179b 102=head1 Utility Changes
103
104C<find2perl> now assumes C<-print> as a default action. Previously, it
105needed to be specified explicitly.
106
f0f92e3c 107A new utility, C<prove>, makes it easy to run an individual regression test
108at the command line. C<prove> is part of Test::Harness, which users of earlier
109Perl versions can install from CPAN.
110
111=head1 Documentation
112
113The documentation has been revised in places to produce more standard manpages.
114
115The long-existing feature of C</(?{...})/> regexps setting C<$_> and pos()
116is now documented.
1400179b 117
a1686c72 118The perl debugger now supports a C<save> command, to save the current
119history to a file, and an C<i> command, which prints the inheritance tree
120of its argument (if the C<Class::ISA> module is installed.)
121
1400179b 122=head1 Performance Enhancements
123
124=head1 Installation and Configuration Improvements
125
126=head1 Selected Bug Fixes
127
f0f92e3c 128=head2 UTF8 bugs
129
130Using substr() on a UTF8 string could cause subsequent accesses on that
131string to return garbage. This was due to incorrect UTF8 offsets being
132cached, and is now fixed.
133
134join() could return garbage when the same join() statement was used to
135process 8 bit data having earlier processed UTF8 data, due to the flags
136on that statement's temporary workspace not being reset correctly. This
137is now fixed.
138
139Using Unicode keys with tied hashes should now work correctly.
140
141chop() and chomp() used to mangle UTF8 strings. This has been fixed.
142
143=head2 Threading bugs
144
145Hashes with the C<:unique> attribute weren't made read-only in new
146threads. They are now.
147
148=head2 More bugs
149
150C<$a .. $b> will now work as expected when either $a or $b is C<undef>
151
152Reading $^E now preserves $!. Previously, the C code implementing $^E
153did not preserve C<errno>, so reading $^E could cause C<errno> and therefore
154C<$!> to change unexpectedly.
155
156Reentrant functions will (once more) work with C++. 5.8.2 introduced a bugfix
31a10c70 157which accidentally broke the compilation of Perl extensions written in C++.
158
159C<strict> wasn't in effect in regexp-eval blocks (C</(?{...})/>).
f0f92e3c 160
1400179b 161=head1 New or Changed Diagnostics
162
f0f92e3c 163The fatal error "DESTROY created new reference to dead object" is now
164documented in L<perldiag>.
165
166A new error, "%ENV is aliased to %s", is produced when taint checks are
167enabled and when *ENV has been aliased (and thus doesn't reflect the
168program's environment anymore.)
169
1400179b 170=head1 Changed Internals
171
9b11ae5e 172These news matter to you only if you either write XS code or like to
173know about or hack Perl internals (using Devel::Peek or any of the
174C<B::> modules counts), or like to run Perl with the C<-D> option.
175
176=head2 Reordering of SVt_* constants
177
178The relative ordering of constants that define the various types of C<SV>
fa46452e 179have changed; in particular, C<SVt_PVGV> has been moved before C<SVt_PVLV>,
9b11ae5e 180C<SVt_PVAV>, C<SVt_PVHV> and C<SVt_PVCV>. This is unlikely to make any
181difference unless you have code that explicitly makes assumptions about that
182ordering. (The inheritance hierarchy of C<B::*> objects has been changed
183to reflect this.)
184
a5dbb3ac 185=head2 Removal of CPP symbols
186
187The C preprocessor symbols C<PERL_PM_APIVERSION> and
188C<PERL_XS_APIVERSION>, which were supposed to give the version number of
189the oldest perl binary-compatible (resp. source-compatible) with the
190present one, were not used, and sometimes had misleading values. They have
191been removed.
192
265db0e6 193=head2 Less space is used by ops
194
195The C<BASEOP> structure now uses less space. The C<op_seq> field has been
196removed and replaced by two one-bit fields, C<op_opt> and C<op_static>.
197C<opt_type> is now 9 bits long. (Consequently, the C<B::OP> class doesn't
198provide an C<seq> method anymore.)
199
f0f92e3c 200=head1 Configuration and Building
201
202C<Configure> now invokes callbacks regardless of the value of the variable
203they are called for. Previously callbacks were only invoked in the
204C<case $variable $define)> branch. This change should only affect platform
205maintainers writing configuration hints files.
206
1400179b 207=head1 New Tests
208
209=head1 Known Problems
210
211=head1 Platform Specific Problems
212
213=head1 Reporting Bugs
214
215If you find what you think is a bug, you might check the articles
216recently posted to the comp.lang.perl.misc newsgroup and the perl
217bug database at http://bugs.perl.org/ . There may also be
218information at http://www.perl.com/ , the Perl Home Page.
219
220If you believe you have an unreported bug, please run the B<perlbug>
221program included with your release. Be sure to trim your bug down
222to a tiny but sufficient test case. Your bug report, along with the
223output of C<perl -V>, will be sent off to perlbug@perl.org to be
224analysed by the Perl porting team.
225
226=head1 SEE ALSO
227
228The F<Changes> file for exhaustive details on what changed.
229
230The F<INSTALL> file for how to build Perl.
231
232The F<README> file for general stuff.
233
234The F<Artistic> and F<Copying> files for copyright information.
235
236=cut