Commit | Line | Data |
---|---|---|
01784f0d AD |
1 | =head1 NAME |
2 | ||
3 | perldelta - what's new for perl5.005 | |
4 | ||
5 | =head1 DESCRIPTION | |
6 | ||
7 | This document describes differences between the 5.004 release and this one. | |
8 | ||
429b3afa GS |
9 | [XXX this needs more verbose summaries of the sub topics, instead of just |
10 | the "See L<foo>." Scheduled for a second iteration. GSAR] | |
11 | ||
12 | =head1 About the new versioning system | |
13 | ||
01784f0d AD |
14 | =head1 Incompatible Changes |
15 | ||
429b3afa GS |
16 | =head2 WARNING: This version is not binary compatible with Perl 5.004. |
17 | ||
18 | Starting with Perl 5.004_50 there were many deep and far-reaching changes | |
19 | to the language internals. If you have dynamically loaded extensions | |
20 | that you built under perl 5.003 or 5.004, you can continue to use them | |
21 | with 5.004, but you will need to rebuild and reinstall those extensions | |
22 | to use them 5.005. See L<INSTALL> for detailed instructions on how to | |
23 | upgrade. | |
24 | ||
25 | =head2 Installation structure has changed | |
26 | ||
27 | Extensions that have with architecture-dependent files are now always | |
28 | installed in the architecture-dependent locations. Previously, they | |
29 | were shared will multiple versions of perl, an were therefore liable to | |
30 | be overwritten with newer versions that may have subtle incompatibilities. | |
31 | ||
32 | =head2 Perl Source Compatibility | |
33 | ||
34 | When none of the experimental features are enabled, there should be | |
35 | no user-visible Perl source compatibility issue. | |
36 | ||
37 | If threads are enabled, then some caveats apply. C<@_> and C<$_> become | |
38 | lexical variables. The effect of this should be largely transparent to | |
39 | the user, but there are some boundary conditions under which user will | |
40 | need to be aware of the issues. [XXX Add e.g. here.] | |
41 | ||
42 | =head2 C Source Compatibility | |
43 | ||
44 | =item Core sources now require ANSI C compiler | |
45 | ||
46 | =item Enabling threads has source compatibility issues | |
47 | ||
48 | =head2 Binary Compatibility | |
49 | ||
50 | This version is NOT binary compatible with older versions. All extensions | |
51 | will need to be recompiled. | |
52 | ||
53 | =head2 Security fixes may affect compatibility | |
54 | ||
55 | A few taint leaks and taint omissions have been corrected. This may lead | |
56 | to "failure" of scripts that used to work with older versions. Compiling | |
57 | with -DINCOMPLETE_TAINTS provides a perl with minimal amounts of changes | |
58 | to the tainting behavior. But note that the resulting perl will have | |
59 | known insecurities. | |
60 | ||
61 | Oneliners with the C<-e> switch do not create temporary files anymore. | |
62 | ||
63 | =head2 Relaxed new mandatory warnings introduced in 5.004 | |
64 | ||
65 | Many new warnings that were introduced in 5.004 have either been made | |
66 | optional. Some of these warnings are still present, but perl's new | |
67 | features make them less often a problem. See L<New Diagnostics>. | |
68 | ||
69 | =head2 Licensing | |
70 | ||
71 | Perl has a new Social Contract for contributors. | |
72 | ||
73 | Perl's documentation license has changed. | |
74 | ||
01784f0d AD |
75 | =head1 Core Changes |
76 | ||
01784f0d | 77 | |
429b3afa GS |
78 | =head2 Threads |
79 | ||
80 | WARNING: Threading is considered an experimental feature. Details of the | |
81 | implementation may change without notice. There are known limitations | |
82 | and bugs. | |
83 | ||
84 | See L<README.threads>. | |
85 | ||
86 | =head2 Compiler | |
87 | ||
88 | WARNING: The Compiler and related tools are considered experimental. | |
89 | Features may change without notice, and there are known limitations | |
90 | and bugs. | |
91 | ||
92 | B::Lint is an experimental module to detect and warn about suspicious | |
93 | code, especially the cases that the -w switch does not detect. | |
94 | ||
95 | B::Deparse can be used to demystify perl code. | |
96 | ||
97 | See C<ext/B/README>. | |
98 | ||
99 | =head2 Regular Expressions | |
100 | ||
101 | See L<perlre> and L<perlop>. | |
102 | ||
103 | =head2 Improved malloc() | |
104 | ||
105 | See banner at the beginning of C<malloc.c> for details. | |
106 | ||
107 | =head2 Quicksort is internally implemented | |
108 | ||
109 | See C<perlfunc/sort>. | |
110 | ||
111 | =head2 Reliable signals | |
112 | ||
113 | Via Thread::Signal. | |
114 | ||
115 | Via switched runtime op loop. | |
116 | ||
117 | =head2 Reliable stack pointers | |
118 | ||
119 | The internals now reallocate the perl stack only at predicatable times. | |
120 | In particular, magic calls never trigger reallocations of the stack, | |
121 | because all reentrancy of the runtime is handled using a "stack of stacks". | |
122 | This should improve reliability of cached stack pointers in XSUBs. | |
123 | ||
124 | =head2 Behavior of local() on composites is well-defined | |
125 | ||
126 | See L<perlfunc/local>. | |
127 | ||
128 | =head2 C<%!> is transparently tied to the L<Errno> module | |
129 | ||
130 | See L<perlvar>. | |
131 | ||
132 | =head2 Pseudo-hashes are supported | |
133 | ||
134 | See L<perlref>. | |
135 | ||
136 | =head2 C<EXPR foreach EXPR> is supported | |
137 | ||
138 | See L<perlsyn>. | |
139 | ||
140 | =head2 Slice notation on glob elements is supported | |
141 | ||
142 | [XXX See what?] | |
143 | ||
144 | =head2 Keywords can be globally overridden | |
145 | ||
146 | See L<perlsub>. | |
147 | ||
148 | =head2 C<$^E> is meaningful on Win32 | |
149 | ||
150 | See L<perlvar>. | |
151 | ||
152 | =head2 C<foreach (1..1000000)> optimized | |
153 | ||
154 | C<foreach (1..1000000)> is now optimized into a counting loop. It does | |
155 | not try to allocate a 1000000-size list anymore. | |
156 | ||
157 | =head2 C<Foo::> can be used as implicitly quoted package name | |
158 | ||
159 | [XXX See what?] | |
160 | ||
161 | =head2 C<exists $Foo::{Bar::}> tests existence of a package | |
162 | ||
163 | [XXX See what?] | |
164 | ||
165 | =head2 Better locale support | |
166 | ||
167 | See L<perllocale>. | |
168 | ||
169 | =head2 Better support for 64-bit platforms | |
170 | ||
171 | [XXX How?] | |
172 | ||
173 | =head2 prototype() returns useful results on builtins | |
174 | ||
175 | See L<perlfunc/prototype>. | |
176 | ||
177 | =head2 Re-blessing in DESTROY() supported for chaining DESTROY() methods | |
178 | ||
179 | See L<perlobj/Destructors>. | |
180 | ||
181 | =head2 All C<printf> format conversions are handled internally | |
182 | ||
183 | See L<perlfunc/printf>. | |
184 | ||
185 | =head2 New C<INIT> keyword | |
186 | ||
187 | C<INIT> subs are like C<BEGIN> and C<END>, but they get called just before | |
188 | the perl runtime begins execution. | |
189 | ||
190 | [XXX Needs to be documented in perlsub or perlmod.] | |
191 | ||
192 | =head2 New C<lock> keyword | |
193 | ||
194 | To minimize impact on source compatibility this keyword is "weak", i.e., any | |
195 | user-defined subroutine of the same name overrides it, unless a C<use Thread> | |
196 | has been seen. | |
197 | ||
198 | =head2 Tied arrays are now fully supported | |
199 | ||
200 | See L<Tie::Array>. | |
201 | ||
202 | =head2 Tied handles support is better | |
203 | ||
204 | Several missing hooks have been added. There is also a new base class for | |
205 | TIEARRAY implementations. See L<Tie::Array>. | |
206 | ||
207 | ||
208 | =head1 Supported Platforms | |
209 | ||
210 | Configure has many incremental improvements. Site-wide policy for building | |
211 | perl can now be made perlsistent, via Policy.sh. Configure can also remember | |
212 | the arguments used in previous invocations. | |
213 | ||
214 | =head2 New Platforms | |
215 | ||
216 | BeOS is now supported. See L<README.beos>. | |
217 | ||
218 | DOS is now supported under the DJGPP tools. See L<README.dos>. | |
219 | ||
220 | =head2 Changes in existing support | |
221 | ||
222 | Win32 support has been vastly enhanced. Support for Perl Object, a C++ | |
223 | encapsulation of Perl. GCC and EGCS are now supported on Win32. | |
224 | [XXX Perl Object needs a big explanation elsewhere, and a pointer to | |
225 | that location here.] | |
226 | ||
227 | VMS configuration system has been rewritten. See L<README.vms>. | |
228 | ||
229 | OpenBSD better supported. [XXX what others?] | |
230 | ||
231 | =head1 Modules and Pragmata | |
232 | ||
233 | =head2 New Modules | |
234 | ||
235 | =over | |
236 | ||
237 | =item B | |
238 | ||
239 | Perl compiler and tools. See [XXX what?]. | |
240 | ||
241 | =item Data::Dumper | |
242 | ||
243 | A module to pretty print Perl data. See L<Data::Dumper>. | |
244 | ||
245 | =item Errno | |
246 | ||
247 | A module to look up errors more conveniently. See L<Errno>. | |
248 | ||
249 | =item File::Spec | |
250 | ||
251 | A portable API for file operations. | |
252 | ||
253 | =item ExtUtils::Installed | |
254 | ||
255 | Query and manage installed modules. | |
256 | ||
257 | =item ExtUtils::Packlist | |
258 | ||
259 | Manipulate .packlist files. | |
260 | ||
261 | =item Fatal | |
262 | ||
263 | Make functions/builtins succeed or die. | |
264 | ||
265 | =item IPC::SysV | |
266 | ||
267 | Constants and other support infrastructure for System V IPC operations | |
268 | in perl. | |
269 | ||
270 | =item Test | |
271 | ||
272 | A framework for writing testsuites. | |
01784f0d | 273 | |
429b3afa GS |
274 | =item Tie::Array |
275 | ||
276 | Base class for tied arrays. | |
277 | ||
278 | =item Tie::Handle | |
279 | ||
280 | Base class for tied handles. | |
281 | ||
282 | =item Thread | |
283 | ||
284 | Perl thread creation, manipulation, and support. | |
285 | ||
286 | =item attrs | |
287 | ||
288 | Set subroutine attributes. | |
289 | ||
290 | =item fields | |
291 | ||
292 | Compile-time class fields. | |
293 | ||
294 | =item re | |
295 | ||
296 | Various pragmata to control behavior of regular expressions. | |
297 | ||
298 | =back | |
299 | ||
300 | =head2 Changes in existing modules | |
301 | ||
302 | =over | |
303 | ||
304 | =item CGI | |
305 | ||
306 | CGI has been updated to version 2.42. | |
307 | ||
308 | =item POSIX | |
309 | ||
310 | POSIX now has its own platform-specific hints files. | |
311 | ||
312 | =item DB_File | |
313 | ||
314 | DB_File supports version 2.x of Berkeley DB. See C<ext/DB_File/Changes>. | |
315 | ||
316 | =item MakeMaker | |
317 | ||
318 | MakeMaker now supports writing empty makefiles, provides a way to | |
319 | specify that site umask() policy should be honored. There is also | |
320 | better support for manipulation of .packlist files, and getting | |
321 | information about installed modules. | |
322 | ||
323 | =item CPAN | |
324 | ||
325 | [XXX What?] | |
326 | ||
327 | =item Cwd | |
328 | ||
329 | Cwd::cwd is faster on most platforms. | |
330 | ||
331 | =item Benchmark | |
332 | ||
333 | Keeps better time. | |
334 | ||
335 | =back | |
01784f0d AD |
336 | |
337 | =head1 Utility Changes | |
338 | ||
429b3afa GS |
339 | The crude GNU configure emulator is now called configure.gnu. |
340 | ||
341 | h2ph and related utilities have been vastly overhauled. | |
342 | ||
343 | perlcc, a new experimental front end for the compiler is available. | |
344 | ||
345 | =head1 API Changes | |
346 | ||
347 | =head2 Incompatible Changes | |
348 | ||
349 | =head2 Deprecations, Extensions | |
350 | ||
351 | =head2 C++ Support | |
01784f0d AD |
352 | |
353 | =head1 Documentation Changes | |
354 | ||
429b3afa GS |
355 | Config.pm now has a glossary of variables. |
356 | ||
357 | Porting/patching.pod has detailed instructions on how to create and | |
358 | submit patches for perl. | |
359 | ||
360 | =head1 New Diagnostics | |
361 | ||
362 | =over | |
363 | ||
364 | =item Ambiguous call resolved as CORE::%s(), qualify as such or use & | |
365 | ||
366 | (W) A subroutine you have declared has the same name as a Perl keyword, | |
367 | and you have used the name without qualification for calling one or the | |
368 | other. Perl decided to call the builtin because the subroutine is | |
369 | not imported. | |
370 | ||
371 | To force interpretation as a subroutine call, either put an ampersand | |
372 | before the subroutine name, or qualify the name with its package. | |
373 | Alternatively, you can import the subroutine (or pretend that it's | |
374 | imported with the C<use subs> pragma). | |
375 | ||
376 | To silently interpret it as the Perl operator, use the C<CORE::> prefix | |
377 | on the operator (e.g. C<CORE::log($x)>) or by declaring the subroutine | |
378 | to be an object method (see L<attrs>). | |
379 | ||
380 | =item Bad index while coercing array into hash | |
381 | ||
382 | (F) The index looked up in the hash found as the 0'th element of a | |
383 | pseudo-hash is not legal. Index values must be at 1 or greater. | |
384 | See L<perlref>. | |
385 | ||
386 | =item Bareword "%s" refers to nonexistent package | |
387 | ||
388 | (W) You used a qualified bareword of the form C<Foo::>, but | |
389 | the compiler saw no other uses of that namespace before that point. | |
390 | Perhaps you need to predeclare a package? | |
391 | ||
392 | =item Can't call method "%s" on an undefined value | |
393 | ||
394 | (F) You used the syntax of a method call, but the slot filled by the | |
395 | object reference or package name contains an undefined value. | |
396 | Something like this will reproduce the error: | |
397 | ||
398 | $BADREF = 42; | |
399 | process $BADREF 1,2,3; | |
400 | $BADREF->process(1,2,3); | |
401 | ||
402 | =item Can't coerce array into hash | |
403 | ||
404 | (F) You used an array where a hash was expected, but the array has no | |
405 | information on how to map from keys to array indices. You can do that | |
406 | only with arrays that have a hash reference at index 0. | |
407 | ||
408 | =item Can't goto subroutine from an eval-string | |
409 | ||
410 | (F) The "goto subroutine" call can't be used to jump out of an eval "string". | |
411 | (You can use it to jump out of an eval {BLOCK}, but you probably don't want to.) | |
412 | ||
413 | =item Can't use %%! because Errno.pm is not available | |
414 | ||
415 | (F) The first time the %! hash is used, perl automatically loads the | |
416 | Errno.pm module. The Errno module is expected to tie the %! hash to | |
417 | provide symbolic names for C<$!> errno values. | |
418 | ||
419 | =item Can't use %%! because Errno.pm is not available | |
420 | ||
421 | (F) The first time the %! hash is used, perl automatically loads the | |
422 | Errno.pm module. The Errno module is expected to tie the %! hash to | |
423 | provide symbolic names for C<$!> errno values. | |
424 | ||
425 | =item Cannot find an opnumber for "%s" | |
426 | ||
427 | (F) A string of a form C<CORE::word> was given to prototype(), but | |
428 | there is no builtin with the name C<word>. | |
429 | ||
430 | =item Character class syntax [. .] is reserved for future extensions | |
431 | ||
432 | (W) Within regular expression character classes ([]) the syntax beginning | |
433 | with "[." and ending with ".]" is reserved for future extensions. | |
434 | If you need to represent those character sequences inside a regular | |
435 | expression character class, just quote the square brackets with the | |
436 | backslash: "\[." and ".\]". | |
437 | ||
438 | =item Character class syntax [: :] is reserved for future extensions | |
439 | ||
440 | (W) Within regular expression character classes ([]) the syntax beginning | |
441 | with "[:" and ending with ":]" is reserved for future extensions. | |
442 | If you need to represent those character sequences inside a regular | |
443 | expression character class, just quote the square brackets with the | |
444 | backslash: "\[:" and ":\]". | |
445 | ||
446 | =item Character class syntax [= =] is reserved for future extensions | |
447 | ||
448 | (W) Within regular expression character classes ([]) the syntax | |
449 | beginning with "[=" and ending with "=]" is reserved for future extensions. | |
450 | If you need to represent those character sequences inside a regular | |
451 | expression character class, just quote the square brackets with the | |
452 | backslash: "\[=" and "=\]". | |
453 | ||
454 | =item %s: Eval-group in insecure regular expression | |
455 | ||
456 | (F) Perl detected tainted data when trying to compile a regular expression | |
457 | that contains the C<(?{ ... })> zero-width assertion, which is unsafe. | |
458 | See L<perlre/(?{ code })>, and L<perlsec>. | |
459 | ||
460 | =item %s: Eval-group not allowed, use re 'eval' | |
461 | ||
462 | (F) A regular expression contained the C<(?{ ... })> zero-width assertion, | |
463 | but that construct is only allowed when the C<use re 'eval'> pragma is | |
464 | in effect. See L<perlre/(?{ code })>. | |
465 | ||
466 | =item %s: Eval-group not allowed at run time | |
467 | ||
468 | (F) Perl tried to compile a regular expression containing the C<(?{ ... })> | |
469 | zero-width assertion at run time, as it would when the pattern contains | |
470 | interpolated values. Since that is a security risk, it is not allowed. | |
471 | If you insist, you may still do this by explicitly building the pattern | |
472 | from an interpolated string at run time and using that in an eval(). | |
473 | See L<perlre/(?{ code })>. | |
474 | ||
475 | =item Explicit blessing to '' (assuming package main) | |
476 | ||
477 | (W) You are blessing a reference to a zero length string. This has | |
478 | the effect of blessing the reference into the package main. This is | |
479 | usually not what you want. Consider providing a default target | |
480 | package, e.g. bless($ref, $p or 'MyPackage'); | |
481 | ||
482 | =item Illegal hex digit ignored | |
483 | ||
484 | (W) You may have tried to use a character other than 0 - 9 or A - F in a | |
485 | hexadecimal number. Interpretation of the hexadecimal number stopped | |
486 | before the illegal character. | |
487 | ||
488 | =item No such array field | |
489 | ||
490 | (F) You tried to access an array as a hash, but the field name used is | |
491 | not defined. The hash at index 0 should map all valid field names to | |
492 | array indices for that to work. | |
493 | ||
494 | =item No such field "%s" in variable %s of type %s | |
495 | ||
496 | (F) You tried to access a field of a typed variable where the type | |
497 | does not know about the field name. The field names are looked up in | |
498 | the %FIELDS hash in the type package at compile time. The %FIELDS hash | |
499 | is usually set up with the 'fields' pragma. | |
500 | ||
501 | =item Out of memory during ridiculously large request | |
502 | ||
503 | (F) You can't allocate more than 2^31+"small amount" bytes. This error | |
504 | is most likely to be caused by a typo in the Perl program. e.g., C<$arr[time]> | |
505 | instead of C<$arr[$time]>. | |
506 | ||
507 | =item Range iterator outside integer range | |
508 | ||
509 | (F) One (or both) of the numeric arguments to the range operator ".." | |
510 | are outside the range which can be represented by integers internally. | |
511 | One possible workaround is to force Perl to use magical string | |
512 | increment by prepending "0" to your numbers. | |
513 | ||
514 | =item Recursive inheritance detected while looking for method '%s' in package '%s' | |
515 | ||
516 | (F) More than 100 levels of inheritance were encountered while invoking a | |
517 | method. Probably indicates an unintended loop in your inheritance hierarchy. | |
518 | ||
519 | =item Reference found where even-sized list expected | |
520 | ||
521 | (W) You gave a single reference where Perl was expecting a list with | |
522 | an even number of elements (for assignment to a hash). This | |
523 | usually means that you used the anon hash constructor when you meant | |
524 | to use parens. In any case, a hash requires key/value B<pairs>. | |
525 | ||
526 | %hash = { one => 1, two => 2, }; # WRONG | |
527 | %hash = [ qw/ an anon array / ]; # WRONG | |
528 | %hash = ( one => 1, two => 2, ); # right | |
529 | %hash = qw( one 1 two 2 ); # also fine | |
530 | ||
531 | =item Undefined value assigned to typeglob | |
532 | ||
533 | (W) An undefined value was assigned to a typeglob, a la C<*foo = undef>. | |
534 | This does nothing. It's possible that you really mean C<undef *foo>. | |
535 | ||
536 | =item Use of reserved word "%s" is deprecated | |
537 | ||
538 | (D) The indicated bareword is a reserved word. Future versions of perl | |
539 | may use it as a keyword, so you're better off either explicitly quoting | |
540 | the word in a manner appropriate for its context of use, or using a | |
541 | different name altogether. The warning can be suppressed for subroutine | |
542 | names by either adding a C<&> prefix, or using a package qualifier, | |
543 | e.g. C<&our()>, or C<Foo::our()>. | |
544 | ||
545 | =item perl: warning: Setting locale failed. | |
546 | ||
547 | (S) The whole warning message will look something like: | |
548 | ||
549 | perl: warning: Setting locale failed. | |
550 | perl: warning: Please check that your locale settings: | |
551 | LC_ALL = "En_US", | |
552 | LANG = (unset) | |
553 | are supported and installed on your system. | |
554 | perl: warning: Falling back to the standard locale ("C"). | |
555 | ||
556 | Exactly what were the failed locale settings varies. In the above the | |
557 | settings were that the LC_ALL was "En_US" and the LANG had no value. | |
558 | This error means that Perl detected that you and/or your system | |
559 | administrator have set up the so-called variable system but Perl could | |
560 | not use those settings. This was not dead serious, fortunately: there | |
561 | is a "default locale" called "C" that Perl can and will use, the | |
562 | script will be run. Before you really fix the problem, however, you | |
563 | will get the same error message each time you run Perl. How to really | |
564 | fix the problem can be found in L<perllocale> section B<LOCALE PROBLEMS>. | |
565 | ||
566 | =back | |
567 | ||
568 | ||
569 | =head1 Obsolete Diagnostics | |
570 | ||
571 | =over | |
6cc33c6d | 572 | |
429b3afa GS |
573 | =item Can't mktemp() |
574 | ||
575 | (F) The mktemp() routine failed for some reason while trying to process | |
576 | a B<-e> switch. Maybe your /tmp partition is full, or clobbered. | |
577 | ||
578 | =item Can't write to temp file for B<-e>: %s | |
579 | ||
580 | (F) The write routine failed for some reason while trying to process | |
581 | a B<-e> switch. Maybe your /tmp partition is full, or clobbered. | |
582 | ||
583 | =item Cannot open temporary file | |
584 | ||
585 | (F) The create routine failed for some reason while trying to process | |
586 | a B<-e> switch. Maybe your /tmp partition is full, or clobbered. | |
587 | ||
588 | ||
589 | =back | |
590 | ||
01784f0d AD |
591 | =head1 BUGS |
592 | ||
593 | If you find what you think is a bug, you might check the headers of | |
594 | recently posted articles in the comp.lang.perl.misc newsgroup. | |
595 | There may also be information at http://www.perl.com/perl/, the Perl | |
596 | Home Page. | |
597 | ||
598 | If you believe you have an unreported bug, please run the B<perlbug> | |
599 | program included with your release. Make sure you trim your bug down | |
600 | to a tiny but sufficient test case. Your bug report, along with the | |
601 | output of C<perl -V>, will be sent off to <F<perlbug@perl.com>> to be | |
602 | analysed by the Perl porting team. | |
603 | ||
604 | =head1 SEE ALSO | |
605 | ||
606 | The F<Changes> file for exhaustive details on what changed. | |
607 | ||
608 | The F<INSTALL> file for how to build Perl. | |
609 | ||
610 | The F<README> file for general stuff. | |
611 | ||
612 | The F<Artistic> and F<Copying> files for copyright information. | |
613 | ||
614 | =head1 HISTORY | |
429b3afa GS |
615 | |
616 | =cut |