This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix quoting in t/io/inplace.t
[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
407eff0f 158=head2 Behavior of local() on array and hash elements is now well-defined
429b3afa 159
407eff0f 160See L<perlsub/"Temporary Values via local()">.
429b3afa
GS
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
429b3afa
GS
174=head2 Keywords can be globally overridden
175
176See L<perlsub>.
177
178=head2 C<$^E> is meaningful on Win32
179
180See L<perlvar>.
181
182=head2 C<foreach (1..1000000)> optimized
183
184C<foreach (1..1000000)> is now optimized into a counting loop. It does
185not try to allocate a 1000000-size list anymore.
186
187=head2 C<Foo::> can be used as implicitly quoted package name
188
189[XXX See what?]
190
191=head2 C<exists $Foo::{Bar::}> tests existence of a package
192
193[XXX See what?]
194
195=head2 Better locale support
196
197See L<perllocale>.
198
7ea97eb9 199=head2 Experimental support for 64-bit platforms
429b3afa 200
7ea97eb9
AD
201Perl5 has always had 64-bit support on systems with 64-bit longs.
202Starting with 5.005, the beginnings of experimental support for systems
203with 32-bit long and 64-bit 'long long' integers has been added.
204If you add -DUSE_LONG_LONG to your ccflags in config.sh (or manually
205define it in perl.h) then perl will be built with 'long long' support.
206There will be many compiler warnings, and the resultant perl may not
207work on all systems. There are many other issues related to
208third-party extensions and libraries. This option exists to allow
209people to work on those issues.
429b3afa
GS
210
211=head2 prototype() returns useful results on builtins
212
213See L<perlfunc/prototype>.
214
1a159553
GS
215=head2 Extended support for exception handling
216
217C<die()> now accepts a reference value, and C<$@> gets set to that
218value in exception traps. This makes it possible to propagate
219exception objects. See L<perlfunc/eval>. [XXX there's nothing
220about this in perlfunc/eval yet.]
221
429b3afa
GS
222=head2 Re-blessing in DESTROY() supported for chaining DESTROY() methods
223
224See L<perlobj/Destructors>.
225
226=head2 All C<printf> format conversions are handled internally
227
228See L<perlfunc/printf>.
229
230=head2 New C<INIT> keyword
231
fe61ab85
GS
232C<INIT> subs are like C<BEGIN> and C<END>, but they get run just before
233the perl runtime begins execution. e.g., the Perl Compiler makes use of
234C<INIT> blocks to initialize and resolve pointers to XSUBs.
429b3afa
GS
235
236[XXX Needs to be documented in perlsub or perlmod.]
237
238=head2 New C<lock> keyword
239
fe61ab85
GS
240The C<lock> keyword is the fundamental synchronization primitive
241in threaded perl. When threads are not enabled, it is currently a noop.
242
429b3afa
GS
243To minimize impact on source compatibility this keyword is "weak", i.e., any
244user-defined subroutine of the same name overrides it, unless a C<use Thread>
245has been seen.
246
fe61ab85
GS
247=head2 New C<qr//> operator
248
249The C<qr//> operator, which is syntactically similar to the other quote-like
0a92e3a8 250operators, is used to create precompiled regular expressions. This compiled
fe61ab85 251form can now be explicitly passed around in variables, and interpolated in
0a92e3a8 252other regular expressions. See L<perlop>.
fe61ab85
GS
253
254=head2 C<our> is now a reserved word
255
429b3afa
GS
256=head2 Tied arrays are now fully supported
257
258See L<Tie::Array>.
259
260=head2 Tied handles support is better
261
262Several missing hooks have been added. There is also a new base class for
263TIEARRAY implementations. See L<Tie::Array>.
264
6bb4e6d4
GS
265=head2 4th argument to substr
266
267substr() can now both return and replace in one operation. The optional
2684th argument is the replacement string. See L<perlfunc/substr>.
269
270=head2 Negative LENGTH argument to splice
271
272Splice() with a negative LENGTH argument now work similar to what the
273LENGTH did for substr(). Previously a negative LENGTH was treated as
2740. See L<perlfunc/splice>.
275
407eff0f
SM
276=head2 Magic lvalues are now more magical
277
278When you say something like C<substr($x, 5) = "hi">, the scalar returned
279by substr() is special, in that any modifications to it affect $x.
280(This is called a 'magic lvalue' because an 'lvalue' is something on
281the left side of an assignment.) Normally, this is exactly what you
282would expect to happen, but Perl uses the same magic if you use substr(),
283pos(), or vec() in a context where they might be modified, like taking
284a reference with C<\> or as an argument to a sub that modifies C<@_>.
285In previous versions, this 'magic' only went one way, but now changes
286to the scalar the magic refers to ($x in the above example) affect the
287magic lvalue too. For instance, this code now acts differently:
288
289 $x = "hello";
290 sub printit {
291 $x = "g'bye";
292 print $_[0], "\n";
293 }
294 printit(substr($x, 0, 5));
295
296In previous versions, this would print "hello", but it now prints "g'bye".
297
429b3afa
GS
298
299=head1 Supported Platforms
300
301Configure has many incremental improvements. Site-wide policy for building
fe61ab85 302perl can now be made persistent, via Policy.sh. Configure also records
7ea97eb9 303the command-line arguments used in F<config.sh>.
429b3afa
GS
304
305=head2 New Platforms
306
307BeOS is now supported. See L<README.beos>.
308
309DOS is now supported under the DJGPP tools. See L<README.dos>.
310
1d84e8df
JH
311MPE/iX is now supported. See L<README.mpeix>.
312
429b3afa
GS
313=head2 Changes in existing support
314
315Win32 support has been vastly enhanced. Support for Perl Object, a C++
316encapsulation of Perl. GCC and EGCS are now supported on Win32.
317[XXX Perl Object needs a big explanation elsewhere, and a pointer to
318that location here.]
319
320VMS configuration system has been rewritten. See L<README.vms>.
321
322OpenBSD better supported. [XXX what others?]
323
324=head1 Modules and Pragmata
325
326=head2 New Modules
327
328=over
329
330=item B
331
332Perl compiler and tools. See [XXX what?].
333
334=item Data::Dumper
335
336A module to pretty print Perl data. See L<Data::Dumper>.
337
338=item Errno
339
340A module to look up errors more conveniently. See L<Errno>.
341
342=item File::Spec
343
344A portable API for file operations.
345
346=item ExtUtils::Installed
347
348Query and manage installed modules.
349
350=item ExtUtils::Packlist
351
352Manipulate .packlist files.
353
354=item Fatal
355
356Make functions/builtins succeed or die.
357
358=item IPC::SysV
359
360Constants and other support infrastructure for System V IPC operations
361in perl.
362
363=item Test
364
365A framework for writing testsuites.
01784f0d 366
429b3afa
GS
367=item Tie::Array
368
369Base class for tied arrays.
370
371=item Tie::Handle
372
373Base class for tied handles.
374
375=item Thread
376
377Perl thread creation, manipulation, and support.
378
379=item attrs
380
381Set subroutine attributes.
382
383=item fields
384
385Compile-time class fields.
386
387=item re
388
389Various pragmata to control behavior of regular expressions.
390
391=back
392
393=head2 Changes in existing modules
394
395=over
396
397=item CGI
398
399CGI has been updated to version 2.42.
400
401=item POSIX
402
403POSIX now has its own platform-specific hints files.
404
405=item DB_File
406
407DB_File supports version 2.x of Berkeley DB. See C<ext/DB_File/Changes>.
408
409=item MakeMaker
410
411MakeMaker now supports writing empty makefiles, provides a way to
412specify that site umask() policy should be honored. There is also
413better support for manipulation of .packlist files, and getting
414information about installed modules.
415
7ea97eb9
AD
416Extensions that have both architecture-dependent and
417architecture-independent files are now always installed completely in
418the architecture-dependent locations. Previously, the shareable parts
419were shared both across architectures and across perl versions and were
420therefore liable to be overwritten with newer versions that might have
421subtle incompatibilities.
422
429b3afa
GS
423=item CPAN
424
425[XXX What?]
426
427=item Cwd
428
429Cwd::cwd is faster on most platforms.
430
431=item Benchmark
432
433Keeps better time.
434
435=back
01784f0d
AD
436
437=head1 Utility Changes
438
429b3afa
GS
439h2ph and related utilities have been vastly overhauled.
440
441perlcc, a new experimental front end for the compiler is available.
442
7ea97eb9
AD
443The crude GNU configure emulator is now called configure.gnu.
444
429b3afa
GS
445=head1 API Changes
446
447=head2 Incompatible Changes
448
449=head2 Deprecations, Extensions
450
451=head2 C++ Support
01784f0d
AD
452
453=head1 Documentation Changes
454
429b3afa
GS
455Config.pm now has a glossary of variables.
456
457Porting/patching.pod has detailed instructions on how to create and
458submit patches for perl.
459
460=head1 New Diagnostics
461
462=over
463
464=item Ambiguous call resolved as CORE::%s(), qualify as such or use &
465
466(W) A subroutine you have declared has the same name as a Perl keyword,
467and you have used the name without qualification for calling one or the
468other. Perl decided to call the builtin because the subroutine is
469not imported.
470
471To force interpretation as a subroutine call, either put an ampersand
472before the subroutine name, or qualify the name with its package.
473Alternatively, you can import the subroutine (or pretend that it's
474imported with the C<use subs> pragma).
475
476To silently interpret it as the Perl operator, use the C<CORE::> prefix
477on the operator (e.g. C<CORE::log($x)>) or by declaring the subroutine
478to be an object method (see L<attrs>).
479
480=item Bad index while coercing array into hash
481
482(F) The index looked up in the hash found as the 0'th element of a
483pseudo-hash is not legal. Index values must be at 1 or greater.
484See L<perlref>.
485
486=item Bareword "%s" refers to nonexistent package
487
488(W) You used a qualified bareword of the form C<Foo::>, but
489the compiler saw no other uses of that namespace before that point.
490Perhaps you need to predeclare a package?
491
492=item Can't call method "%s" on an undefined value
493
494(F) You used the syntax of a method call, but the slot filled by the
495object reference or package name contains an undefined value.
496Something like this will reproduce the error:
497
498 $BADREF = 42;
499 process $BADREF 1,2,3;
500 $BADREF->process(1,2,3);
501
502=item Can't coerce array into hash
503
504(F) You used an array where a hash was expected, but the array has no
505information on how to map from keys to array indices. You can do that
506only with arrays that have a hash reference at index 0.
507
508=item Can't goto subroutine from an eval-string
509
510(F) The "goto subroutine" call can't be used to jump out of an eval "string".
511(You can use it to jump out of an eval {BLOCK}, but you probably don't want to.)
512
0ebe0038
SM
513=item Can't localize pseudo-hash element
514
515(F) You said something like C<local $ar-E<gt>{'key'}>, where $ar is
516a reference to a pseudo-hash. That hasn't been implemented yet, but
517you can get a similar effect by localizing the corresponding array
518element directly -- C<local $ar-E<gt>[$ar-E<gt>[0]{'key'}]>.
519
429b3afa
GS
520=item Can't use %%! because Errno.pm is not available
521
522(F) The first time the %! hash is used, perl automatically loads the
523Errno.pm module. The Errno module is expected to tie the %! hash to
524provide symbolic names for C<$!> errno values.
525
429b3afa
GS
526=item Cannot find an opnumber for "%s"
527
528(F) A string of a form C<CORE::word> was given to prototype(), but
529there is no builtin with the name C<word>.
530
531=item Character class syntax [. .] is reserved for future extensions
532
533(W) Within regular expression character classes ([]) the syntax beginning
534with "[." and ending with ".]" is reserved for future extensions.
535If you need to represent those character sequences inside a regular
536expression character class, just quote the square brackets with the
537backslash: "\[." and ".\]".
538
539=item Character class syntax [: :] is reserved for future extensions
540
541(W) Within regular expression character classes ([]) the syntax beginning
542with "[:" and ending with ":]" is reserved for future extensions.
543If you need to represent those character sequences inside a regular
544expression character class, just quote the square brackets with the
545backslash: "\[:" and ":\]".
546
547=item Character class syntax [= =] is reserved for future extensions
548
549(W) Within regular expression character classes ([]) the syntax
550beginning with "[=" and ending with "=]" is reserved for future extensions.
551If you need to represent those character sequences inside a regular
552expression character class, just quote the square brackets with the
553backslash: "\[=" and "=\]".
554
555=item %s: Eval-group in insecure regular expression
556
557(F) Perl detected tainted data when trying to compile a regular expression
558that contains the C<(?{ ... })> zero-width assertion, which is unsafe.
559See L<perlre/(?{ code })>, and L<perlsec>.
560
561=item %s: Eval-group not allowed, use re 'eval'
562
563(F) A regular expression contained the C<(?{ ... })> zero-width assertion,
564but that construct is only allowed when the C<use re 'eval'> pragma is
565in effect. See L<perlre/(?{ code })>.
566
567=item %s: Eval-group not allowed at run time
568
569(F) Perl tried to compile a regular expression containing the C<(?{ ... })>
570zero-width assertion at run time, as it would when the pattern contains
571interpolated values. Since that is a security risk, it is not allowed.
572If you insist, you may still do this by explicitly building the pattern
573from an interpolated string at run time and using that in an eval().
574See L<perlre/(?{ code })>.
575
576=item Explicit blessing to '' (assuming package main)
577
578(W) You are blessing a reference to a zero length string. This has
579the effect of blessing the reference into the package main. This is
580usually not what you want. Consider providing a default target
581package, e.g. bless($ref, $p or 'MyPackage');
582
583=item Illegal hex digit ignored
584
585(W) You may have tried to use a character other than 0 - 9 or A - F in a
586hexadecimal number. Interpretation of the hexadecimal number stopped
587before the illegal character.
588
589=item No such array field
590
591(F) You tried to access an array as a hash, but the field name used is
592not defined. The hash at index 0 should map all valid field names to
593array indices for that to work.
594
595=item No such field "%s" in variable %s of type %s
596
597(F) You tried to access a field of a typed variable where the type
598does not know about the field name. The field names are looked up in
599the %FIELDS hash in the type package at compile time. The %FIELDS hash
600is usually set up with the 'fields' pragma.
601
602=item Out of memory during ridiculously large request
603
604(F) You can't allocate more than 2^31+"small amount" bytes. This error
605is most likely to be caused by a typo in the Perl program. e.g., C<$arr[time]>
606instead of C<$arr[$time]>.
607
608=item Range iterator outside integer range
609
610(F) One (or both) of the numeric arguments to the range operator ".."
611are outside the range which can be represented by integers internally.
612One possible workaround is to force Perl to use magical string
613increment by prepending "0" to your numbers.
614
615=item Recursive inheritance detected while looking for method '%s' in package '%s'
616
617(F) More than 100 levels of inheritance were encountered while invoking a
618method. Probably indicates an unintended loop in your inheritance hierarchy.
619
620=item Reference found where even-sized list expected
621
622(W) You gave a single reference where Perl was expecting a list with
623an even number of elements (for assignment to a hash). This
624usually means that you used the anon hash constructor when you meant
625to use parens. In any case, a hash requires key/value B<pairs>.
626
627 %hash = { one => 1, two => 2, }; # WRONG
628 %hash = [ qw/ an anon array / ]; # WRONG
629 %hash = ( one => 1, two => 2, ); # right
630 %hash = qw( one 1 two 2 ); # also fine
631
632=item Undefined value assigned to typeglob
633
634(W) An undefined value was assigned to a typeglob, a la C<*foo = undef>.
635This does nothing. It's possible that you really mean C<undef *foo>.
636
637=item Use of reserved word "%s" is deprecated
638
639(D) The indicated bareword is a reserved word. Future versions of perl
640may use it as a keyword, so you're better off either explicitly quoting
641the word in a manner appropriate for its context of use, or using a
642different name altogether. The warning can be suppressed for subroutine
643names by either adding a C<&> prefix, or using a package qualifier,
644e.g. C<&our()>, or C<Foo::our()>.
645
646=item perl: warning: Setting locale failed.
647
648(S) The whole warning message will look something like:
649
650 perl: warning: Setting locale failed.
651 perl: warning: Please check that your locale settings:
652 LC_ALL = "En_US",
653 LANG = (unset)
654 are supported and installed on your system.
655 perl: warning: Falling back to the standard locale ("C").
656
657Exactly what were the failed locale settings varies. In the above the
658settings were that the LC_ALL was "En_US" and the LANG had no value.
659This error means that Perl detected that you and/or your system
660administrator have set up the so-called variable system but Perl could
661not use those settings. This was not dead serious, fortunately: there
662is a "default locale" called "C" that Perl can and will use, the
663script will be run. Before you really fix the problem, however, you
664will get the same error message each time you run Perl. How to really
665fix the problem can be found in L<perllocale> section B<LOCALE PROBLEMS>.
666
667=back
668
669
670=head1 Obsolete Diagnostics
671
672=over
6cc33c6d 673
429b3afa
GS
674=item Can't mktemp()
675
676(F) The mktemp() routine failed for some reason while trying to process
677a B<-e> switch. Maybe your /tmp partition is full, or clobbered.
678
679=item Can't write to temp file for B<-e>: %s
680
681(F) The write routine failed for some reason while trying to process
682a B<-e> switch. Maybe your /tmp partition is full, or clobbered.
683
684=item Cannot open temporary file
685
686(F) The create routine failed for some reason while trying to process
687a B<-e> switch. Maybe your /tmp partition is full, or clobbered.
688
689
690=back
691
01784f0d
AD
692=head1 BUGS
693
694If you find what you think is a bug, you might check the headers of
695recently posted articles in the comp.lang.perl.misc newsgroup.
696There may also be information at http://www.perl.com/perl/, the Perl
697Home Page.
698
699If you believe you have an unreported bug, please run the B<perlbug>
700program included with your release. Make sure you trim your bug down
701to a tiny but sufficient test case. Your bug report, along with the
702output of C<perl -V>, will be sent off to <F<perlbug@perl.com>> to be
703analysed by the Perl porting team.
704
705=head1 SEE ALSO
706
707The F<Changes> file for exhaustive details on what changed.
708
709The F<INSTALL> file for how to build Perl.
710
711The F<README> file for general stuff.
712
713The F<Artistic> and F<Copying> files for copyright information.
714
715=head1 HISTORY
429b3afa
GS
716
717=cut