This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Implement "my $_".
[perl5.git] / pod / perl591delta.pod
CommitLineData
1400179b
NC
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
8the 5.9.1 release.
9
10=head1 Incompatible Changes
11
12=head1 Core Enhancements
13
59f00321
RGS
14=head2 Lexical C<$_>
15
16The default variable C<$_> can now be lexicalized, by declaring it like
17any other lexical variable, with a simple
18
19 my $_;
20
21The operations that default on C<$_> will use the lexically-scoped
22version of C<$_> when it exists, instead of the global C<$_>.
23
24In a C<map> or a C<grep> block, if C<$_> was previously my'ed, then the
25C<$_> inside the block is lexical as well (and scoped to the block).
26
27In a scope where C<$_> has been lexicalized, you can still have access to
28the global version of C<$_> by using C<$::_>, or, more simply, by
29overriding the lexical declaration with C<our $_>.
30
1400179b
NC
31=head2 Tied hashes in scalar context
32
33As of perl 5.8.2, tied hashes did not return anything useful in scalar
34context, for example when used as boolean tests:
35
36 if (%tied_hash) { ... }
37
38The old nonsensical behaviour was always to return false,
39regardless of whether the hash is empty or has elements.
40
41There is now an interface for the implementors of tied hashes to implement
42the behaviour of a hash in scalar context, via the SCALAR method (see
43L<perltie>). Without a SCALAR method, perl will try to guess whether
44the hash is empty, by testing if it's inside an iteration (in this case
45it can't be empty) or by calling FIRSTKEY.
46
f0f92e3c
RGS
47=head2 Formats
48
49Formats were improved in several ways. A new field, C<^*>, can be used for
50variable-width, one-line-at-a-time text. Null characters are now handled
51correctly in picture lines. Using C<@#> and C<~~> together will now
52produce a compile-time error, as those format fields are incompatible.
53L<perlform> has been improved, and miscellaneous bugs fixed.
54
55=head2 The C<:unique> attribute is only meaningful for globals
56
57Now applying C<:unique> to lexical variables and to subroutines will
58result in a compilation error.
59
1400179b
NC
60=head1 Modules and Pragmata
61
f0f92e3c
RGS
62=over 4
63
64=item Carp
65
66The error messages produced by C<Carp> now include spaces between the
67arguments in function argument lists: this makes long error messages
68appear more nicely in browsers and other tools.
69
70=item Exporter
71
72C<Exporter> will now recognize grouping tags (such as C<:name>) anywhere
73in the import list, not only at the beginning.
74
75=item FindBin
76
77A function C<again> is provided to resolve problems where modules in different
78directories wish to use FindBin.
79
80=item List::Util
81
82You can now weaken references to read only values.
83
84=item threads::shared
85
86C<cond_wait> has a new two argument form. C<cond_timedwait> has been added.
87
88=back
89
1400179b
NC
90=head1 Utility Changes
91
92C<find2perl> now assumes C<-print> as a default action. Previously, it
93needed to be specified explicitly.
94
f0f92e3c
RGS
95A new utility, C<prove>, makes it easy to run an individual regression test
96at the command line. C<prove> is part of Test::Harness, which users of earlier
97Perl versions can install from CPAN.
98
99=head1 Documentation
100
101The documentation has been revised in places to produce more standard manpages.
102
103The long-existing feature of C</(?{...})/> regexps setting C<$_> and pos()
104is now documented.
1400179b
NC
105
106=head1 Performance Enhancements
107
108=head1 Installation and Configuration Improvements
109
110=head1 Selected Bug Fixes
111
f0f92e3c
RGS
112=head2 UTF8 bugs
113
114Using substr() on a UTF8 string could cause subsequent accesses on that
115string to return garbage. This was due to incorrect UTF8 offsets being
116cached, and is now fixed.
117
118join() could return garbage when the same join() statement was used to
119process 8 bit data having earlier processed UTF8 data, due to the flags
120on that statement's temporary workspace not being reset correctly. This
121is now fixed.
122
123Using Unicode keys with tied hashes should now work correctly.
124
125chop() and chomp() used to mangle UTF8 strings. This has been fixed.
126
127=head2 Threading bugs
128
129Hashes with the C<:unique> attribute weren't made read-only in new
130threads. They are now.
131
132=head2 More bugs
133
134C<$a .. $b> will now work as expected when either $a or $b is C<undef>
135
136Reading $^E now preserves $!. Previously, the C code implementing $^E
137did not preserve C<errno>, so reading $^E could cause C<errno> and therefore
138C<$!> to change unexpectedly.
139
140Reentrant functions will (once more) work with C++. 5.8.2 introduced a bugfix
141which accidentally broke the compilation of Perl extensions written in C++
142
1400179b
NC
143=head1 New or Changed Diagnostics
144
f0f92e3c
RGS
145The fatal error "DESTROY created new reference to dead object" is now
146documented in L<perldiag>.
147
148A new error, "%ENV is aliased to %s", is produced when taint checks are
149enabled and when *ENV has been aliased (and thus doesn't reflect the
150program's environment anymore.)
151
1400179b
NC
152=head1 Changed Internals
153
f0f92e3c
RGS
154=head1 Configuration and Building
155
156C<Configure> now invokes callbacks regardless of the value of the variable
157they are called for. Previously callbacks were only invoked in the
158C<case $variable $define)> branch. This change should only affect platform
159maintainers writing configuration hints files.
160
1400179b
NC
161=head1 New Tests
162
163=head1 Known Problems
164
165=head1 Platform Specific Problems
166
167=head1 Reporting Bugs
168
169If you find what you think is a bug, you might check the articles
170recently posted to the comp.lang.perl.misc newsgroup and the perl
171bug database at http://bugs.perl.org/ . There may also be
172information at http://www.perl.com/ , the Perl Home Page.
173
174If you believe you have an unreported bug, please run the B<perlbug>
175program included with your release. Be sure to trim your bug down
176to a tiny but sufficient test case. Your bug report, along with the
177output of C<perl -V>, will be sent off to perlbug@perl.org to be
178analysed by the Perl porting team.
179
180=head1 SEE ALSO
181
182The F<Changes> file for exhaustive details on what changed.
183
184The F<INSTALL> file for how to build Perl.
185
186The F<README> file for general stuff.
187
188The F<Artistic> and F<Copying> files for copyright information.
189
190=cut