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