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