| 1 | =head1 NAME
|
|---|
| 2 |
|
|---|
| 3 | perl581delta - what is new for perl v5.8.1
|
|---|
| 4 |
|
|---|
| 5 | =head1 DESCRIPTION
|
|---|
| 6 |
|
|---|
| 7 | This document describes differences between the 5.8.0 release and
|
|---|
| 8 | the 5.8.1 release.
|
|---|
| 9 |
|
|---|
| 10 | If you are upgrading from an earlier release such as 5.6.1, first read
|
|---|
| 11 | the L<perl58delta>, which describes differences between 5.6.0 and
|
|---|
| 12 | 5.8.0.
|
|---|
| 13 |
|
|---|
| 14 | In case you are wondering about 5.6.1, it was bug-fix-wise rather
|
|---|
| 15 | identical to the development release 5.7.1. Confused? This timeline
|
|---|
| 16 | hopefully helps a bit: it lists the new major releases, their maintenance
|
|---|
| 17 | releases, and the development releases.
|
|---|
| 18 |
|
|---|
| 19 | New Maintenance Development
|
|---|
| 20 |
|
|---|
| 21 | 5.6.0 2000-Mar-22
|
|---|
| 22 | 5.7.0 2000-Sep-02
|
|---|
| 23 | 5.6.1 2001-Apr-08
|
|---|
| 24 | 5.7.1 2001-Apr-09
|
|---|
| 25 | 5.7.2 2001-Jul-13
|
|---|
| 26 | 5.7.3 2002-Mar-05
|
|---|
| 27 | 5.8.0 2002-Jul-18
|
|---|
| 28 | 5.8.1 2003-Sep-25
|
|---|
| 29 |
|
|---|
| 30 | =head1 Incompatible Changes
|
|---|
| 31 |
|
|---|
| 32 | =head2 Hash Randomisation
|
|---|
| 33 |
|
|---|
| 34 | Mainly due to security reasons, the "random ordering" of hashes
|
|---|
| 35 | has been made even more random. Previously while the order of hash
|
|---|
| 36 | elements from keys(), values(), and each() was essentially random,
|
|---|
| 37 | it was still repeatable. Now, however, the order varies between
|
|---|
| 38 | different runs of Perl.
|
|---|
| 39 |
|
|---|
| 40 | B<Perl has never guaranteed any ordering of the hash keys>, and the
|
|---|
| 41 | ordering has already changed several times during the lifetime of
|
|---|
| 42 | Perl 5. Also, the ordering of hash keys has always been, and
|
|---|
| 43 | continues to be, affected by the insertion order.
|
|---|
| 44 |
|
|---|
| 45 | The added randomness may affect applications.
|
|---|
| 46 |
|
|---|
| 47 | One possible scenario is when output of an application has included
|
|---|
| 48 | hash data. For example, if you have used the Data::Dumper module to
|
|---|
| 49 | dump data into different files, and then compared the files to see
|
|---|
| 50 | whether the data has changed, now you will have false positives since
|
|---|
| 51 | the order in which hashes are dumped will vary. In general the cure
|
|---|
| 52 | is to sort the keys (or the values); in particular for Data::Dumper to
|
|---|
| 53 | use the C<Sortkeys> option. If some particular order is really
|
|---|
| 54 | important, use tied hashes: for example the Tie::IxHash module
|
|---|
| 55 | which by default preserves the order in which the hash elements
|
|---|
| 56 | were added.
|
|---|
| 57 |
|
|---|
| 58 | More subtle problem is reliance on the order of "global destruction".
|
|---|
| 59 | That is what happens at the end of execution: Perl destroys all data
|
|---|
| 60 | structures, including user data. If your destructors (the DESTROY
|
|---|
| 61 | subroutines) have assumed any particular ordering to the global
|
|---|
| 62 | destruction, there might be problems ahead. For example, in a
|
|---|
| 63 | destructor of one object you cannot assume that objects of any other
|
|---|
| 64 | class are still available, unless you hold a reference to them.
|
|---|
| 65 | If the environment variable PERL_DESTRUCT_LEVEL is set to a non-zero
|
|---|
| 66 | value, or if Perl is exiting a spawned thread, it will also destruct
|
|---|
| 67 | the ordinary references and the symbol tables that are no longer in use.
|
|---|
| 68 | You can't call a class method or an ordinary function on a class that
|
|---|
| 69 | has been collected that way.
|
|---|
| 70 |
|
|---|
| 71 | The hash randomisation is certain to reveal hidden assumptions about
|
|---|
| 72 | some particular ordering of hash elements, and outright bugs: it
|
|---|
| 73 | revealed a few bugs in the Perl core and core modules.
|
|---|
| 74 |
|
|---|
| 75 | To disable the hash randomisation in runtime, set the environment
|
|---|
| 76 | variable PERL_HASH_SEED to 0 (zero) before running Perl (for more
|
|---|
| 77 | information see L<perlrun/PERL_HASH_SEED>), or to disable the feature
|
|---|
| 78 | completely in compile time, compile with C<-DNO_HASH_SEED> (see F<INSTALL>).
|
|---|
| 79 |
|
|---|
| 80 | See L<perlsec/"Algorithmic Complexity Attacks"> for the original
|
|---|
| 81 | rationale behind this change.
|
|---|
| 82 |
|
|---|
| 83 | =head2 UTF-8 On Filehandles No Longer Activated By Locale
|
|---|
| 84 |
|
|---|
| 85 | In Perl 5.8.0 all filehandles, including the standard filehandles,
|
|---|
| 86 | were implicitly set to be in Unicode UTF-8 if the locale settings
|
|---|
| 87 | indicated the use of UTF-8. This feature caused too many problems,
|
|---|
| 88 | so the feature was turned off and redesigned: see L</"Core Enhancements">.
|
|---|
| 89 |
|
|---|
| 90 | =head2 Single-number v-strings are no longer v-strings before "=>"
|
|---|
| 91 |
|
|---|
| 92 | The version strings or v-strings (see L<perldata/"Version Strings">)
|
|---|
| 93 | feature introduced in Perl 5.6.0 has been a source of some confusion--
|
|---|
| 94 | especially when the user did not want to use it, but Perl thought it
|
|---|
| 95 | knew better. Especially troublesome has been the feature that before
|
|---|
| 96 | a "=>" a version string (a "v" followed by digits) has been interpreted
|
|---|
| 97 | as a v-string instead of a string literal. In other words:
|
|---|
| 98 |
|
|---|
| 99 | %h = ( v65 => 42 );
|
|---|
| 100 |
|
|---|
| 101 | has meant since Perl 5.6.0
|
|---|
| 102 |
|
|---|
| 103 | %h = ( 'A' => 42 );
|
|---|
| 104 |
|
|---|
| 105 | (at least in platforms of ASCII progeny) Perl 5.8.1 restores the
|
|---|
| 106 | more natural interpretation
|
|---|
| 107 |
|
|---|
| 108 | %h = ( 'v65' => 42 );
|
|---|
| 109 |
|
|---|
| 110 | The multi-number v-strings like v65.66 and 65.66.67 still continue to
|
|---|
| 111 | be v-strings in Perl 5.8.
|
|---|
| 112 |
|
|---|
| 113 | =head2 (Win32) The -C Switch Has Been Repurposed
|
|---|
| 114 |
|
|---|
| 115 | The -C switch has changed in an incompatible way. The old semantics
|
|---|
| 116 | of this switch only made sense in Win32 and only in the "use utf8"
|
|---|
| 117 | universe in 5.6.x releases, and do not make sense for the Unicode
|
|---|
| 118 | implementation in 5.8.0. Since this switch could not have been used
|
|---|
| 119 | by anyone, it has been repurposed. The behavior that this switch
|
|---|
| 120 | enabled in 5.6.x releases may be supported in a transparent,
|
|---|
| 121 | data-dependent fashion in a future release.
|
|---|
| 122 |
|
|---|
| 123 | For the new life of this switch, see L<"UTF-8 no longer default under
|
|---|
| 124 | UTF-8 locales">, and L<perlrun/-C>.
|
|---|
| 125 |
|
|---|
| 126 | =head2 (Win32) The /d Switch Of cmd.exe
|
|---|
| 127 |
|
|---|
| 128 | Perl 5.8.1 uses the /d switch when running the cmd.exe shell
|
|---|
| 129 | internally for system(), backticks, and when opening pipes to external
|
|---|
| 130 | programs. The extra switch disables the execution of AutoRun commands
|
|---|
| 131 | from the registry, which is generally considered undesirable when
|
|---|
| 132 | running external programs. If you wish to retain compatibility with
|
|---|
| 133 | the older behavior, set PERL5SHELL in your environment to C<cmd /x/c>.
|
|---|
| 134 |
|
|---|
| 135 | =head1 Core Enhancements
|
|---|
| 136 |
|
|---|
| 137 | =head2 UTF-8 no longer default under UTF-8 locales
|
|---|
| 138 |
|
|---|
| 139 | In Perl 5.8.0 many Unicode features were introduced. One of them
|
|---|
| 140 | was found to be of more nuisance than benefit: the automagic
|
|---|
| 141 | (and silent) "UTF-8-ification" of filehandles, including the
|
|---|
| 142 | standard filehandles, if the user's locale settings indicated
|
|---|
| 143 | use of UTF-8.
|
|---|
| 144 |
|
|---|
| 145 | For example, if you had C<en_US.UTF-8> as your locale, your STDIN and
|
|---|
| 146 | STDOUT were automatically "UTF-8", in other words an implicit
|
|---|
| 147 | binmode(..., ":utf8") was made. This meant that trying to print, say,
|
|---|
| 148 | chr(0xff), ended up printing the bytes 0xc3 0xbf. Hardly what
|
|---|
| 149 | you had in mind unless you were aware of this feature of Perl 5.8.0.
|
|---|
| 150 | The problem is that the vast majority of people weren't: for example
|
|---|
| 151 | in RedHat releases 8 and 9 the B<default> locale setting is UTF-8, so
|
|---|
| 152 | all RedHat users got UTF-8 filehandles, whether they wanted it or not.
|
|---|
| 153 | The pain was intensified by the Unicode implementation of Perl 5.8.0
|
|---|
| 154 | (still) having nasty bugs, especially related to the use of s/// and
|
|---|
| 155 | tr///. (Bugs that have been fixed in 5.8.1)
|
|---|
| 156 |
|
|---|
| 157 | Therefore a decision was made to backtrack the feature and change it
|
|---|
| 158 | from implicit silent default to explicit conscious option. The new
|
|---|
| 159 | Perl command line option C<-C> and its counterpart environment
|
|---|
| 160 | variable PERL_UNICODE can now be used to control how Perl and Unicode
|
|---|
| 161 | interact at interfaces like I/O and for example the command line
|
|---|
| 162 | arguments. See L<perlrun/-C> and L<perlrun/PERL_UNICODE> for more
|
|---|
| 163 | information.
|
|---|
| 164 |
|
|---|
| 165 | =head2 Unsafe signals again available
|
|---|
| 166 |
|
|---|
| 167 | In Perl 5.8.0 the so-called "safe signals" were introduced. This
|
|---|
| 168 | means that Perl no longer handles signals immediately but instead
|
|---|
| 169 | "between opcodes", when it is safe to do so. The earlier immediate
|
|---|
| 170 | handling easily could corrupt the internal state of Perl, resulting
|
|---|
| 171 | in mysterious crashes.
|
|---|
| 172 |
|
|---|
| 173 | However, the new safer model has its problems too. Because now an
|
|---|
| 174 | opcode, a basic unit of Perl execution, is never interrupted but
|
|---|
| 175 | instead let to run to completion, certain operations that can take a
|
|---|
| 176 | long time now really do take a long time. For example, certain
|
|---|
| 177 | network operations have their own blocking and timeout mechanisms, and
|
|---|
| 178 | being able to interrupt them immediately would be nice.
|
|---|
| 179 |
|
|---|
| 180 | Therefore perl 5.8.1 introduces a "backdoor" to restore the pre-5.8.0
|
|---|
| 181 | (pre-5.7.3, really) signal behaviour. Just set the environment variable
|
|---|
| 182 | PERL_SIGNALS to C<unsafe>, and the old immediate (and unsafe)
|
|---|
| 183 | signal handling behaviour returns. See L<perlrun/PERL_SIGNALS>
|
|---|
| 184 | and L<perlipc/"Deferred Signals (Safe Signals)">.
|
|---|
| 185 |
|
|---|
| 186 | In completely unrelated news, you can now use safe signals with
|
|---|
| 187 | POSIX::SigAction. See L<POSIX/POSIX::SigAction>.
|
|---|
| 188 |
|
|---|
| 189 | =head2 Tied Arrays with Negative Array Indices
|
|---|
| 190 |
|
|---|
| 191 | Formerly, the indices passed to C<FETCH>, C<STORE>, C<EXISTS>, and
|
|---|
| 192 | C<DELETE> methods in tied array class were always non-negative. If
|
|---|
| 193 | the actual argument was negative, Perl would call FETCHSIZE implicitly
|
|---|
| 194 | and add the result to the index before passing the result to the tied
|
|---|
| 195 | array method. This behaviour is now optional. If the tied array class
|
|---|
| 196 | contains a package variable named C<$NEGATIVE_INDICES> which is set to
|
|---|
| 197 | a true value, negative values will be passed to C<FETCH>, C<STORE>,
|
|---|
| 198 | C<EXISTS>, and C<DELETE> unchanged.
|
|---|
| 199 |
|
|---|
| 200 | =head2 local ${$x}
|
|---|
| 201 |
|
|---|
| 202 | The syntaxes
|
|---|
| 203 |
|
|---|
| 204 | local ${$x}
|
|---|
| 205 | local @{$x}
|
|---|
| 206 | local %{$x}
|
|---|
| 207 |
|
|---|
| 208 | now do localise variables, given that the $x is a valid variable name.
|
|---|
| 209 |
|
|---|
| 210 | =head2 Unicode Character Database 4.0.0
|
|---|
| 211 |
|
|---|
| 212 | The copy of the Unicode Character Database included in Perl 5.8 has
|
|---|
| 213 | been updated to 4.0.0 from 3.2.0. This means for example that the
|
|---|
| 214 | Unicode character properties are as in Unicode 4.0.0.
|
|---|
| 215 |
|
|---|
| 216 | =head2 Deprecation Warnings
|
|---|
| 217 |
|
|---|
| 218 | There is one new feature deprecation. Perl 5.8.0 forgot to add
|
|---|
| 219 | some deprecation warnings, these warnings have now been added.
|
|---|
| 220 | Finally, a reminder of an impending feature removal.
|
|---|
| 221 |
|
|---|
| 222 | =head3 (Reminder) Pseudo-hashes are deprecated (really)
|
|---|
| 223 |
|
|---|
| 224 | Pseudo-hashes were deprecated in Perl 5.8.0 and will be removed in
|
|---|
| 225 | Perl 5.10.0, see L<perl58delta> for details. Each attempt to access
|
|---|
| 226 | pseudo-hashes will trigger the warning C<Pseudo-hashes are deprecated>.
|
|---|
| 227 | If you really want to continue using pseudo-hashes but not to see the
|
|---|
| 228 | deprecation warnings, use:
|
|---|
| 229 |
|
|---|
| 230 | no warnings 'deprecated';
|
|---|
| 231 |
|
|---|
| 232 | Or you can continue to use the L<fields> pragma, but please don't
|
|---|
| 233 | expect the data structures to be pseudohashes any more.
|
|---|
| 234 |
|
|---|
| 235 | =head3 (Reminder) 5.005-style threads are deprecated (really)
|
|---|
| 236 |
|
|---|
| 237 | 5.005-style threads (activated by C<use Thread;>) were deprecated in
|
|---|
| 238 | Perl 5.8.0 and will be removed after Perl 5.8, see L<perl58delta> for
|
|---|
| 239 | details. Each 5.005-style thread creation will trigger the warning
|
|---|
| 240 | C<5.005 threads are deprecated>. If you really want to continue
|
|---|
| 241 | using the 5.005 threads but not to see the deprecation warnings, use:
|
|---|
| 242 |
|
|---|
| 243 | no warnings 'deprecated';
|
|---|
| 244 |
|
|---|
| 245 | =head3 (Reminder) The $* variable is deprecated (really)
|
|---|
| 246 |
|
|---|
| 247 | The C<$*> variable controlling multi-line matching has been deprecated
|
|---|
| 248 | and will be removed after 5.8. The variable has been deprecated for a
|
|---|
| 249 | long time, and a deprecation warning C<Use of $* is deprecated> is given,
|
|---|
| 250 | now the variable will just finally be removed. The functionality has
|
|---|
| 251 | been supplanted by the C</s> and C</m> modifiers on pattern matching.
|
|---|
| 252 | If you really want to continue using the C<$*>-variable but not to see
|
|---|
| 253 | the deprecation warnings, use:
|
|---|
| 254 |
|
|---|
| 255 | no warnings 'deprecated';
|
|---|
| 256 |
|
|---|
| 257 | =head2 Miscellaneous Enhancements
|
|---|
| 258 |
|
|---|
| 259 | C<map> in void context is no longer expensive. C<map> is now context
|
|---|
| 260 | aware, and will not construct a list if called in void context.
|
|---|
| 261 |
|
|---|
| 262 | If a socket gets closed by the server while printing to it, the client
|
|---|
| 263 | now gets a SIGPIPE. While this new feature was not planned, it fell
|
|---|
| 264 | naturally out of PerlIO changes, and is to be considered an accidental
|
|---|
| 265 | feature.
|
|---|
| 266 |
|
|---|
| 267 | PerlIO::get_layers(FH) returns the names of the PerlIO layers
|
|---|
| 268 | active on a filehandle.
|
|---|
| 269 |
|
|---|
| 270 | PerlIO::via layers can now have an optional UTF8 method to
|
|---|
| 271 | indicate whether the layer wants to "auto-:utf8" the stream.
|
|---|
| 272 |
|
|---|
| 273 | utf8::is_utf8() has been added as a quick way to test whether
|
|---|
| 274 | a scalar is encoded internally in UTF-8 (Unicode).
|
|---|
| 275 |
|
|---|
| 276 | =head1 Modules and Pragmata
|
|---|
| 277 |
|
|---|
| 278 | =head2 Updated Modules And Pragmata
|
|---|
| 279 |
|
|---|
| 280 | The following modules and pragmata have been updated since Perl 5.8.0:
|
|---|
| 281 |
|
|---|
| 282 | =over 4
|
|---|
| 283 |
|
|---|
| 284 | =item base
|
|---|
| 285 |
|
|---|
| 286 | =item B::Bytecode
|
|---|
| 287 |
|
|---|
| 288 | In much better shape than it used to be. Still far from perfect, but
|
|---|
| 289 | maybe worth a try.
|
|---|
| 290 |
|
|---|
| 291 | =item B::Concise
|
|---|
| 292 |
|
|---|
| 293 | =item B::Deparse
|
|---|
| 294 |
|
|---|
| 295 | =item Benchmark
|
|---|
| 296 |
|
|---|
| 297 | An optional feature, C<:hireswallclock>, now allows for high
|
|---|
| 298 | resolution wall clock times (uses Time::HiRes).
|
|---|
| 299 |
|
|---|
| 300 | =item ByteLoader
|
|---|
| 301 |
|
|---|
| 302 | See B::Bytecode.
|
|---|
| 303 |
|
|---|
| 304 | =item bytes
|
|---|
| 305 |
|
|---|
| 306 | Now has bytes::substr.
|
|---|
| 307 |
|
|---|
| 308 | =item CGI
|
|---|
| 309 |
|
|---|
| 310 | =item charnames
|
|---|
| 311 |
|
|---|
| 312 | One can now have custom character name aliases.
|
|---|
| 313 |
|
|---|
| 314 | =item CPAN
|
|---|
| 315 |
|
|---|
| 316 | There is now a simple command line frontend to the CPAN.pm
|
|---|
| 317 | module called F<cpan>.
|
|---|
| 318 |
|
|---|
| 319 | =item Data::Dumper
|
|---|
| 320 |
|
|---|
| 321 | A new option, Pair, allows choosing the separator between hash keys
|
|---|
| 322 | and values.
|
|---|
| 323 |
|
|---|
| 324 | =item DB_File
|
|---|
| 325 |
|
|---|
| 326 | =item Devel::PPPort
|
|---|
| 327 |
|
|---|
| 328 | =item Digest::MD5
|
|---|
| 329 |
|
|---|
| 330 | =item Encode
|
|---|
| 331 |
|
|---|
| 332 | Significant updates on the encoding pragma functionality
|
|---|
| 333 | (tr/// and the DATA filehandle, formats).
|
|---|
| 334 |
|
|---|
| 335 | If a filehandle has been marked as to have an encoding, unmappable
|
|---|
| 336 | characters are detected already during input, not later (when the
|
|---|
| 337 | corrupted data is being used).
|
|---|
| 338 |
|
|---|
| 339 | The ISO 8859-6 conversion table has been corrected (the 0x30..0x39
|
|---|
| 340 | erroneously mapped to U+0660..U+0669, instead of U+0030..U+0039). The
|
|---|
| 341 | GSM 03.38 conversion did not handle escape sequences correctly. The
|
|---|
| 342 | UTF-7 encoding has been added (making Encode feature-complete with
|
|---|
| 343 | Unicode::String).
|
|---|
| 344 |
|
|---|
| 345 | =item fields
|
|---|
| 346 |
|
|---|
| 347 | =item libnet
|
|---|
| 348 |
|
|---|
| 349 | =item Math::BigInt
|
|---|
| 350 |
|
|---|
| 351 | A lot of bugs have been fixed since v1.60, the version included in Perl
|
|---|
| 352 | v5.8.0. Especially noteworthy are the bug in Calc that caused div and mod to
|
|---|
| 353 | fail for some large values, and the fixes to the handling of bad inputs.
|
|---|
| 354 |
|
|---|
| 355 | Some new features were added, e.g. the broot() method, you can now pass
|
|---|
| 356 | parameters to config() to change some settings at runtime, and it is now
|
|---|
| 357 | possible to trap the creation of NaN and infinity.
|
|---|
| 358 |
|
|---|
| 359 | As usual, some optimizations took place and made the math overall a tad
|
|---|
| 360 | faster. In some cases, quite a lot faster, actually. Especially alternative
|
|---|
| 361 | libraries like Math::BigInt::GMP benefit from this. In addition, a lot of the
|
|---|
| 362 | quite clunky routines like fsqrt() and flog() are now much much faster.
|
|---|
| 363 |
|
|---|
| 364 | =item MIME::Base64
|
|---|
| 365 |
|
|---|
| 366 | =item NEXT
|
|---|
| 367 |
|
|---|
| 368 | Diamond inheritance now works.
|
|---|
| 369 |
|
|---|
| 370 | =item Net::Ping
|
|---|
| 371 |
|
|---|
| 372 | =item PerlIO::scalar
|
|---|
| 373 |
|
|---|
| 374 | Reading from non-string scalars (like the special variables, see
|
|---|
| 375 | L<perlvar>) now works.
|
|---|
| 376 |
|
|---|
| 377 | =item podlators
|
|---|
| 378 |
|
|---|
| 379 | =item Pod::LaTeX
|
|---|
| 380 |
|
|---|
| 381 | =item PodParsers
|
|---|
| 382 |
|
|---|
| 383 | =item Pod::Perldoc
|
|---|
| 384 |
|
|---|
| 385 | Complete rewrite. As a side-effect, no longer refuses to startup when
|
|---|
| 386 | run by root.
|
|---|
| 387 |
|
|---|
| 388 | =item Scalar::Util
|
|---|
| 389 |
|
|---|
| 390 | New utilities: refaddr, isvstring, looks_like_number, set_prototype.
|
|---|
| 391 |
|
|---|
| 392 | =item Storable
|
|---|
| 393 |
|
|---|
| 394 | Can now store code references (via B::Deparse, so not foolproof).
|
|---|
| 395 |
|
|---|
| 396 | =item strict
|
|---|
| 397 |
|
|---|
| 398 | Earlier versions of the strict pragma did not check the parameters
|
|---|
| 399 | implicitly passed to its "import" (use) and "unimport" (no) routine.
|
|---|
| 400 | This caused the false idiom such as:
|
|---|
| 401 |
|
|---|
| 402 | use strict qw(@ISA);
|
|---|
| 403 | @ISA = qw(Foo);
|
|---|
|
|---|