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