| 1 | =head1 NAME |
| 2 | |
| 3 | perldelta - what is new for perl v5.9.0 |
| 4 | |
| 5 | =head1 DESCRIPTION |
| 6 | |
| 7 | This document describes differences between the 5.8.0 release and |
| 8 | the 5.9.0 release. |
| 9 | |
| 10 | =head1 Incompatible Changes |
| 11 | |
| 12 | =head2 Hash Randomisation |
| 13 | |
| 14 | Mainly due to security reasons, the "random ordering" of hashes |
| 15 | has been made even more random. Previously while the order of hash |
| 16 | elements from keys(), values(), and each() was essentially random, |
| 17 | it was still repeatable. Now, however, the order varies between |
| 18 | different runs of Perl. |
| 19 | |
| 20 | B<Perl has never guaranteed any ordering of the hash keys>, and the |
| 21 | ordering has already changed several times during the lifetime of |
| 22 | Perl 5. Also, the ordering of hash keys has always been, and |
| 23 | continues to be, affected by the insertion order. |
| 24 | |
| 25 | The added randomness may affect applications. |
| 26 | |
| 27 | One possible scenario is when output of an application has included |
| 28 | hash data. For example, if you have used the Data::Dumper module to |
| 29 | dump data into different files, and then compared the files to see |
| 30 | whether the data has changed, now you will have false positives since |
| 31 | the order in which hashes are dumped will vary. In general the cure |
| 32 | is to sort the keys (or the values); in particular for Data::Dumper to |
| 33 | use the C<Sortkeys> option. If some particular order is really |
| 34 | important, use tied hashes: for example the Tie::IxHash module |
| 35 | which by default preserves the order in which the hash elements |
| 36 | were added. |
| 37 | |
| 38 | More subtle problem is reliance on the order of "global destruction". |
| 39 | That is what happens at the end of execution: Perl destroys all data |
| 40 | structures, including user data. If your destructors (the DESTROY |
| 41 | subroutines) have assumed any particular ordering to the global |
| 42 | destruction, there might be problems ahead. For example, in a |
| 43 | destructor of one object you cannot assume that objects of any other |
| 44 | class are still available, unless you hold a reference to them. |
| 45 | If the environment variable PERL_DESTRUCT_LEVEL is set to a non-zero |
| 46 | value, or if Perl is exiting a spawned thread, it will also destruct |
| 47 | the ordinary references and the symbol tables that are no longer in use. |
| 48 | You can't call a class method or an ordinary function on a class that |
| 49 | has been collected that way. |
| 50 | |
| 51 | The hash randomisation is certain to reveal hidden assumptions about |
| 52 | some particular ordering of hash elements, and outright bugs: it |
| 53 | revealed a few bugs in the Perl core and core modules. |
| 54 | |
| 55 | To disable the hash randomisation in runtime, set the environment |
| 56 | variable PERL_HASH_SEED to 0 (zero) before running Perl (for more |
| 57 | information see L<perlrun/PERL_HASH_SEED>), or to disable the feature |
| 58 | completely in compile time, compile with C<-DNO_HASH_SEED> (see F<INSTALL>). |
| 59 | |
| 60 | See L<perlsec/"Algorithmic Complexity Attacks"> for the original |
| 61 | rationale behind this change. |
| 62 | |
| 63 | =head2 UTF-8 On Filehandles No Longer Activated By Locale |
| 64 | |
| 65 | In Perl 5.8.0 all filehandles, including the standard filehandles, |
| 66 | were implicitly set to be in Unicode UTF-8 if the locale settings |
| 67 | indicated the use of UTF-8. This feature caused too many problems, |
| 68 | so the feature was turned off and redesigned: see L</"Core Enhancements">. |
| 69 | |
| 70 | =head2 Single-number v-strings are no longer v-strings before "=>" |
| 71 | |
| 72 | The version strings or v-strings (see L<perldata/"Version Strings">) |
| 73 | feature introduced in Perl 5.6.0 has been a source of some confusion-- |
| 74 | especially when the user did not want to use it, but Perl thought it |
| 75 | knew better. Especially troublesome has been the feature that before |
| 76 | a "=>" a version string (a "v" followed by digits) has been interpreted |
| 77 | as a v-string instead of a string literal. In other words: |
| 78 | |
| 79 | %h = ( v65 => 42 ); |
| 80 | |
| 81 | has meant since Perl 5.6.0 |
| 82 | |
| 83 | %h = ( 'A' => 42 ); |
| 84 | |
| 85 | (at least in platforms of ASCII progeny) Perl 5.8.1 restored the |
| 86 | more natural interpretation |
| 87 | |
| 88 | %h = ( 'v65' => 42 ); |
| 89 | |
| 90 | The multi-number v-strings like v65.66 and 65.66.67 still continue to |
| 91 | be v-strings in Perl 5.8. |
| 92 | |
| 93 | =head2 (Win32) The -C Switch Has Been Repurposed |
| 94 | |
| 95 | The -C switch has changed in an incompatible way. The old semantics |
| 96 | of this switch only made sense in Win32 and only in the "use utf8" |
| 97 | universe in 5.6.x releases, and do not make sense for the Unicode |
| 98 | implementation in 5.8.0. Since this switch could not have been used |
| 99 | by anyone, it has been repurposed. The behavior that this switch |
| 100 | enabled in 5.6.x releases may be supported in a transparent, |
| 101 | data-dependent fashion in a future release. |
| 102 | |
| 103 | For the new life of this switch, see L<"UTF-8 no longer default under |
| 104 | UTF-8 locales">, and L<perlrun/-C>. |
| 105 | |
| 106 | =head2 (Win32) The /d Switch Of cmd.exe |
| 107 | |
| 108 | Since version 5.8.1, perl uses the /d switch when running the cmd.exe shell |
| 109 | internally for system(), backticks, and when opening pipes to external |
| 110 | programs. The extra switch disables the execution of AutoRun commands |
| 111 | from the registry, which is generally considered undesirable when |
| 112 | running external programs. If you wish to retain compatibility with |
| 113 | the older behavior, set PERL5SHELL in your environment to C<cmd /x/c>. |
| 114 | |
| 115 | =head2 The C<$*> variable has been removed |
| 116 | |
| 117 | C<$*>, which was deprecated in favor of the C</s> and C</m> regexp |
| 118 | modifiers, has been removed. |
| 119 | |
| 120 | =head1 Core Enhancements |
| 121 | |
| 122 | =head2 Assertions |
| 123 | |
| 124 | Perl 5.9.0 has experimental support for assertions. Note that the user |
| 125 | interface is not fully stabilized yet, and it may change until the 5.10.0 |
| 126 | release. A new command-line switch, B<-A>, is used to activate |
| 127 | assertions, which are declared with the C<assertions> pragma. See |
| 128 | L<assertions>. |
| 129 | |
| 130 | =head2 Defined-or operators |
| 131 | |
| 132 | A new operator C<//> (defined-or) has been implemented. |
| 133 | The following statement: |
| 134 | |
| 135 | $a // $b |
| 136 | |
| 137 | is merely equivalent to |
| 138 | |
| 139 | defined $a ? $a : $b |
| 140 | |
| 141 | and |
| 142 | |
| 143 | $c //= $d; |
| 144 | |
| 145 | can be used instead of |
| 146 | |
| 147 | $c = $d unless defined $c; |
| 148 | |
| 149 | This operator has the same precedence and associativity as C<||>. |
| 150 | It has a low-precedence counterpart, C<err>, which has the same precedence |
| 151 | and associativity as C<or>. Special care has been taken to ensure that |
| 152 | those operators Do What You Mean while not breaking old code, but some |
| 153 | edge cases involving the empty regular expression may now parse |
| 154 | differently. See L<perlop> for details. |
| 155 | |
| 156 | =head2 UTF-8 no longer default under UTF-8 locales |
| 157 | |
| 158 | In Perl 5.8.0 many Unicode features were introduced. One of them |
| 159 | was found to be of more nuisance than benefit: the automagic |
| 160 | (and silent) "UTF-8-ification" of filehandles, including the |
| 161 | standard filehandles, if the user's locale settings indicated |
| 162 | use of UTF-8. |
| 163 | |
| 164 | For example, if you had C<en_US.UTF-8> as your locale, your STDIN and |
| 165 | STDOUT were automatically "UTF-8", in other words an implicit |
| 166 | binmode(..., ":utf8") was made. This meant that trying to print, say, |
| 167 | chr(0xff), ended up printing the bytes 0xc3 0xbf. Hardly what |
| 168 | you had in mind unless you were aware of this feature of Perl 5.8.0. |
| 169 | The problem is that the vast majority of people weren't: for example |
| 170 | in RedHat releases 8 and 9 the B<default> locale setting is UTF-8, so |
| 171 | all RedHat users got UTF-8 filehandles, whether they wanted it or not. |
| 172 | The pain was intensified by the Unicode implementation of Perl 5.8.0 |
| 173 | (still) having nasty bugs, especially related to the use of s/// and |
| 174 | tr///. (Bugs that have been fixed in 5.8.1) |
| 175 | |
| 176 | Therefore a decision was made to backtrack the feature and change it |
| 177 | from implicit silent default to explicit conscious option. The new |
| 178 | Perl command line option C<-C> and its counterpart environment |
| 179 | variable PERL_UNICODE can now be used to control how Perl and Unicode |
| 180 | interact at interfaces like I/O and for example the command line |
| 181 | arguments. See L<perlrun/-C> and L<perlrun/PERL_UNICODE> for more |
| 182 | information. |
| 183 | |
| 184 | =head2 Unsafe signals again available |
| 185 | |
| 186 | In Perl 5.8.0 the so-called "safe signals" were introduced. This |
| 187 | means that Perl no longer handles signals immediately but instead |
| 188 | "between opcodes", when it is safe to do so. The earlier immediate |
| 189 | handling easily could corrupt the internal state of Perl, resulting |
| 190 | in mysterious crashes. |
| 191 | |
| 192 | However, the new safer model has its problems too. Because now an |
| 193 | opcode, a basic unit of Perl execution, is never interrupted but |
| 194 | instead let to run to completion, certain operations that can take a |
| 195 | long time now really do take a long time. For example, certain |
| 196 | network operations have their own blocking and timeout mechanisms, and |
| 197 | being able to interrupt them immediately would be nice. |
| 198 | |
| 199 | Therefore perl 5.8.1 introduced a "backdoor" to restore the pre-5.8.0 |
| 200 | (pre-5.7.3, really) signal behaviour. Just set the environment variable |
| 201 | PERL_SIGNALS to C<unsafe>, and the old immediate (and unsafe) |
| 202 | signal handling behaviour returns. See L<perlrun/PERL_SIGNALS> |
| 203 | and L<perlipc/"Deferred Signals (Safe Signals)">. |
| 204 | |
| 205 | In completely unrelated news, you can now use safe signals with |
| 206 | POSIX::SigAction. See L<POSIX/POSIX::SigAction>. |
| 207 | |
| 208 | =head2 Tied Arrays with Negative Array Indices |
| 209 | |
| 210 | Formerly, the indices passed to C<FETCH>, C<STORE>, C<EXISTS>, and |
| 211 | C<DELETE> methods in tied array class were always non-negative. If |
| 212 | the actual argument was negative, Perl would call FETCHSIZE implicitly |
| 213 | and add the result to the index before passing the result to the tied |
| 214 | array method. This behaviour is now optional. If the tied array class |
| 215 | contains a package variable named C<$NEGATIVE_INDICES> which is set to |
| 216 | a true value, negative values will be passed to C<FETCH>, C<STORE>, |
| 217 | C<EXISTS>, and C<DELETE> unchanged. |
| 218 | |
| 219 | =head2 local ${$x} |
| 220 | |
| 221 | The syntaxes |
| 222 | |
| 223 | local ${$x} |
| 224 | local @{$x} |
| 225 | local %{$x} |
| 226 | |
| 227 | now do localise variables, given that the $x is a valid variable name. |
| 228 | |
| 229 | =head2 Unicode Character Database 4.0.0 |
| 230 | |
| 231 | The copy of the Unicode Character Database included in Perl 5.8 has |
| 232 | been updated to 4.0.0 from 3.2.0. This means for example that the |
| 233 | Unicode character properties are as in Unicode 4.0.0. |
| 234 | |
| 235 | =head2 Miscellaneous Enhancements |
| 236 | |
| 237 | C<unpack()> now defaults to unpacking the C<$_>. |
| 238 | |
| 239 | C<map> in void context is no longer expensive. C<map> is now context |
| 240 | aware, and will not construct a list if called in void context. |
| 241 | |
| 242 | If a socket gets closed by the server while printing to it, the client |
| 243 | now gets a SIGPIPE. While this new feature was not planned, it fell |
| 244 | naturally out of PerlIO changes, and is to be considered an accidental |
| 245 | feature. |
| 246 | |
| 247 | PerlIO::get_layers(FH) returns the names of the PerlIO layers |
| 248 | active on a filehandle. |
| 249 | |
| 250 | PerlIO::via layers can now have an optional UTF8 method to |
| 251 | indicate whether the layer wants to "auto-:utf8" the stream. |
| 252 | |
| 253 | utf8::is_utf8() has been added as a quick way to test whether |
| 254 | a scalar is encoded internally in UTF-8 (Unicode). |
| 255 | |
| 256 | =head1 Modules and Pragmata |
| 257 | |
| 258 | =head2 Updated Modules And Pragmata |
| 259 | |
| 260 | The following modules and pragmata have been updated since Perl 5.8.0: |
| 261 | |
| 262 | =over 4 |
| 263 | |
| 264 | =item base |
| 265 | |
| 266 | =item B::Bytecode |
| 267 | |
| 268 | In much better shape than it used to be. Still far from perfect, but |
| 269 | maybe worth a try. |
| 270 | |
| 271 | =item B::Concise |
| 272 | |
| 273 | =item B::Deparse |
| 274 | |
| 275 | =item Benchmark |
| 276 | |
| 277 | An optional feature, C<:hireswallclock>, now allows for high |
| 278 | resolution wall clock times (uses Time::HiRes). |
| 279 | |
| 280 | =item ByteLoader |
| 281 | |
| 282 | See B::Bytecode. |
| 283 | |
| 284 | =item bytes |
| 285 | |
| 286 | Now has bytes::substr. |
| 287 | |
| 288 | =item CGI |
| 289 | |
| 290 | =item charnames |
| 291 | |
| 292 | One can now have custom character name aliases. |
| 293 | |
| 294 | =item CPAN |
| 295 | |
| 296 | There is now a simple command line frontend to the CPAN.pm |
| 297 | module called F<cpan>. |
| 298 | |
| 299 | =item Data::Dumper |
| 300 | |
| 301 | A new option, Pair, allows choosing the separator between hash keys |
| 302 | and values. |
| 303 | |
| 304 | =item DB_File |
| 305 | |
| 306 | =item Devel::PPPort |
| 307 | |
| 308 | =item Digest::MD5 |
| 309 | |
| 310 | =item Encode |
| 311 | |
| 312 | Significant updates on the encoding pragma functionality |
| 313 | (tr/// and the DATA filehandle, formats). |
| 314 | |
| 315 | If a filehandle has been marked as to have an encoding, unmappable |
| 316 | characters are detected already during input, not later (when the |
| 317 | corrupted data is being used). |
| 318 | |
| 319 | The ISO 8859-6 conversion table has been corrected (the 0x30..0x39 |
| 320 | erroneously mapped to U+0660..U+0669, instead of U+0030..U+0039). The |
| 321 | GSM 03.38 conversion did not handle escape sequences correctly. The |
| 322 | UTF-7 encoding has been added (making Encode feature-complete with |
| 323 | Unicode::String). |
| 324 | |
| 325 | =item fields |
| 326 | |
| 327 | =item libnet |
| 328 | |
| 329 | =item Math::BigInt |
| 330 | |
| 331 | A lot of bugs have been fixed since v1.60, the version included in Perl |
| 332 | v5.8.0. Especially noteworthy are the bug in Calc that caused div and mod to |
| 333 | fail for some large values, and the fixes to the handling of bad inputs. |
| 334 | |
| 335 | Some new features were added, e.g. the broot() method, you can now pass |
| 336 | parameters to config() to change some settings at runtime, and it is now |
| 337 | possible to trap the creation of NaN and infinity. |
| 338 | |
| 339 | As usual, some optimizations took place and made the math overall a tad |
| 340 | faster. In some cases, quite a lot faster, actually. Especially alternative |
| 341 | libraries like Math::BigInt::GMP benefit from this. In addition, a lot of the |
| 342 | quite clunky routines like fsqrt() and flog() are now much much faster. |
| 343 | |
| 344 | =item MIME::Base64 |
| 345 | |
| 346 | =item NEXT |
| 347 | |
| 348 | Diamond inheritance now works. |
| 349 | |
| 350 | =item Net::Ping |
| 351 | |
| 352 | =item PerlIO::scalar |
| 353 | |
| 354 | Reading from non-string scalars (like the special variables, see |
| 355 | L<perlvar>) now works. |
| 356 | |
| 357 | =item podlators |
| 358 | |
| 359 | =item Pod::LaTeX |
| 360 | |
| 361 | =item PodParsers |
| 362 | |
| 363 | =item Pod::Perldoc |
| 364 | |
| 365 | Complete rewrite. As a side-effect, no longer refuses to startup when |
| 366 | run by root. |
| 367 | |
| 368 | =item Scalar::Util |
| 369 | |
| 370 | New utilities: refaddr, isvstring, looks_like_number, set_prototype. |
| 371 | |
| 372 | =item Storable |
| 373 | |
| 374 | Can now store code references (via B::Deparse, so not foolproof). |
| 375 | |
| 376 | =item strict |
| 377 | |
| 378 | Earlier versions of the strict pragma did not check the parameters |
| 379 | implicitly passed to its "import" (use) and "unimport" (no) routine. |
| 380 | This caused the false idiom such as: |
| 381 | |
| 382 | use strict qw(@ISA); |
| 383 | @ISA = qw(Foo); |
| 384 | |
| 385 | This however (probably) raised the false expectation that the strict |
| 386 | refs, vars and subs were being enforced (and that @ISA was somehow |
| 387 | "declared"). But the strict refs, vars, and subs are B<not> enforced |
| 388 | when using this false idiom. |
| 389 | |
| 390 | Starting from Perl 5.8.1, the above B<will> cause an error to be |
| 391 | raised. This may cause programs which used to execute seemingly |
| 392 | correctly without warnings and errors to fail when run under 5.8.1. |
| 393 | This happens because |
| 394 | |
| 395 | use strict qw(@ISA); |
| 396 | |
| 397 | will now fail with the error: |
| 398 | |
| 399 | Unknown 'strict' tag(s) '@ISA' |
| 400 | |
| 401 | The remedy to this problem is to replace this code with the correct idiom: |
| 402 | |
| 403 | use strict; |
| 404 | use vars qw(@ISA); |
| 405 | @ISA = qw(Foo); |
| 406 | |
| 407 | =item Term::ANSIcolor |
| 408 | |
| 409 | =item Test::Harness |
| 410 | |
| 411 | Now much more picky about extra or missing output from test scripts. |
| 412 | |
| 413 | =item Test::More |
| 414 | |
| 415 | =item Test::Simple |
| 416 | |
| 417 | =item Text::Balanced |
| 418 | |
| 419 | =item Time::HiRes |
| 420 | |
| 421 | Use of nanosleep(), if available, allows mixing subsecond sleeps with |
| 422 | alarms. |
| 423 | |
| 424 | =item threads |
| 425 | |
| 426 | Several fixes, for example for join() problems and memory |
| 427 | leaks. In some platforms (like Linux) that use glibc the minimum memory |
| 428 | footprint of one ithread has been reduced by several hundred kilobytes. |
| 429 | |
| 430 | =item threads::shared |
| 431 | |
| 432 | Many memory leaks have been fixed. |
| 433 | |
| 434 | =item Unicode::Collate |
| 435 | |
| 436 | =item Unicode::Normalize |
| 437 | |
| 438 | =item Win32::GetFolderPath |
| 439 | |
| 440 | =item Win32::GetOSVersion |
| 441 | |
| 442 | Now returns extra information. |
| 443 | |
| 444 | =back |
| 445 | |
| 446 | =head1 Utility Changes |
| 447 | |
| 448 | The C<h2xs> utility now produces a more modern layout: |
| 449 | F<Foo-Bar/lib/Foo/Bar.pm> instead of F<Foo/Bar/Bar.pm>. |
| 450 | Also, the boilerplate test is now called F<t/Foo-Bar.t> |
| 451 | instead of F<t/1.t>. |
| 452 | |
| 453 | The Perl debugger (F<lib/perl5db.pl>) has now been extensively |
| 454 | documented and bugs found while documenting have been fixed. |
| 455 | |
| 456 | C<perldoc> has been rewritten from scratch to be more robust and |
| 457 | featureful. |
| 458 | |
| 459 | C<perlcc -B> works now at least somewhat better, while C<perlcc -c> |
| 460 | is rather more broken. (The Perl compiler suite as a whole continues |
| 461 | to be experimental.) |
| 462 | |
| 463 | =head1 New Documentation |
| 464 | |
| 465 | perl573delta has been added to list the differences between the |
| 466 | (now quite obsolete) development releases 5.7.2 and 5.7.3. |
| 467 | |
| 468 | perl58delta and perl581delta have been added: these are the perldeltas |
| 469 | of 5.8.0 and 5.8.1, detailing the differences respectively between |
| 470 | 5.6.0 and 5.8.0, and between 5.8.0 and 5.8.1. |
| 471 | |
| 472 | perlartistic has been added: it is the Artistic License in pod format, |
| 473 | making it easier for modules to refer to it. |
| 474 | |
| 475 | perlcheat has been added: it is a Perl cheat sheet. |
| 476 | |
| 477 | perlgpl has been added: it is the GNU General Public License in pod |
| 478 | format, making it easier for modules to refer to it. |
| 479 | |
| 480 | perlmacosx has been added to tell about the installation and use |
| 481 | of Perl in Mac OS X. |
| 482 | |
| 483 | perlos400 has been added to tell about the installation and use |
| 484 | of Perl in OS/400 PASE. |
| 485 | |
| 486 | perlreref has been added: it is a regular expressions quick reference. |
| 487 | |
| 488 | =head1 Performance Enhancements |
| 489 | |
| 490 | =head1 Installation and Configuration Improvements |
| 491 | |
| 492 | The UNIX standard Perl location, F</usr/bin/perl>, is no longer |
| 493 | overwritten by default if it exists. This change was very prudent |
| 494 | because so many UNIX vendors already provide a F</usr/bin/perl>, |
| 495 | but simultaneously many system utilities may depend on that |
| 496 | exact version of Perl, so better not to overwrite it. |
| 497 | |
| 498 | One can now specify installation directories for site and vendor man |
| 499 | and HTML pages, and site and vendor scripts. See F<INSTALL>. |
| 500 | |
| 501 | One can now specify a destination directory for Perl installation |
| 502 | by specifying the DESTDIR variable for C<make install>. (This feature |
| 503 | is slightly different from the previous C<Configure -Dinstallprefix=...>.) |
| 504 | See F<INSTALL>. |
| 505 | |
| 506 | gcc versions 3.x introduced a new warning that caused a lot of noise |
| 507 | during Perl compilation: C<gcc -Ialreadyknowndirectory (warning: |
| 508 | changing search order)>. This warning has now been avoided by |
| 509 | Configure weeding out such directories before the compilation. |
| 510 | |
| 511 | One can now build subsets of Perl core modules by using the |
| 512 | Configure flags C<-Dnoextensions=...> and C<-Donlyextensions=...>, |
| 513 | see F<INSTALL>. |
| 514 | |
| 515 | =head2 Platform-specific enhancements |
| 516 | |
| 517 | In Cygwin Perl can now be built with threads (C<Configure -Duseithreads>). |
| 518 | This works with both Cygwin 1.3.22 and Cygwin 1.5.3. |
| 519 | |
| 520 | In newer FreeBSD releases Perl 5.8.0 compilation failed because of |
| 521 | trying to use F<malloc.h>, which in FreeBSD is just a dummy file, and |
| 522 | a fatal error to even try to use. Now F<malloc.h> is not used. |
| 523 | |
| 524 | Perl is now known to build also in Hitachi HI-UXMPP. |
| 525 | |
| 526 | Perl is now known to build again in LynxOS. |
| 527 | |
| 528 | Mac OS X now installs with Perl version number embedded in |
| 529 | installation directory names for easier upgrading of user-compiled |
| 530 | Perl, and the installation directories in general are more standard. |
| 531 | In other words, the default installation no longer breaks the |
| 532 | Apple-provided Perl. On the other hand, with C<Configure -Dprefix=/usr> |
| 533 | you can now really replace the Apple-supplied Perl (B<please be careful>). |
| 534 | |
| 535 | Mac OS X now builds Perl statically by default. This change was done |
| 536 | mainly for faster startup times. The Apple-provided Perl is still |
| 537 | dynamically linked and shared, and you can enable the sharedness for |
| 538 | your own Perl builds by C<Configure -Duseshrplib>. |
| 539 | |
| 540 | Perl has been ported to IBM's OS/400 PASE environment. The best way |
| 541 | to build a Perl for PASE is to use an AIX host as a cross-compilation |
| 542 | environment. See README.os400. |
| 543 | |
| 544 | Yet another cross-compilation option has been added: now Perl builds |
| 545 | on OpenZaurus, an Linux distribution based on Mandrake + Embedix for |
| 546 | the Sharp Zaurus PDA. See the Cross/README file. |
| 547 | |
| 548 | Tru64 when using gcc 3 drops the optimisation for F<toke.c> to C<-O2> |
| 549 | because of gigantic memory use with the default C<-O3>. |
| 550 | |
| 551 | Tru64 can now build Perl with the newer Berkeley DBs. |
| 552 | |
| 553 | Building Perl on WinCE has been much enhanced, see F<README.ce> |
| 554 | and F<README.perlce>. |
| 555 | |
| 556 | =head1 Selected Bug Fixes |
| 557 | |
| 558 | =head2 Closures, eval and lexicals |
| 559 | |
| 560 | There have been many fixes in the area of anonymous subs, lexicals and |
| 561 | closures. Although this means that Perl is now more "correct", it is |
| 562 | possible that some existing code will break that happens to rely on |
| 563 | the faulty behaviour. In practice this is unlikely unless your code |
| 564 | contains a very complex nesting of anonymous subs, evals and lexicals. |
| 565 | |
| 566 | =head2 Generic fixes |
| 567 | |
| 568 | If an input filehandle is marked C<:utf8> and Perl sees illegal UTF-8 |
| 569 | coming in when doing C<< <FH> >>, if warnings are enabled a warning is |
| 570 | immediately given - instead of being silent about it and Perl being |
| 571 | unhappy about the broken data later. (The C<:encoding(utf8)> layer |
| 572 | also works the same way.) |
| 573 | |
| 574 | binmode(SOCKET, ":utf8") only worked on the input side, not on the |
| 575 | output side of the socket. Now it works both ways. |
| 576 | |
| 577 | For threaded Perls certain system database functions like getpwent() |
| 578 | and getgrent() now grow their result buffer dynamically, instead of |
| 579 | failing. This means that at sites with lots of users and groups the |
| 580 | functions no longer fail by returning only partial results. |
| 581 | |
| 582 | Perl 5.8.0 had accidentally broken the capability for users |
| 583 | to define their own uppercase<->lowercase Unicode mappings |
| 584 | (as advertised by the Camel). This feature has been fixed and |
| 585 | is also documented better. |
| 586 | |
| 587 | In 5.8.0 this |
| 588 | |
| 589 | $some_unicode .= <FH>; |
| 590 | |
| 591 | didn't work correctly but instead corrupted the data. This has now |
| 592 | been fixed. |
| 593 | |
| 594 | Tied methods like FETCH etc. may now safely access tied values, i.e. |
| 595 | resulting in a recursive call to FETCH etc. Remember to break the |
| 596 | recursion, though. |
| 597 | |
| 598 | At startup Perl blocks the SIGFPE signal away since there isn't much |
| 599 | Perl can do about it. Previously this blocking was in effect also for |
| 600 | programs executed from within Perl. Now Perl restores the original |
| 601 | SIGFPE handling routine, whatever it was, before running external |
| 602 | programs. |
| 603 | |
| 604 | Linenumbers in Perl scripts may now be greater than 65536, or 2**16. |
| 605 | (Perl scripts have always been able to be larger than that, it's just |
| 606 | that the linenumber for reported errors and warnings have "wrapped |
| 607 | around".) While scripts that large usually indicate a need to rethink |
| 608 | your code a bit, such Perl scripts do exist, for example as results |
| 609 | from generated code. Now linenumbers can go all the way to |
| 610 | 4294967296, or 2**32. |
| 611 | |
| 612 | =head2 Platform-specific fixes |
| 613 | |
| 614 | Linux |
| 615 | |
| 616 | =over 4 |
| 617 | |
| 618 | =item * |
| 619 | |
| 620 | Setting $0 works again (with certain limitations that |
| 621 | Perl cannot do much about: see L<perlvar/$0>) |
| 622 | |
| 623 | =back |
| 624 | |
| 625 | HP-UX |
| 626 | |
| 627 | =over 4 |
| 628 | |
| 629 | =item * |
| 630 | |
| 631 | Setting $0 now works. |
| 632 | |
| 633 | =back |
| 634 | |
| 635 | VMS |
| 636 | |
| 637 | =over 4 |
| 638 | |
| 639 | =item * |
| 640 | |
| 641 | Configuration now tests for the presence of C<poll()>, and IO::Poll |
| 642 | now uses the vendor-supplied function if detected. |
| 643 | |
| 644 | =item * |
| 645 | |
| 646 | A rare access violation at Perl start-up could occur if the Perl image was |
| 647 | installed with privileges or if there was an identifier with the |
| 648 | subsystem attribute set in the process's rightslist. Either of these |
| 649 | circumstances triggered tainting code that contained a pointer bug. |
| 650 | The faulty pointer arithmetic has been fixed. |
| 651 | |
| 652 | =item * |
| 653 | |
| 654 | The length limit on values (not keys) in the %ENV hash has been raised |
| 655 | from 255 bytes to 32640 bytes (except when the PERL_ENV_TABLES setting |
| 656 | overrides the default use of logical names for %ENV). If it is |
| 657 | necessary to access these long values from outside Perl, be aware that |
| 658 | they are implemented using search list logical names that store the |
| 659 | value in pieces, each 255-byte piece (up to 128 of them) being an |
| 660 | element in the search list. When doing a lookup in %ENV from within |
| 661 | Perl, the elements are combined into a single value. The existing |
| 662 | VMS-specific ability to access individual elements of a search list |
| 663 | logical name via the $ENV{'foo;N'} syntax (where N is the search list |
| 664 | index) is unimpaired. |
| 665 | |
| 666 | =item * |
| 667 | |
| 668 | The piping implementation now uses local rather than global DCL |
| 669 | symbols for inter-process communication. |
| 670 | |
| 671 | =item * |
| 672 | |
| 673 | File::Find could become confused when navigating to a relative |
| 674 | directory whose name collided with a logical name. This problem has |
| 675 | been corrected by adding directory syntax to relative path names, thus |
| 676 | preventing logical name translation. |
| 677 | |
| 678 | =back |
| 679 | |
| 680 | Win32 |
| 681 | |
| 682 | =over 4 |
| 683 | |
| 684 | =item * |
| 685 | |
| 686 | A memory leak in the fork() emulation has been fixed. |
| 687 | |
| 688 | =item * |
| 689 | |
| 690 | The return value of the ioctl() built-in function was accidentally |
| 691 | broken in 5.8.0. This has been corrected. |
| 692 | |
| 693 | =item * |
| 694 | |
| 695 | The internal message loop executed by perl during blocking operations |
| 696 | sometimes interfered with messages that were external to Perl. |
| 697 | This often resulted in blocking operations terminating prematurely or |
| 698 | returning incorrect results, when Perl was executing under environments |
| 699 | that could generate Windows messages. This has been corrected. |
| 700 | |
| 701 | =item * |
| 702 | |
| 703 | Pipes and sockets are now automatically in binary mode. |
| 704 | |
| 705 | =item * |
| 706 | |
| 707 | The four-argument form of select() did not preserve $! (errno) properly |
| 708 | when there were errors in the underlying call. This is now fixed. |
| 709 | |
| 710 | =item * |
| 711 | |
| 712 | The "CR CR LF" problem of has been fixed, binmode(FH, ":crlf") |
| 713 | is now effectively a no-op. |
| 714 | |
| 715 | =back |
| 716 | |
| 717 | =head1 New or Changed Diagnostics |
| 718 | |
| 719 | All the warnings related to pack() and unpack() were made more |
| 720 | informative and consistent. |
| 721 | |
| 722 | =head2 Changed "A thread exited while %d threads were running" |
| 723 | |
| 724 | The old version |
| 725 | |
| 726 | A thread exited while %d other threads were still running |
| 727 | |
| 728 | was misleading because the "other" included also the thread giving |
| 729 | the warning. |
| 730 | |
| 731 | =head2 Removed "Attempt to clear a restricted hash" |
| 732 | |
| 733 | It is not illegal to clear a restricted hash, so the warning |
| 734 | was removed. |
| 735 | |
| 736 | =head2 New "Illegal declaration of anonymous subroutine" |
| 737 | |
| 738 | You must specify the block of code for C<sub>. |
| 739 | |
| 740 | =head2 Changed "Invalid range "%s" in transliteration operator" |
| 741 | |
| 742 | The old version |
| 743 | |
| 744 | Invalid [] range "%s" in transliteration operator |
| 745 | |
| 746 | was simply wrong because there are no "[] ranges" in tr///. |
| 747 | |
| 748 | =head2 New "Missing control char name in \c" |
| 749 | |
| 750 | Self-explanatory. |
| 751 | |
| 752 | =head2 New "Newline in left-justified string for %s" |
| 753 | |
| 754 | The padding spaces would appear after the newline, which is |
| 755 | probably not what you had in mind. |
| 756 | |
| 757 | =head2 New "Possible precedence problem on bitwise %c operator" |
| 758 | |
| 759 | If you think this |
| 760 | |
| 761 | $x & $y == 0 |
| 762 | |
| 763 | tests whether the bitwise AND of $x and $y is zero, |
| 764 | you will like this warning. |
| 765 | |
| 766 | =head2 New "read() on %s filehandle %s" |
| 767 | |
| 768 | You cannot read() (or sysread()) from a closed or unopened filehandle. |
| 769 | |
| 770 | =head2 New "Tied variable freed while still in use" |
| 771 | |
| 772 | Something pulled the plug on a live tied variable, Perl plays |
| 773 | safe by bailing out. |
| 774 | |
| 775 | =head2 New "To%s: illegal mapping '%s'" |
| 776 | |
| 777 | An illegal user-defined Unicode casemapping was specified. |
| 778 | |
| 779 | =head2 New "Use of freed value in iteration" |
| 780 | |
| 781 | Something modified the values being iterated over. This is not good. |
| 782 | |
| 783 | =head1 Changed Internals |
| 784 | |
| 785 | These news matter to you only if you either write XS code or like to |
| 786 | know about or hack Perl internals (using Devel::Peek or any of the |
| 787 | C<B::> modules counts), or like to run Perl with the C<-D> option. |
| 788 | |
| 789 | The embedding examples of L<perlembed> have been reviewed to be |
| 790 | uptodate and consistent: for example, the correct use of |
| 791 | PERL_SYS_INIT3() and PERL_SYS_TERM(). |
| 792 | |
| 793 | Extensive reworking of the pad code (the code responsible |
| 794 | for lexical variables) has been conducted by Dave Mitchell. |
| 795 | |
| 796 | Extensive work on the v-strings by John Peacock. |
| 797 | |
| 798 | UTF-8 length and position cache: to speed up the handling of Unicode |
| 799 | (UTF-8) scalars, a cache was introduced. Potential problems exist if |
| 800 | an extension bypasses the official APIs and directly modifies the PV |
| 801 | of an SV: the UTF-8 cache does not get cleared as it should. |
| 802 | |
| 803 | APIs obsoleted in Perl 5.8.0, like sv_2pv, sv_catpvn, sv_catsv, |
| 804 | sv_setsv, are again available. |
| 805 | |
| 806 | Certain Perl core C APIs like cxinc and regatom are no longer |
| 807 | available at all to code outside the Perl core of the Perl core |
| 808 | extensions. This is intentional. They never should have been |
| 809 | available with the shorter names, and if you application depends on |
| 810 | them, you should (be ashamed and) contact perl5-porters to discuss |
| 811 | what are the proper APIs. |
| 812 | |
| 813 | Certain Perl core C APIs like C<Perl_list> are no longer available |
| 814 | without their C<Perl_> prefix. If your XS module stops working |
| 815 | because some functions cannot be found, in many cases a simple fix is |
| 816 | to add the C<Perl_> prefix to the function and the thread context |
| 817 | C<aTHX_> as the first argument of the function call. This is also how |
| 818 | it should always have been done: letting the Perl_-less forms to leak |
| 819 | from the core was an accident. For cleaner embedding you can also |
| 820 | force this for all APIs by defining at compile time the cpp define |
| 821 | PERL_NO_SHORT_NAMES. |
| 822 | |
| 823 | Perl_save_bool() has been added. |
| 824 | |
| 825 | Regexp objects (those created with C<qr>) now have S-magic rather than |
| 826 | R-magic. This fixed regexps of the form /...(??{...;$x})/ to no |
| 827 | longer ignore changes made to $x. The S-magic avoids dropping |
| 828 | the caching optimization and making (??{...}) constructs obscenely |
| 829 | slow (and consequently useless). See also L<perlguts/"Magic Variables">. |
| 830 | Regexp::Copy was affected by this change. |
| 831 | |
| 832 | The Perl internal debugging macros DEBUG() and DEB() have been renamed |
| 833 | to PERL_DEBUG() and PERL_DEB() to avoid namespace conflicts. |
| 834 | |
| 835 | C<-DL> removed (the leaktest had been broken and unsupported for years, |
| 836 | use alternative debugging mallocs or tools like valgrind and Purify). |
| 837 | |
| 838 | Verbose modifier C<v> added for C<-DXv> and C<-Dsv>, see L<perlrun>. |
| 839 | |
| 840 | =head1 New Tests |
| 841 | |
| 842 | In Perl 5.8.0 there were about 69000 separate tests in about 700 test files, |
| 843 | in Perl 5.9.0 there are about 77000 separate tests in about 780 test files. |
| 844 | The exact numbers depend on the Perl configuration and on the operating |
| 845 | system platform. |
| 846 | |
| 847 | =head1 Known Problems |
| 848 | |
| 849 | The hash randomisation mentioned in L</Incompatible Changes> is definitely |
| 850 | problematic: it will wake dormant bugs and shake out bad assumptions. |
| 851 | |
| 852 | Many of the rarer platforms that worked 100% or pretty close to it |
| 853 | with perl 5.8.0 have been left a little bit untended since their |
| 854 | maintainers have been otherwise busy lately, and therefore there will |
| 855 | be more failures on those platforms. Such platforms include Mac OS |
| 856 | Classic, IBM z/OS (and other EBCDIC platforms), and NetWare. The most |
| 857 | common Perl platforms (Unix and Unix-like, Microsoft platforms, and |
| 858 | VMS) have large enough testing and expert population that they are |
| 859 | doing well. |
| 860 | |
| 861 | =head2 Tied hashes in scalar context |
| 862 | |
| 863 | Tied hashes do not currently return anything useful in scalar context, |
| 864 | for example when used as boolean tests: |
| 865 | |
| 866 | if (%tied_hash) { ... } |
| 867 | |
| 868 | The current nonsensical behaviour is always to return false, |
| 869 | regardless of whether the hash is empty or has elements. |
| 870 | |
| 871 | The root cause is that there is no interface for the implementors of |
| 872 | tied hashes to implement the behaviour of a hash in scalar context. |
| 873 | |
| 874 | =head2 Net::Ping 450_service and 510_ping_udp failures |
| 875 | |
| 876 | The subtests 9 and 18 of lib/Net/Ping/t/450_service.t, and the |
| 877 | subtest 2 of lib/Net/Ping/t/510_ping_udp.t might fail if you have |
| 878 | an unusual networking setup. For example in the latter case the |
| 879 | test is trying to send a UDP ping to the IP address 127.0.0.1. |
| 880 | |
| 881 | =head2 B::C |
| 882 | |
| 883 | The C-generating compiler backend B::C (the frontend being |
| 884 | C<perlcc -c>) is even more broken than it used to be because of |
| 885 | the extensive lexical variable changes. (The good news is that |
| 886 | B::Bytecode and ByteLoader are better than they used to be.) |
| 887 | |
| 888 | =head1 Platform Specific Problems |
| 889 | |
| 890 | =head2 EBCDIC Platforms |
| 891 | |
| 892 | IBM z/OS and other EBCDIC platforms continue to be problematic |
| 893 | regarding Unicode support. Many Unicode tests are skipped when |
| 894 | they really should be fixed. |
| 895 | |
| 896 | =head2 Cygwin 1.5 problems |
| 897 | |
| 898 | In Cygwin 1.5 the F<io/tell> and F<op/sysio> tests have failures for |
| 899 | some yet unknown reason. In 1.5.5 the threads tests stress_cv, |
| 900 | stress_re, and stress_string are failing unless the environment |
| 901 | variable PERLIO is set to "perlio" (which makes also the io/tell |
| 902 | failure go away). |
| 903 | |
| 904 | Perl 5.8.1 does build and work well with Cygwin 1.3: with (uname -a) |
| 905 | C<CYGWIN_NT-5.0 ... 1.3.22(0.78/3/2) 2003-03-18 09:20 i686 ...> |
| 906 | a 100% "make test" was achieved with C<Configure -des -Duseithreads>. |
| 907 | |
| 908 | =head2 HP-UX: HP cc warnings about sendfile and sendpath |
| 909 | |
| 910 | With certain HP C compiler releases (e.g. B.11.11.02) you will |
| 911 | get many warnings like this (lines wrapped for easier reading): |
| 912 | |
| 913 | cc: "/usr/include/sys/socket.h", line 504: warning 562: |
| 914 | Redeclaration of "sendfile" with a different storage class specifier: |
| 915 | "sendfile" will have internal linkage. |
| 916 | cc: "/usr/include/sys/socket.h", line 505: warning 562: |
| 917 | Redeclaration of "sendpath" with a different storage class specifier: |
| 918 | "sendpath" will have internal linkage. |
| 919 | |
| 920 | The warnings show up both during the build of Perl and during certain |
| 921 | lib/ExtUtils tests that invoke the C compiler. The warning, however, |
| 922 | is not serious and can be ignored. |
| 923 | |
| 924 | =head2 IRIX: t/uni/tr_7jis.t falsely failing |
| 925 | |
| 926 | The test t/uni/tr_7jis.t is known to report failure under 'make test' |
| 927 | or the test harness with certain releases of IRIX (at least IRIX 6.5 |
| 928 | and MIPSpro Compilers Version 7.3.1.1m), but if run manually the test |
| 929 | fully passes. |
| 930 | |
| 931 | =head2 Mac OS X: no usemymalloc |
| 932 | |
| 933 | The Perl malloc (C<-Dusemymalloc>) does not work at all in Mac OS X. |
| 934 | This is not that serious, though, since the native malloc works just |
| 935 | fine. |
| 936 | |
| 937 | =head2 Tru64: No threaded builds with GNU cc (gcc) |
| 938 | |
| 939 | In the latest Tru64 releases (e.g. v5.1B or later) gcc cannot be used |
| 940 | to compile a threaded Perl (-Duseithreads) because the system |
| 941 | C<< <pthread.h> >> file doesn't know about gcc. |
| 942 | |
| 943 | =head2 Win32: sysopen, sysread, syswrite |
| 944 | |
| 945 | As of the 5.8.0 release, sysopen()/sysread()/syswrite() do not behave |
| 946 | like they used to in 5.6.1 and earlier with respect to "text" mode. |
| 947 | These built-ins now always operate in "binary" mode (even if sysopen() |
| 948 | was passed the O_TEXT flag, or if binmode() was used on the file |
| 949 | handle). Note that this issue should only make a difference for disk |
| 950 | files, as sockets and pipes have always been in "binary" mode in the |
| 951 | Windows port. As this behavior is currently considered a bug, |
| 952 | compatible behavior may be re-introduced in a future release. Until |
| 953 | then, the use of sysopen(), sysread() and syswrite() is not supported |
| 954 | for "text" mode operations. |
| 955 | |
| 956 | =head1 TODO |
| 957 | |
| 958 | Here are some things that are planned for perl 5.10.0 : |
| 959 | |
| 960 | =over 4 |
| 961 | |
| 962 | =item * |
| 963 | |
| 964 | Various Copy-On-Write techniques will be investigated in hopes |
| 965 | of speeding up Perl. |
| 966 | |
| 967 | =item * |
| 968 | |
| 969 | CPANPLUS, Inline, and Module::Build will become core modules. |
| 970 | |
| 971 | =item * |
| 972 | |
| 973 | The ability to write true lexically scoped pragmas will be introduced, |
| 974 | perhaps via a C<pragma> pragma. |
| 975 | |
| 976 | =item * |
| 977 | |
| 978 | Work will continue on the bytecompiler and byteloader. |
| 979 | |
| 980 | =item * |
| 981 | |
| 982 | v-strings as they currently exist are scheduled to be deprecated. The |
| 983 | v-less form (1.2.3) will become a "version object" when used with C<use>, |
| 984 | C<require>, and C<$VERSION>. $^V will also be a "version object" so the |
| 985 | printf("%vd",...) construct will no longer be needed. The v-ful version |
| 986 | (v1.2.3) will become obsolete. The equivalence of strings and v-strings (e.g. |
| 987 | that currently 5.8.0 is equal to "\5\8\0") will go away. B<There may be no |
| 988 | deprecation warning for v-strings>, though: it is quite hard to detect when |
| 989 | v-strings are being used safely, and when they are not. |
| 990 | |
| 991 | =back |
| 992 | |
| 993 | =head1 Reporting Bugs |
| 994 | |
| 995 | If you find what you think is a bug, you might check the articles |
| 996 | recently posted to the comp.lang.perl.misc newsgroup and the perl |
| 997 | bug database at F<http://bugs.perl.org/>. There may also be |
| 998 | information at F<http://www.perl.com/>, the Perl Home Page. |
| 999 | |
| 1000 | If you believe you have an unreported bug, please run the B<perlbug> |
| 1001 | program included with your release. Be sure to trim your bug down |
| 1002 | to a tiny but sufficient test case. Your bug report, along with the |
| 1003 | output of C<perl -V>, will be sent off to perlbug@perl.org to be |
| 1004 | analysed by the Perl porting team. You can browse and search |
| 1005 | the Perl 5 bugs at F<http://bugs.perl.org/>. |
| 1006 | |
| 1007 | =head1 SEE ALSO |
| 1008 | |
| 1009 | The F<Changes> file for exhaustive details on what changed. |
| 1010 | |
| 1011 | The F<INSTALL> file for how to build Perl. |
| 1012 | |
| 1013 | The F<README> file for general stuff. |
| 1014 | |
| 1015 | The F<Artistic> and F<Copying> files for copyright information. |
| 1016 | |
| 1017 | =cut |