GCC + Threads on Win32 - best gcc results yet
[p5sagit/p5-mst-13.2.git] / pod / perldelta.pod
CommitLineData
5f05dabc 1=head1 NAME
2
774d564b 3perldelta - what's new for perl5.004
5f05dabc 4
5=head1 DESCRIPTION
6
7This document describes differences between the 5.003 release (as
8documented in I<Programming Perl>, second edition--the Camel Book) and
9this one.
10
11=head1 Supported Environments
12
7bac28a0 13Perl5.004 builds out of the box on Unix, Plan 9, LynxOS, VMS, OS/2,
14QNX, AmigaOS, and Windows NT. Perl runs on Windows 95 as well, but it
15cannot be built there, for lack of a reasonable command interpreter.
5f05dabc 16
17=head1 Core Changes
18
c90c0ff4 19Most importantly, many bugs were fixed, including several security
20problems. See the F<Changes> file in the distribution for details.
5f05dabc 21
906cf63e 22=head2 List assignment to %ENV works
23
24C<%ENV = ()> and C<%ENV = @list> now work as expected (except on VMS
25where it generates a fatal error).
26
27=head2 "Can't locate Foo.pm in @INC" error now lists @INC
28
54310121 29=head2 Compilation option: Binary compatibility with 5.003
5f05dabc 30
31There is a new Configure question that asks if you want to maintain
32binary compatibility with Perl 5.003. If you choose binary
33compatibility, you do not have to recompile your extensions, but you
44a8e56a 34might have symbol conflicts if you embed Perl in another application,
774d564b 35just as in the 5.003 release. By default, binary compatibility
36is preserved at the expense of symbol table pollution.
5f05dabc 37
54310121 38=head2 $PERL5OPT environment variable
39
40You may now put Perl options in the $PERL5OPT environment variable.
41Unless Perl is running with taint checks, it will interpret this
42variable as if its contents had appeared on a "#!perl" line at the
43beginning of your script, except that hyphens are optional. PERL5OPT
44may only be used to set the following switches: B<-[DIMUdmw]>.
45
c90c0ff4 46=head2 Limitations on B<-M>, B<-m>, and B<-T> options
8cc95fdb 47
48The C<-M> and C<-m> options are no longer allowed on the C<#!> line of
49a script. If a script needs a module, it should invoke it with the
50C<use> pragma.
51
52The B<-T> option is also forbidden on the C<#!> line of a script,
53unless it was present on the Perl command line. Due to the way C<#!>
54works, this usually means that B<-T> must be in the first argument.
55Thus:
56
57 #!/usr/bin/perl -T -w
58
59will probably work for an executable script invoked as C<scriptname>,
60while:
61
62 #!/usr/bin/perl -w -T
63
64will probably fail under the same conditions. (Non-Unix systems will
65probably not follow this rule.) But C<perl scriptname> is guaranteed
66to fail, since then there is no chance of B<-T> being found on the
67command line before it is found on the C<#!> line.
68
54310121 69=head2 More precise warnings
70
dc848c6f 71If you removed the B<-w> option from your Perl 5.003 scripts because it
54310121 72made Perl too verbose, we recommend that you try putting it back when
73you upgrade to Perl 5.004. Each new perl version tends to remove some
74undesirable warnings, while adding new warnings that may catch bugs in
75your scripts.
76
dc848c6f 77=head2 Deprecated: Inherited C<AUTOLOAD> for non-methods
78
79Before Perl 5.004, C<AUTOLOAD> functions were looked up as methods
80(using the C<@ISA> hierarchy), even when the function to be autoloaded
81was called as a plain function (e.g. C<Foo::bar()>), not a method
7bac28a0 82(e.g. C<Foo-E<gt>bar()> or C<$obj-E<gt>bar()>).
dc848c6f 83
84Perl 5.005 will use method lookup only for methods' C<AUTOLOAD>s.
85However, there is a significant base of existing code that may be using
86the old behavior. So, as an interim step, Perl 5.004 issues an optional
87warning when a non-method uses an inherited C<AUTOLOAD>.
88
89The simple rule is: Inheritance will not work when autoloading
90non-methods. The simple fix for old code is: In any module that used to
91depend on inheriting C<AUTOLOAD> for non-methods from a base class named
92C<BaseClass>, execute C<*AUTOLOAD = \&BaseClass::AUTOLOAD> during startup.
93
906cf63e 94=head2 Previously deprecated %OVERLOAD is no longer usable
95
96Using %OVERLOAD to define overloading was deprecated in 5.003.
97Overloading is now defined using the overload pragma. %OVERLOAD is
98still used internally but should not be used by Perl scripts. See
99L<overload> for more details.
100
3fe9a6f1 101=head2 Subroutine arguments created only when they're modified
7cfe7857 102
3fe9a6f1 103In Perl 5.004, nonexistent array and hash elements used as subroutine
104parameters are brought into existence only if they are actually
105assigned to (via C<@_>).
2ae324a7 106
3fe9a6f1 107Earlier versions of Perl vary in their handling of such arguments.
108Perl versions 5.002 and 5.003 always brought them into existence.
7bac28a0 109Perl versions 5.000 and 5.001 brought them into existence only if
110they were not the first argument (which was almost certainly a bug).
111Earlier versions of Perl never brought them into existence.
3fe9a6f1 112
113For example, given this code:
114
115 undef @a; undef %a;
116 sub show { print $_[0] };
117 sub change { $_[0]++ };
118 show($a[2]);
119 change($a{b});
120
121After this code executes in Perl 5.004, $a{b} exists but $a[2] does
122not. In Perl 5.002 and 5.003, both $a{b} and $a[2] would have existed
123(but $a[2]'s value would have been undefined).
7cfe7857 124
8cc95fdb 125=head2 Group vector changeable with C<$)>
5cd24f17 126
127The C<$)> special variable has always (well, in Perl 5, at least)
8cc95fdb 128reflected not only the current effective group, but also the group list
129as returned by the C<getgroups()> C function (if there is one).
130However, until this release, there has not been a way to call the
131C<setgroups()> C function from Perl.
5cd24f17 132
8cc95fdb 133In Perl 5.004, assigning to C<$)> is exactly symmetrical with examining
134it: The first number in its string value is used as the effective gid;
135if there are any numbers after the first one, they are passed to the
136C<setgroups()> C function (if there is one).
5cd24f17 137
54310121 138=head2 Fixed parsing of $$<digit>, &$<digit>, etc.
aa689395 139
5cd24f17 140Perl versions before 5.004 misinterpreted any type marker followed by
141"$" and a digit. For example, "$$0" was incorrectly taken to mean
142"${$}0" instead of "${$0}". This bug is (mostly) fixed in Perl 5.004.
143
144However, the developers of Perl 5.004 could not fix this bug completely,
145because at least two widely-used modules depend on the old meaning of
146"$$0" in a string. So Perl 5.004 still interprets "$$<digit>" in the
147old (broken) way inside strings; but it generates this message as a
148warning. And in Perl 5.005, this special treatment will cease.
aa689395 149
84902520 150=head2 Fixed localization of $<digit>, $&, etc.
151
152Perl versions before 5.004 did not always properly localize the
153regex-related special variables. Perl 5.004 does localize them, as
154the documentation has always said it should. This may result in $1,
155$2, etc. no longer being set where existing programs use them.
156
54310121 157=head2 No resetting of $. on implicit close
68dc0745 158
159The documentation for Perl 5.0 has always stated that C<$.> is I<not>
54310121 160reset when an already-open file handle is reopened with no intervening
161call to C<close>. Due to a bug, perl versions 5.000 through 5.003
68dc0745 162I<did> reset C<$.> under that circumstance; Perl 5.004 does not.
163
54310121 164=head2 C<wantarray> may return undef
165
166The C<wantarray> operator returns true if a subroutine is expected to
167return a list, and false otherwise. In Perl 5.004, C<wantarray> can
168also return the undefined value if a subroutine's return value will
169not be used at all, which allows subroutines to avoid a time-consuming
170calculation of a return value if it isn't going to be used.
171
172=head2 Changes to tainting checks
5f05dabc 173
9607fc9c 174A bug in previous versions may have failed to detect some insecure
8cc95fdb 175conditions when taint checks are turned on. (Taint checks are used
9607fc9c 176in setuid or setgid scripts, or when explicitly turned on with the
8cc95fdb 177C<-T> invocation option.) Although it's unlikely, this may cause a
9607fc9c 178previously-working script to now fail -- which should be construed
179as a blessing, since that indicates a potentially-serious security
180hole was just plugged.
181
c90c0ff4 182The new restrictions when tainting include:
183
184=over
185
186=item No glob() or <*>
187
188These operators may spawn the C shell (csh), which cannot be made
189safe. This restriction will be lifted in a future version of Perl
190when globbing is implemented without the use of an external program.
191
192=item No spawning if tainted $CDPATH, $ENV, $BASH_ENV
193
194These environment variables may alter the behavior of spawned programs
195(especially shells) in ways that subvert security. So now they are
196treated as dangerous, in the manner of $IFS and $PATH.
197
198=item No spawning if tainted $TERM doesn't look like a terminal name
199
200Some termcap libraries do unsafe things with $TERM. However, it would be
201unnecessarily harsh to treat all $TERM values as unsafe, since only shell
202metacharacters can cause trouble in $TERM. So a tainted $TERM is
203considered to be safe if it contains only alphanumerics, underscores,
204dashes, and colons, and unsafe if it contains other characters (including
205whitespace).
206
207=back
208
54310121 209=head2 New Opcode module and revised Safe module
2ae324a7 210
211A new Opcode module supports the creation, manipulation and
212application of opcode masks. The revised Safe module has a new API
213and is implemented using the new Opcode module. Please read the new
214Opcode and Safe documentation.
215
54310121 216=head2 Embedding improvements
68dc0745 217
218In older versions of Perl it was not possible to create more than one
219Perl interpreter instance inside a single process without leaking like a
220sieve and/or crashing. The bugs that caused this behavior have all been
221fixed. However, you still must take care when embedding Perl in a C
222program. See the updated perlembed manpage for tips on how to manage
223your interpreters.
224
54310121 225=head2 Internal change: FileHandle class based on IO::* classes
9607fc9c 226
227File handles are now stored internally as type IO::Handle. The
228FileHandle module is still supported for backwards compatibility, but
229it is now merely a front end to the IO::* modules -- specifically,
230IO::Handle, IO::Seekable, and IO::File. We suggest, but do not
231require, that you use the IO::* modules in new code.
232
c90c0ff4 233In harmony with this change, C<*GLOB{FILEHANDLE}> is now just a
234backward-compatible synonym for C<*GLOB{IO}>.
5f05dabc 235
54310121 236=head2 Internal change: PerlIO abstraction interface
5f05dabc 237
238It is now possible to build Perl with AT&T's sfio IO package
239instead of stdio. See L<perlapio> for more details, and
240the F<INSTALL> file for how to use it.
241
6da72b64 242=head2 New and changed syntax
243
244=over
245
246=item $coderef->(PARAMS)
247
248A subroutine reference may now be suffixed with an arrow and a
249(possibly empty) parameter list. This syntax denotes a call of the
250referenced subroutine, with the given parameters (if any).
251
3e07908e 252This new syntax follows the pattern of S<C<$hashref-E<gt>{FOO}>> and
253S<C<$aryref-E<gt>[$foo]>>: You may now write S<C<&$subref($foo)>> as
254S<C<$subref-E<gt>($foo)>>. All of these arrow terms may be chained;
255thus, S<C<&{$table-E<gt>{FOO}}($bar)>> may now be written
256S<C<$table-E<gt>{FOO}-E<gt>($bar)>>.
6da72b64 257
258=back
259
dd2afc7e 260=head2 New and changed builtin constants
261
262=over
263
264=item __PACKAGE__
265
266The current package name at compile time, or the undefined value if
267there is no current package (due to a C<package;> directive). Like
268C<__FILE__> and C<__LINE__>, C<__PACKAGE__> does I<not> interpolate
269into strings.
270
271=back
272
54310121 273=head2 New and changed builtin variables
5f05dabc 274
275=over
276
277=item $^E
278
f86702cc 279Extended error message on some platforms. (Also known as
280$EXTENDED_OS_ERROR if you C<use English>).
5f05dabc 281
282=item $^H
283
284The current set of syntax checks enabled by C<use strict>. See the
285documentation of C<strict> for more details. Not actually new, but
286newly documented.
287Because it is intended for internal use by Perl core components,
288there is no C<use English> long name for this variable.
289
290=item $^M
291
292By default, running out of memory it is not trappable. However, if
293compiled for this, Perl may use the contents of C<$^M> as an emergency
294pool after die()ing with this message. Suppose that your Perl were
84902520 295compiled with -DPERL_EMERGENCY_SBRK and used Perl's malloc. Then
5f05dabc 296
297 $^M = 'a' x (1<<16);
298
774d564b 299would allocate a 64K buffer for use when in emergency.
5f05dabc 300See the F<INSTALL> file for information on how to enable this option.
301As a disincentive to casual use of this advanced feature,
302there is no C<use English> long name for this variable.
303
304=back
305
54310121 306=head2 New and changed builtin functions
5f05dabc 307
308=over
309
310=item delete on slices
311
312This now works. (e.g. C<delete @ENV{'PATH', 'MANPATH'}>)
313
314=item flock
315
68dc0745 316is now supported on more platforms, prefers fcntl to lockf when
317emulating, and always flushes before (un)locking.
5f05dabc 318
046ff0ed 319=item printf and sprintf
320
74a77017 321Perl now implements these functions itself; it doesn't use the C
322library function sprintf() any more, except for floating-point
323numbers, and even then only known flags are allowed. As a result, it
324is now possible to know which conversions and flags will work, and
325what they will do.
326
327The new conversions in Perl's sprintf() are:
328
329 %i a synonym for %d
330 %p a pointer (the address of the Perl value, in hexadecimal)
7bac28a0 331 %n special: *stores* the number of characters output so far
332 into the next variable in the parameter list
74a77017 333
334The new flags that go between the C<%> and the conversion are:
335
336 # prefix octal with "0", hex with "0x"
337 h interpret integer as C type "short" or "unsigned short"
338 V interpret integer as Perl's standard integer type
339
340Also, where a number would appear in the flags, an asterisk ("*") may
341be used instead, in which case Perl uses the next item in the
342parameter list as the given number (that is, as the field width or
343precision). If a field width obtained through "*" is negative, it has
344the same effect as the '-' flag: left-justification.
345
346See L<perlfunc/sprintf> for a complete list of conversion and flags.
046ff0ed 347
5f05dabc 348=item keys as an lvalue
349
350As an lvalue, C<keys> allows you to increase the number of hash buckets
aa689395 351allocated for the given hash. This can gain you a measure of efficiency if
352you know the hash is going to get big. (This is similar to pre-extending
353an array by assigning a larger number to $#array.) If you say
5f05dabc 354
355 keys %hash = 200;
356
357then C<%hash> will have at least 200 buckets allocated for it. These
358buckets will be retained even if you do C<%hash = ()>; use C<undef
359%hash> if you want to free the storage while C<%hash> is still in scope.
360You can't shrink the number of buckets allocated for the hash using
361C<keys> in this way (but you needn't worry about doing this by accident,
362as trying has no effect).
363
364=item my() in Control Structures
365
366You can now use my() (with or without the parentheses) in the control
367expressions of control structures such as:
368
aa689395 369 while (defined(my $line = <>)) {
5f05dabc 370 $line = lc $line;
371 } continue {
372 print $line;
373 }
374
774d564b 375 if ((my $answer = <STDIN>) =~ /^y(es)?$/i) {
5f05dabc 376 user_agrees();
774d564b 377 } elsif ($answer =~ /^n(o)?$/i) {
5f05dabc 378 user_disagrees();
379 } else {
380 chomp $answer;
774d564b 381 die "`$answer' is neither `yes' nor `no'";
5f05dabc 382 }
383
384Also, you can declare a foreach loop control variable as lexical by
385preceding it with the word "my". For example, in:
386
387 foreach my $i (1, 2, 3) {
388 some_function();
389 }
390
391$i is a lexical variable, and the scope of $i extends to the end of
392the loop, but not beyond it.
393
394Note that you still cannot use my() on global punctuation variables
395such as $_ and the like.
396
137443ea 397=item pack() and unpack()
5f05dabc 398
399A new format 'w' represents a BER compressed integer (as defined in
400ASN.1). Its format is a sequence of one or more bytes, each of which
401provides seven bits of the total value, with the most significant
402first. Bit eight of each byte is set, except for the last byte, in
403which bit eight is clear.
404
61167c6f 405If 'p' or 'P' are given undef as values, they now generate a NULL
406pointer.
407
8903cb82 408Both pack() and unpack() now fail when their templates contain invalid
409types. (Invalid types used to be ignored.)
137443ea 410
8903cb82 411=item sysseek()
412
413The new sysseek() operator is a variant of seek() that sets and gets the
414file's system read/write position, using the lseek(2) system call. It is
415the only reliable way to seek before using sysread() or syswrite(). Its
416return value is the new position, or the undefined value on failure.
137443ea 417
5f05dabc 418=item use VERSION
419
420If the first argument to C<use> is a number, it is treated as a version
421number instead of a module name. If the version of the Perl interpreter
422is less than VERSION, then an error message is printed and Perl exits
774d564b 423immediately. Because C<use> occurs at compile time, this check happens
424immediately during the compilation process, unlike C<require VERSION>,
54310121 425which waits until runtime for the check. This is often useful if you
774d564b 426need to check the current Perl version before C<use>ing library modules
427which have changed in incompatible ways from older versions of Perl.
428(We try not to do this more than we have to.)
5f05dabc 429
430=item use Module VERSION LIST
431
432If the VERSION argument is present between Module and LIST, then the
71be2cbc 433C<use> will call the VERSION method in class Module with the given
434version as an argument. The default VERSION method, inherited from
dc848c6f 435the UNIVERSAL class, croaks if the given version is larger than the
71be2cbc 436value of the variable $Module::VERSION. (Note that there is not a
437comma after VERSION!)
5f05dabc 438
7cfe7857 439This version-checking mechanism is similar to the one currently used
440in the Exporter module, but it is faster and can be used with modules
441that don't use the Exporter. It is the recommended method for new
442code.
443
5f05dabc 444=item prototype(FUNCTION)
445
446Returns the prototype of a function as a string (or C<undef> if the
447function has no prototype). FUNCTION is a reference to or the name of the
448function whose prototype you want to retrieve.
449(Not actually new; just never documented before.)
450
9607fc9c 451=item srand
452
453The default seed for C<srand>, which used to be C<time>, has been changed.
454Now it's a heady mix of difficult-to-predict system-dependent values,
455which should be sufficient for most everyday purposes.
456
457Previous to version 5.004, calling C<rand> without first calling C<srand>
458would yield the same sequence of random numbers on most or all machines.
459Now, when perl sees that you're calling C<rand> and haven't yet called
460C<srand>, it calls C<srand> with the default seed. You should still call
461C<srand> manually if your code might ever be run on a pre-5.004 system,
2ae324a7 462of course, or if you want a seed other than the default.
9607fc9c 463
5f05dabc 464=item $_ as Default
465
466Functions documented in the Camel to default to $_ now in
467fact do, and all those that do are so documented in L<perlfunc>.
468
c90c0ff4 469=item C<m//gc> does not reset search position on failure
a99df21c 470
c90c0ff4 471The C<m//g> match iteration construct has always reset its target
472string's search position (which is visible through the C<pos> operator)
473when a match fails; as a result, the next C<m//g> match after a failure
474starts again at the beginning of the string. With Perl 5.004, this
475reset may be disabled by adding the "c" (for "continue") modifier,
476i.e. C<m//gc>. This feature, in conjunction with the C<\G> zero-width
477assertion, makes it possible to chain matches together. See L<perlop>
478and L<perlre>.
44a8e56a 479
3fe9a6f1 480=item C<m//x> ignores whitespace before ?*+{}
481
482The C<m//x> construct has always been intended to ignore all unescaped
483whitespace. However, before Perl 5.004, whitespace had the effect of
54310121 484escaping repeat modifiers like "*" or "?"; for example, C</a *b/x> was
3fe9a6f1 485(mis)interpreted as C</a\*b/x>. This bug has been fixed in 5.004.
486
774d564b 487=item nested C<sub{}> closures work now
488
2ae324a7 489Prior to the 5.004 release, nested anonymous functions didn't work
490right. They do now.
774d564b 491
492=item formats work right on changing lexicals
493
494Just like anonymous functions that contain lexical variables
495that change (like a lexical index variable for a C<foreach> loop),
496formats now work properly. For example, this silently failed
c90c0ff4 497before (printed only zeros), but is fine now:
774d564b 498
499 my $i;
500 foreach $i ( 1 .. 10 ) {
c90c0ff4 501 write;
502 }
503 format =
774d564b 504 my i is @#
505 $i
506 .
774d564b 507
84902520 508However, it still fails (without a warning) if the foreach is within a
509subroutine:
510
511 my $i;
512 sub foo {
513 foreach $i ( 1 .. 10 ) {
514 write;
515 }
516 }
517 foo;
518 format =
519 my i is @#
520 $i
521 .
522
5f05dabc 523=back
524
54310121 525=head2 New builtin methods
5f05dabc 526
527The C<UNIVERSAL> package automatically contains the following methods that
528are inherited by all other classes:
529
0a753a76 530=over
5f05dabc 531
532=item isa(CLASS)
533
68dc0745 534C<isa> returns I<true> if its object is blessed into a subclass of C<CLASS>
5f05dabc 535
536C<isa> is also exportable and can be called as a sub with two arguments. This
537allows the ability to check what a reference points to. Example:
538
539 use UNIVERSAL qw(isa);
540
541 if(isa($ref, 'ARRAY')) {
542 ...
543 }
544
545=item can(METHOD)
546
547C<can> checks to see if its object has a method called C<METHOD>,
548if it does then a reference to the sub is returned; if it does not then
549I<undef> is returned.
550
551=item VERSION( [NEED] )
552
71be2cbc 553C<VERSION> returns the version number of the class (package). If the
554NEED argument is given then it will check that the current version (as
555defined by the $VERSION variable in the given package) not less than
556NEED; it will die if this is not the case. This method is normally
557called as a class method. This method is called automatically by the
558C<VERSION> form of C<use>.
5f05dabc 559
560 use A 1.2 qw(some imported subs);
71be2cbc 561 # implies:
562 A->VERSION(1.2);
5f05dabc 563
5f05dabc 564=back
565
566B<NOTE:> C<can> directly uses Perl's internal code for method lookup, and
774d564b 567C<isa> uses a very similar method and caching strategy. This may cause
5f05dabc 568strange effects if the Perl code dynamically changes @ISA in any package.
569
570You may add other methods to the UNIVERSAL class via Perl or XS code.
571You do not need to C<use UNIVERSAL> in order to make these methods
572available to your program. This is necessary only if you wish to
573have C<isa> available as a plain subroutine in the current package.
574
54310121 575=head2 TIEHANDLE now supported
5f05dabc 576
774d564b 577See L<perltie> for other kinds of tie()s.
578
5f05dabc 579=over
580
581=item TIEHANDLE classname, LIST
582
583This is the constructor for the class. That means it is expected to
584return an object of some sort. The reference can be used to
585hold some internal information.
586
2ae324a7 587 sub TIEHANDLE {
588 print "<shout>\n";
589 my $i;
774d564b 590 return bless \$i, shift;
591 }
5f05dabc 592
593=item PRINT this, LIST
594
595This method will be triggered every time the tied handle is printed to.
596Beyond its self reference it also expects the list that was passed to
597the print function.
598
2ae324a7 599 sub PRINT {
600 $r = shift;
601 $$r++;
774d564b 602 return print join( $, => map {uc} @_), $\;
603 }
5f05dabc 604
46fc3d4c 605=item PRINTF this, LIST
606
607This method will be triggered every time the tied handle is printed to
608with the C<printf()> function.
609Beyond its self reference it also expects the format and list that was
610passed to the printf function.
611
612 sub PRINTF {
613 shift;
614 my $fmt = shift;
615 print sprintf($fmt, @_)."\n";
616 }
617
2ae324a7 618=item READ this LIST
619
620This method will be called when the handle is read from via the C<read>
621or C<sysread> functions.
622
623 sub READ {
624 $r = shift;
625 my($buf,$len,$offset) = @_;
626 print "READ called, \$buf=$buf, \$len=$len, \$offset=$offset";
627 }
628
5f05dabc 629=item READLINE this
630
631This method will be called when the handle is read from. The method
632should return undef when there is no more data.
633
2ae324a7 634 sub READLINE {
635 $r = shift;
636 return "PRINT called $$r times\n"
774d564b 637 }
5f05dabc 638
2ae324a7 639=item GETC this
640
641This method will be called when the C<getc> function is called.
642
643 sub GETC { print "Don't GETC, Get Perl"; return "a"; }
644
5f05dabc 645=item DESTROY this
646
647As with the other types of ties, this method will be called when the
648tied handle is about to be destroyed. This is useful for debugging and
649possibly for cleaning up.
650
2ae324a7 651 sub DESTROY {
774d564b 652 print "</shout>\n";
653 }
5f05dabc 654
655=back
656
54310121 657=head2 Malloc enhancements
aa689395 658
84902520 659If perl is compiled with the malloc included with the perl distribution
660(that is, if C<perl -V:d_mymalloc> is 'define') then you can print
2ae324a7 661memory statistics at runtime by running Perl thusly:
aa689395 662
663 env PERL_DEBUG_MSTATS=2 perl your_script_here
664
665The value of 2 means to print statistics after compilation and on
84902520 666exit; with a value of 1, the statistics are printed only on exit.
aa689395 667(If you want the statistics at an arbitrary time, you'll need to
668install the optional module Devel::Peek.)
669
84902520 670Three new compilation flags are recognized by malloc.c. (They have no
671effect if perl is compiled with system malloc().)
672
673=over
674
675=item -DPERL_EMERGENCY_SBRK
aa689395 676
677If this macro is defined, running out of memory need not be a fatal
678error: a memory pool can allocated by assigning to the special
679variable C<$^M>. See L<"$^M">.
774d564b 680
aa689395 681=item -DPACK_MALLOC
682
683Perl memory allocation is by bucket with sizes close to powers of two.
684Because of these malloc overhead may be big, especially for data of
685size exactly a power of two. If C<PACK_MALLOC> is defined, perl uses
686a slightly different algorithm for small allocations (up to 64 bytes
687long), which makes it possible to have overhead down to 1 byte for
688allocations which are powers of two (and appear quite often).
689
690Expected memory savings (with 8-byte alignment in C<alignbytes>) is
691about 20% for typical Perl usage. Expected slowdown due to additional
692malloc overhead is in fractions of a percent (hard to measure, because
693of the effect of saved memory on speed).
694
695=item -DTWO_POT_OPTIMIZE
696
697Similarly to C<PACK_MALLOC>, this macro improves allocations of data
698with size close to a power of two; but this works for big allocations
699(starting with 16K by default). Such allocations are typical for big
700hashes and special-purpose scripts, especially image processing.
701
702On recent systems, the fact that perl requires 2M from system for 1M
703allocation will not affect speed of execution, since the tail of such
704a chunk is not going to be touched (and thus will not require real
705memory). However, it may result in a premature out-of-memory error.
706So if you will be manipulating very large blocks with sizes close to
707powers of two, it would be wise to define this macro.
708
709Expected saving of memory is 0-100% (100% in applications which
710require most memory in such 2**n chunks); expected slowdown is
711negligible.
712
713=back
714
54310121 715=head2 Miscellaneous efficiency enhancements
774d564b 716
717Functions that have an empty prototype and that do nothing but return
718a fixed value are now inlined (e.g. C<sub PI () { 3.14159 }>).
719
aa689395 720Each unique hash key is only allocated once, no matter how many hashes
721have an entry with that key. So even if you have 100 copies of the
68dc0745 722same hash, the hash keys never have to be reallocated.
aa689395 723
7bac28a0 724=head1 Support for More Operating Systems
725
726Support for the following operating systems is new in Perl 5.004.
727
728=head2 Win32
729
730Perl 5.004 now includes support for building a "native" perl under
731Windows NT, using the Microsoft Visual C++ compiler (versions 2.0
f7c603cb 732and above) or the Borland C++ compiler (versions 5.02 and above).
733The resulting perl can be used under Windows 95 (if it
7bac28a0 734is installed in the same directory locations as it got installed
735in Windows NT). This port includes support for perl extension
736building tools like L<MakeMaker> and L<h2xs>, so that many extensions
737available on the Comprehensive Perl Archive Network (CPAN) can now be
738readily built under Windows NT. See http://www.perl.com/ for more
739information on CPAN, and L<README.win32> for more details on how to
740get started with building this port.
741
742There is also support for building perl under the Cygwin32 environment.
743Cygwin32 is a set of GNU tools that make it possible to compile and run
744many UNIX programs under Windows NT by providing a mostly UNIX-like
745interface for compilation and execution. See L<README.cygwin32> for
746more details on this port, and how to obtain the Cygwin32 toolkit.
7bac28a0 747
748=head2 Plan 9
749
750See L<README.plan9>.
751
752=head2 QNX
753
754See L<README.qnx>.
755
756=head2 AmigaOS
757
758See L<README.amigaos>.
759
5f05dabc 760=head1 Pragmata
761
54310121 762Six new pragmatic modules exist:
5f05dabc 763
764=over
765
54310121 766=item use autouse MODULE => qw(sub1 sub2 sub3)
767
768Defers C<require MODULE> until someone calls one of the specified
769subroutines (which must be exported by MODULE). This pragma should be
770used with caution, and only when necessary.
771
5f05dabc 772=item use blib
773
774d564b 774=item use blib 'dir'
775
5f05dabc 776Looks for MakeMaker-like I<'blib'> directory structure starting in
777I<dir> (or current directory) and working back up to five levels of
778parent directories.
779
780Intended for use on command line with B<-M> option as a way of testing
781arbitrary scripts against an uninstalled version of a package.
782
54310121 783=item use constant NAME => VALUE
784
785Provides a convenient interface for creating compile-time constants,
786See L<perlsub/"Constant Functions">.
787
5f05dabc 788=item use locale
789
790Tells the compiler to enable (or disable) the use of POSIX locales for
54310121 791builtin operations.
5f05dabc 792
793When C<use locale> is in effect, the current LC_CTYPE locale is used
794for regular expressions and case mapping; LC_COLLATE for string
795ordering; and LC_NUMERIC for numeric formating in printf and sprintf
796(but B<not> in print). LC_NUMERIC is always used in write, since
797lexical scoping of formats is problematic at best.
798
799Each C<use locale> or C<no locale> affects statements to the end of
800the enclosing BLOCK or, if not inside a BLOCK, to the end of the
801current file. Locales can be switched and queried with
802POSIX::setlocale().
803
804See L<perllocale> for more information.
805
806=item use ops
807
7cfe7857 808Disable unsafe opcodes, or any named opcodes, when compiling Perl code.
5f05dabc 809
ff0cee69 810=item use vmsish
811
812Enable VMS-specific language features. Currently, there are three
aa689395 813VMS-specific features available: 'status', which makes C<$?> and
ff0cee69 814C<system> return genuine VMS status values instead of emulating POSIX;
815'exit', which makes C<exit> take a genuine VMS status value instead of
816assuming that C<exit 1> is an error; and 'time', which makes all times
817relative to the local time zone, in the VMS tradition.
818
5f05dabc 819=back
820
821=head1 Modules
822
5cd24f17 823=head2 Required Updates
824
825Though Perl 5.004 is compatible with almost all modules that work
826with Perl 5.003, there are a few exceptions:
827
828 Module Required Version for Perl 5.004
829 ------ -------------------------------
137443ea 830 Filter Filter-1.12
831 LWP libwww-perl-5.08
5cd24f17 832 Tk Tk400.202 (-w makes noise)
833
137443ea 834Also, the majordomo mailing list program, version 1.94.1, doesn't work
835with Perl 5.004 (nor with perl 4), because it executes an invalid
836regular expression. This bug is fixed in majordomo version 1.94.2.
837
54310121 838=head2 Installation directories
f86702cc 839
840The I<installperl> script now places the Perl source files for
841extensions in the architecture-specific library directory, which is
842where the shared libraries for extensions have always been. This
843change is intended to allow administrators to keep the Perl 5.004
844library directory unchanged from a previous version, without running
845the risk of binary incompatibility between extensions' Perl source and
846shared libraries.
847
54310121 848=head2 Module information summary
5f05dabc 849
774d564b 850Brand new modules, arranged by topic rather than strictly
851alphabetically:
852
137443ea 853 CGI.pm Web server interface ("Common Gateway Interface")
854 CGI/Apache.pm Support for Apache's Perl module
855 CGI/Carp.pm Log server errors with helpful context
856 CGI/Fast.pm Support for FastCGI (persistent server process)
857 CGI/Push.pm Support for server push
858 CGI/Switch.pm Simple interface for multiple server types
859
860 CPAN Interface to Comprehensive Perl Archive Network
861 CPAN::FirstTime Utility for creating CPAN configuration file
862 CPAN::Nox Runs CPAN while avoiding compiled extensions
5f05dabc 863
864 IO.pm Top-level interface to IO::* classes
865 IO/File.pm IO::File extension Perl module
866 IO/Handle.pm IO::Handle extension Perl module
867 IO/Pipe.pm IO::Pipe extension Perl module
868 IO/Seekable.pm IO::Seekable extension Perl module
869 IO/Select.pm IO::Select extension Perl module
870 IO/Socket.pm IO::Socket extension Perl module
871
872 Opcode.pm Disable named opcodes when compiling Perl code
873
874 ExtUtils/Embed.pm Utilities for embedding Perl in C programs
875 ExtUtils/testlib.pm Fixes up @INC to use just-built extension
876
5f05dabc 877 FindBin.pm Find path of currently executing program
878
8cc95fdb 879 Class/Struct.pm Declare struct-like datatypes as Perl classes
46fc3d4c 880 File/stat.pm By-name interface to Perl's builtin stat
881 Net/hostent.pm By-name interface to Perl's builtin gethost*
882 Net/netent.pm By-name interface to Perl's builtin getnet*
883 Net/protoent.pm By-name interface to Perl's builtin getproto*
884 Net/servent.pm By-name interface to Perl's builtin getserv*
885 Time/gmtime.pm By-name interface to Perl's builtin gmtime
886 Time/localtime.pm By-name interface to Perl's builtin localtime
8cc95fdb 887 Time/tm.pm Internal object for Time::{gm,local}time
46fc3d4c 888 User/grent.pm By-name interface to Perl's builtin getgr*
889 User/pwent.pm By-name interface to Perl's builtin getpw*
5f05dabc 890
774d564b 891 Tie/RefHash.pm Base class for tied hashes with references as keys
7a4c00b4 892
5f05dabc 893 UNIVERSAL.pm Base class for *ALL* classes
894
54310121 895=head2 Fcntl
896
897New constants in the existing Fcntl modules are now supported,
898provided that your operating system happens to support them:
899
900 F_GETOWN F_SETOWN
901 O_ASYNC O_DEFER O_DSYNC O_FSYNC O_SYNC
902 O_EXLOCK O_SHLOCK
903
904These constants are intended for use with the Perl operators sysopen()
905and fcntl() and the basic database modules like SDBM_File. For the
906exact meaning of these and other Fcntl constants please refer to your
907operating system's documentation for fcntl() and open().
908
909In addition, the Fcntl module now provides these constants for use
910with the Perl operator flock():
911
912 LOCK_SH LOCK_EX LOCK_NB LOCK_UN
913
914These constants are defined in all environments (because where there is
915no flock() system call, Perl emulates it). However, for historical
916reasons, these constants are not exported unless they are explicitly
917requested with the ":flock" tag (e.g. C<use Fcntl ':flock'>).
918
5f05dabc 919=head2 IO
920
921The IO module provides a simple mechanism to load all of the IO modules at one
922go. Currently this includes:
923
924 IO::Handle
925 IO::Seekable
926 IO::File
927 IO::Pipe
928 IO::Socket
929
930For more information on any of these modules, please see its
931respective documentation.
932
933=head2 Math::Complex
934
935The Math::Complex module has been totally rewritten, and now supports
936more operations. These are overloaded:
937
938 + - * / ** <=> neg ~ abs sqrt exp log sin cos atan2 "" (stringify)
939
940And these functions are now exported:
941
942 pi i Re Im arg
5cd24f17 943 log10 logn ln cbrt root
944 tan
945 csc sec cot
946 asin acos atan
947 acsc asec acot
948 sinh cosh tanh
949 csch sech coth
950 asinh acosh atanh
951 acsch asech acoth
5f05dabc 952 cplx cplxe
953
5aabfad6 954=head2 Math::Trig
955
5cd24f17 956This new module provides a simpler interface to parts of Math::Complex for
5aabfad6 957those who need trigonometric functions only for real numbers.
958
0a753a76 959=head2 DB_File
960
961There have been quite a few changes made to DB_File. Here are a few of
962the highlights:
963
964=over
965
966=item *
967
968Fixed a handful of bugs.
969
970=item *
971
972By public demand, added support for the standard hash function exists().
973
974=item *
975
976Made it compatible with Berkeley DB 1.86.
977
978=item *
979
980Made negative subscripts work with RECNO interface.
981
982=item *
983
984Changed the default flags from O_RDWR to O_CREAT|O_RDWR and the default
985mode from 0640 to 0666.
986
987=item *
988
989Made DB_File automatically import the open() constants (O_RDWR,
990O_CREAT etc.) from Fcntl, if available.
991
992=item *
993
994Updated documentation.
995
996=back
997
998Refer to the HISTORY section in DB_File.pm for a complete list of
999changes. Everything after DB_File 1.01 has been added since 5.003.
1000
1001=head2 Net::Ping
1002
1003Major rewrite - support added for both udp echo and real icmp pings.
1004
54310121 1005=head2 Object-oriented overrides for builtin operators
5f05dabc 1006
54310121 1007Many of the Perl builtins returning lists now have
5f05dabc 1008object-oriented overrides. These are:
1009
1010 File::stat
1011 Net::hostent
1012 Net::netent
1013 Net::protoent
1014 Net::servent
1015 Time::gmtime
1016 Time::localtime
1017 User::grent
1018 User::pwent
1019
1020For example, you can now say
1021
1022 use File::stat;
1023 use User::pwent;
1024 $his = (stat($filename)->st_uid == pwent($whoever)->pw_uid);
1025
774d564b 1026=head1 Utility Changes
5f05dabc 1027
7bac28a0 1028=head2 pod2html
1029
1030=over
1031
1032=item Sends converted HTML to standard output
1033
1034The I<pod2html> utility included with Perl 5.004 is entirely new.
1035By default, it sends the converted HTML to its standard output,
1036instead of writing it to a file like Perl 5.003's I<pod2html> did.
1037Use the B<--outfile=FILENAME> option to write to a file.
1038
1039=back
1040
774d564b 1041=head2 xsubpp
5f05dabc 1042
0a753a76 1043=over
1044
774d564b 1045=item C<void> XSUBs now default to returning nothing
1046
1047Due to a documentation/implementation bug in previous versions of
1048Perl, XSUBs with a return type of C<void> have actually been
1049returning one value. Usually that value was the GV for the XSUB,
1050but sometimes it was some already freed or reused value, which would
1051sometimes lead to program failure.
1052
1053In Perl 5.004, if an XSUB is declared as returning C<void>, it
1054actually returns no value, i.e. an empty list (though there is a
1055backward-compatibility exception; see below). If your XSUB really
1056does return an SV, you should give it a return type of C<SV *>.
1057
1058For backward compatibility, I<xsubpp> tries to guess whether a
1059C<void> XSUB is really C<void> or if it wants to return an C<SV *>.
1060It does so by examining the text of the XSUB: if I<xsubpp> finds
1061what looks like an assignment to C<ST(0)>, it assumes that the
1062XSUB's return type is really C<SV *>.
5f05dabc 1063
0a753a76 1064=back
1065
1066=head1 C Language API Changes
1067
1068=over
1069
1070=item C<gv_fetchmethod> and C<perl_call_sv>
1071
1072The C<gv_fetchmethod> function finds a method for an object, just like
1073in Perl 5.003. The GV it returns may be a method cache entry.
1074However, in Perl 5.004, method cache entries are not visible to users;
1075therefore, they can no longer be passed directly to C<perl_call_sv>.
1076Instead, you should use the C<GvCV> macro on the GV to extract its CV,
1077and pass the CV to C<perl_call_sv>.
1078
1079The most likely symptom of passing the result of C<gv_fetchmethod> to
1080C<perl_call_sv> is Perl's producing an "Undefined subroutine called"
1081error on the I<second> call to a given method (since there is no cache
1082on the first call).
1083
137443ea 1084=item C<perl_eval_pv>
1085
8903cb82 1086A new function handy for eval'ing strings of Perl code inside C code.
137443ea 1087This function returns the value from the eval statement, which can
1088be used instead of fetching globals from the symbol table. See
1089L<perlguts>, L<perlembed> and L<perlcall> for details and examples.
1090
1e422769 1091=item Extended API for manipulating hashes
1092
1093Internal handling of hash keys has changed. The old hashtable API is
1094still fully supported, and will likely remain so. The additions to the
1095API allow passing keys as C<SV*>s, so that C<tied> hashes can be given
54310121 1096real scalars as keys rather than plain strings (nontied hashes still
1e422769 1097can only use strings as keys). New extensions must use the new hash
1098access functions and macros if they wish to use C<SV*> keys. These
1099additions also make it feasible to manipulate C<HE*>s (hash entries),
1100which can be more efficient. See L<perlguts> for details.
1101
0a753a76 1102=back
1103
5f05dabc 1104=head1 Documentation Changes
1105
1106Many of the base and library pods were updated. These
1107new pods are included in section 1:
1108
0a753a76 1109=over
5f05dabc 1110
774d564b 1111=item L<perldelta>
5f05dabc 1112
71be2cbc 1113This document.
5f05dabc 1114
c90c0ff4 1115=item L<perlfaq>
1116
1117Frequently asked questions.
1118
71be2cbc 1119=item L<perllocale>
5f05dabc 1120
71be2cbc 1121Locale support (internationalization and localization).
5f05dabc 1122
1123=item L<perltoot>
1124
1125Tutorial on Perl OO programming.
1126
71be2cbc 1127=item L<perlapio>
1128
1129Perl internal IO abstraction interface.
1130
c90c0ff4 1131=item L<perlmodlib>
1132
1133Perl module library and recommended practice for module creation.
1134Extracted from L<perlmod> (which is much smaller as a result).
1135
5f05dabc 1136=item L<perldebug>
1137
1138Although not new, this has been massively updated.
1139
1140=item L<perlsec>
1141
1142Although not new, this has been massively updated.
1143
1144=back
1145
1146=head1 New Diagnostics
1147
1148Several new conditions will trigger warnings that were
1149silent before. Some only affect certain platforms.
2ae324a7 1150The following new warnings and errors outline these.
774d564b 1151These messages are classified as follows (listed in
1152increasing order of desperation):
1153
1154 (W) A warning (optional).
1155 (D) A deprecation (optional).
1156 (S) A severe warning (mandatory).
1157 (F) A fatal error (trappable).
1158 (P) An internal error you should never see (trappable).
54310121 1159 (X) A very fatal error (nontrappable).
774d564b 1160 (A) An alien error message (not generated by Perl).
5f05dabc 1161
0a753a76 1162=over
5f05dabc 1163
1164=item "my" variable %s masks earlier declaration in same scope
1165
fb73857a 1166(W) A lexical variable has been redeclared in the same scope, effectively
5f05dabc 1167eliminating all access to the previous instance. This is almost always
1168a typographical error. Note that the earlier variable will still exist
1169until the end of the scope or until all closure referents to it are
1170destroyed.
1171
774d564b 1172=item %s argument is not a HASH element or slice
1173
1174(F) The argument to delete() must be either a hash element, such as
1175
1176 $foo{$bar}
1177 $ref->[12]->{"susie"}
1178
1179or a hash slice, such as
1180
1181 @foo{$bar, $baz, $xyzzy}
1182 @{$ref->[12]}{"susie", "queue"}
1183
5f05dabc 1184=item Allocation too large: %lx
1185
54310121 1186(X) You can't allocate more than 64K on an MS-DOS machine.
5f05dabc 1187
1188=item Allocation too large
1189
1190(F) You can't allocate more than 2^31+"small amount" bytes.
1191
54310121 1192=item Applying %s to %s will act on scalar(%s)
1193
1194(W) The pattern match (//), substitution (s///), and translation (tr///)
1195operators work on scalar values. If you apply one of them to an array
1196or a hash, it will convert the array or hash to a scalar value -- the
1197length of an array, or the population info of a hash -- and then work on
1198that scalar value. This is probably not what you meant to do. See
1199L<perlfunc/grep> and L<perlfunc/map> for alternatives.
1200
1201=item Attempt to free nonexistent shared string
5f05dabc 1202
1203(P) Perl maintains a reference counted internal table of strings to
1204optimize the storage and access of hash keys and other strings. This
1205indicates someone tried to decrement the reference count of a string
1206that can no longer be found in the table.
1207
1208=item Attempt to use reference as lvalue in substr
1209
1210(W) You supplied a reference as the first argument to substr() used
1211as an lvalue, which is pretty strange. Perhaps you forgot to
1212dereference it first. See L<perlfunc/substr>.
1213
7bac28a0 1214=item Can't redefine active sort subroutine %s
1215
1216(F) Perl optimizes the internal handling of sort subroutines and keeps
1217pointers into them. You tried to redefine one such sort subroutine when it
1218was currently active, which is not allowed. If you really want to do
1219this, you should write C<sort { &func } @x> instead of C<sort func @x>.
1220
774d564b 1221=item Can't use bareword ("%s") as %s ref while "strict refs" in use
1222
1223(F) Only hard references are allowed by "strict refs". Symbolic references
1224are disallowed. See L<perlref>.
1225
54310121 1226=item Cannot resolve method `%s' overloading `%s' in package `%s'
1227
1228(P) Internal error trying to resolve overloading specified by a method
1229name (as opposed to a subroutine reference).
1230
774d564b 1231=item Constant subroutine %s redefined
1232
1233(S) You redefined a subroutine which had previously been eligible for
dc848c6f 1234inlining. See L<perlsub/"Constant Functions"> for commentary and
54310121 1235workarounds.
1236
1237=item Constant subroutine %s undefined
1238
1239(S) You undefined a subroutine which had previously been eligible for
774d564b 1240inlining. See L<perlsub/"Constant Functions"> for commentary and
1241workarounds.
1242
54310121 1243=item Copy method did not return a reference
1244
1245(F) The method which overloads "=" is buggy. See L<overload/Copy Constructor>.
1246
774d564b 1247=item Died
1248
1249(F) You passed die() an empty string (the equivalent of C<die "">) or
1250you called it with no args and both C<$@> and C<$_> were empty.
1251
54310121 1252=item Exiting pseudo-block via %s
1253
1254(W) You are exiting a rather special block construct (like a sort block or
1255subroutine) by unconventional means, such as a goto, or a loop control
1256statement. See L<perlfunc/sort>.
1257
8903cb82 1258=item Identifier too long
1259
1260(F) Perl limits identifiers (names for variables, functions, etc.) to
1261252 characters for simple names, somewhat more for compound names (like
1262C<$A::B>). You've exceeded Perl's limits. Future versions of Perl are
1263likely to eliminate these arbitrary limitations.
1264
54310121 1265=item Illegal character %s (carriage return)
1266
1267(F) A carriage return character was found in the input. This is an
1268error, and not a warning, because carriage return characters can break
1269multi-line strings, including here documents (e.g., C<print E<lt>E<lt>EOF;>).
1270
1271=item Illegal switch in PERL5OPT: %s
1272
1273(X) The PERL5OPT environment variable may only be used to set the
1274following switches: B<-[DIMUdmw]>.
1275
5f05dabc 1276=item Integer overflow in hex number
1277
1278(S) The literal hex number you have specified is too big for your
1279architecture. On a 32-bit architecture the largest hex literal is
12800xFFFFFFFF.
1281
1282=item Integer overflow in octal number
1283
1284(S) The literal octal number you have specified is too big for your
1285architecture. On a 32-bit architecture the largest octal literal is
1286037777777777.
1287
5cd24f17 1288=item internal error: glob failed
1289
1290(P) Something went wrong with the external program(s) used for C<glob>
1291and C<E<lt>*.cE<gt>>. This may mean that your csh (C shell) is
1292broken. If so, you should change all of the csh-related variables in
1293config.sh: If you have tcsh, make the variables refer to it as if it
1294were csh (e.g. C<full_csh='/usr/bin/tcsh'>); otherwise, make them all
1295empty (except that C<d_csh> should be C<'undef'>) so that Perl will
1296think csh is missing. In either case, after editing config.sh, run
1297C<./Configure -S> and rebuild Perl.
1298
878e08df 1299=item Invalid conversion in %s: "%s"
1300
1301(W) Perl does not understand the given format conversion.
1302See L<perlfunc/sprintf>.
1303
8903cb82 1304=item Invalid type in pack: '%s'
1305
1306(F) The given character is not a valid pack type. See L<perlfunc/pack>.
1307
1308=item Invalid type in unpack: '%s'
1309
1310(F) The given character is not a valid unpack type. See L<perlfunc/unpack>.
1311
774d564b 1312=item Name "%s::%s" used only once: possible typo
1313
1314(W) Typographical errors often show up as unique variable names.
1315If you had a good reason for having a unique name, then just mention
1316it again somehow to suppress the message (the C<use vars> pragma is
1317provided for just this purpose).
1318
5f05dabc 1319=item Null picture in formline
1320
1321(F) The first argument to formline must be a valid format picture
1322specification. It was found to be empty, which probably means you
1323supplied it an uninitialized value. See L<perlform>.
1324
1325=item Offset outside string
1326
1327(F) You tried to do a read/write/send/recv operation with an offset
1328pointing outside the buffer. This is difficult to imagine.
1329The sole exception to this is that C<sysread()>ing past the buffer
1330will extend the buffer and zero pad the new area.
1331
1332=item Out of memory!
1333
1334(X|F) The malloc() function returned 0, indicating there was insufficient
1335remaining memory (or virtual memory) to satisfy the request.
1336
1337The request was judged to be small, so the possibility to trap it
1338depends on the way Perl was compiled. By default it is not trappable.
1339However, if compiled for this, Perl may use the contents of C<$^M> as
1340an emergency pool after die()ing with this message. In this case the
1341error is trappable I<once>.
1342
1343=item Out of memory during request for %s
1344
1345(F) The malloc() function returned 0, indicating there was insufficient
1346remaining memory (or virtual memory) to satisfy the request. However,
1347the request was judged large enough (compile-time default is 64K), so
1348a possibility to shut down by trapping this error is granted.
1349
878e08df 1350=item panic: frexp
1351
1352(P) The library function frexp() failed, making printf("%f") impossible.
1353
5f05dabc 1354=item Possible attempt to put comments in qw() list
1355
774d564b 1356(W) qw() lists contain items separated by whitespace; as with literal
1357strings, comment characters are not ignored, but are instead treated
1358as literal data. (You may have used different delimiters than the
1359exclamation marks parentheses shown here; braces are also frequently
1360used.)
1361
1362You probably wrote something like this:
5f05dabc 1363
2ae324a7 1364 @list = qw(
774d564b 1365 a # a comment
5f05dabc 1366 b # another comment
774d564b 1367 );
5f05dabc 1368
1369when you should have written this:
1370
774d564b 1371 @list = qw(
2ae324a7 1372 a
5f05dabc 1373 b
774d564b 1374 );
1375
1376If you really want comments, build your list the
1377old-fashioned way, with quotes and commas:
1378
1379 @list = (
1380 'a', # a comment
1381 'b', # another comment
1382 );
5f05dabc 1383
1384=item Possible attempt to separate words with commas
1385
774d564b 1386(W) qw() lists contain items separated by whitespace; therefore commas
1387aren't needed to separate the items. (You may have used different
1388delimiters than the parentheses shown here; braces are also frequently
1389used.)
5f05dabc 1390
2ae324a7 1391You probably wrote something like this:
5f05dabc 1392
774d564b 1393 qw! a, b, c !;
1394
1395which puts literal commas into some of the list items. Write it without
1396commas if you don't want them to appear in your data:
1397
1398 qw! a b c !;
5f05dabc 1399
774d564b 1400=item Scalar value @%s{%s} better written as $%s{%s}
1401
1402(W) You've used a hash slice (indicated by @) to select a single element of
1403a hash. Generally it's better to ask for a scalar value (indicated by $).
1404The difference is that C<$foo{&bar}> always behaves like a scalar, both when
1405assigning to it and when evaluating its argument, while C<@foo{&bar}> behaves
1406like a list when you assign to it, and provides a list context to its
1407subscript, which can do weird things if you're expecting only one subscript.
5f05dabc 1408
54310121 1409=item Stub found while resolving method `%s' overloading `%s' in package `%s'
1410
1411(P) Overloading resolution over @ISA tree may be broken by importing stubs.
1412Stubs should never be implicitely created, but explicit calls to C<can>
1413may break this.
1414
1415=item Too late for "B<-T>" option
1416
1417(X) The #! line (or local equivalent) in a Perl script contains the
1418B<-T> option, but Perl was not invoked with B<-T> in its argument
1419list. This is an error because, by the time Perl discovers a B<-T> in
1420a script, it's too late to properly taint everything from the
1421environment. So Perl gives up.
1422
5f05dabc 1423=item untie attempted while %d inner references still exist
1424
1425(W) A copy of the object returned from C<tie> (or C<tied>) was still
1426valid when C<untie> was called.
1427
54310121 1428=item Unrecognized character %s
1429
1430(F) The Perl parser has no idea what to do with the specified character
1431in your Perl script (or eval). Perhaps you tried to run a compressed
1432script, a binary program, or a directory as a Perl program.
1433
1434=item Unsupported function fork
1435
1436(F) Your version of executable does not support forking.
1437
1438Note that under some systems, like OS/2, there may be different flavors of
1439Perl executables, some of which may support fork, some not. Try changing
1440the name you call Perl by to C<perl_>, C<perl__>, and so on.
1441
5cd24f17 1442=item Use of "$$<digit>" to mean "${$}<digit>" is deprecated
1443
1444(D) Perl versions before 5.004 misinterpreted any type marker followed
1445by "$" and a digit. For example, "$$0" was incorrectly taken to mean
1446"${$}0" instead of "${$0}". This bug is (mostly) fixed in Perl 5.004.
1447
1448However, the developers of Perl 5.004 could not fix this bug completely,
1449because at least two widely-used modules depend on the old meaning of
1450"$$0" in a string. So Perl 5.004 still interprets "$$<digit>" in the
1451old (broken) way inside strings; but it generates this message as a
1452warning. And in Perl 5.005, this special treatment will cease.
1453
54310121 1454=item Value of %s can be "0"; test with defined()
774d564b 1455
54310121 1456(W) In a conditional expression, you used <HANDLE>, <*> (glob), C<each()>,
1457or C<readdir()> as a boolean value. Each of these constructs can return a
1458value of "0"; that would make the conditional expression false, which is
1459probably not what you intended. When using these constructs in conditional
1460expressions, test their values with the C<defined> operator.
774d564b 1461
1462=item Variable "%s" may be unavailable
1463
1464(W) An inner (nested) I<anonymous> subroutine is inside a I<named>
1465subroutine, and outside that is another subroutine; and the anonymous
1466(innermost) subroutine is referencing a lexical variable defined in
1467the outermost subroutine. For example:
1468
1469 sub outermost { my $a; sub middle { sub { $a } } }
1470
1471If the anonymous subroutine is called or referenced (directly or
1472indirectly) from the outermost subroutine, it will share the variable
1473as you would expect. But if the anonymous subroutine is called or
1474referenced when the outermost subroutine is not active, it will see
1475the value of the shared variable as it was before and during the
1476*first* call to the outermost subroutine, which is probably not what
1477you want.
1478
1479In these circumstances, it is usually best to make the middle
1480subroutine anonymous, using the C<sub {}> syntax. Perl has specific
1481support for shared variables in nested anonymous subroutines; a named
1482subroutine in between interferes with this feature.
1483
1484=item Variable "%s" will not stay shared
1485
1486(W) An inner (nested) I<named> subroutine is referencing a lexical
1487variable defined in an outer subroutine.
1488
1489When the inner subroutine is called, it will probably see the value of
1490the outer subroutine's variable as it was before and during the
1491*first* call to the outer subroutine; in this case, after the first
1492call to the outer subroutine is complete, the inner and outer
1493subroutines will no longer share a common value for the variable. In
1494other words, the variable will no longer be shared.
1495
1496Furthermore, if the outer subroutine is anonymous and references a
1497lexical variable outside itself, then the outer and inner subroutines
1498will I<never> share the given variable.
1499
1500This problem can usually be solved by making the inner subroutine
1501anonymous, using the C<sub {}> syntax. When inner anonymous subs that
1502reference variables in outer subroutines are called or referenced,
54310121 1503they are automatically rebound to the current values of such
774d564b 1504variables.
1505
1506=item Warning: something's wrong
1507
1508(W) You passed warn() an empty string (the equivalent of C<warn "">) or
1509you called it with no args and C<$_> was empty.
1510
54310121 1511=item Ill-formed logical name |%s| in prime_env_iter
1512
1513(W) A warning peculiar to VMS. A logical name was encountered when preparing
1514to iterate over %ENV which violates the syntactic rules governing logical
1515names. Since it cannot be translated normally, it is skipped, and will not
1516appear in %ENV. This may be a benign occurrence, as some software packages
1517might directly modify logical name tables and introduce nonstandard names,
1518or it may indicate that a logical name table has been corrupted.
1519
774d564b 1520=item Got an error from DosAllocMem
5f05dabc 1521
774d564b 1522(P) An error peculiar to OS/2. Most probably you're using an obsolete
1523version of Perl, and this should not happen anyway.
5f05dabc 1524
1525=item Malformed PERLLIB_PREFIX
1526
dc848c6f 1527(F) An error peculiar to OS/2. PERLLIB_PREFIX should be of the form
5f05dabc 1528
1529 prefix1;prefix2
1530
1531or
1532
1533 prefix1 prefix2
1534
dc848c6f 1535with nonempty prefix1 and prefix2. If C<prefix1> is indeed a prefix
1536of a builtin library search path, prefix2 is substituted. The error
1537may appear if components are not found, or are too long. See
1538"PERLLIB_PREFIX" in F<README.os2>.
5f05dabc 1539
1540=item PERL_SH_DIR too long
1541
1542(F) An error peculiar to OS/2. PERL_SH_DIR is the directory to find the
dc848c6f 1543C<sh>-shell in. See "PERL_SH_DIR" in F<README.os2>.
5f05dabc 1544
1545=item Process terminated by SIG%s
1546
1547(W) This is a standard message issued by OS/2 applications, while *nix
dc848c6f 1548applications die in silence. It is considered a feature of the OS/2
1549port. One can easily disable this by appropriate sighandlers, see
1550L<perlipc/"Signals">. See also "Process terminated by SIGTERM/SIGINT"
1551in F<README.os2>.
5f05dabc 1552
1553=back
1554
1555=head1 BUGS
1556
774d564b 1557If you find what you think is a bug, you might check the headers of
1558recently posted articles in the comp.lang.perl.misc newsgroup.
1559There may also be information at http://www.perl.com/perl/, the Perl
1560Home Page.
5f05dabc 1561
1562If you believe you have an unreported bug, please run the B<perlbug>
9607fc9c 1563program included with your release. Make sure you trim your bug down
1564to a tiny but sufficient test case. Your bug report, along with the
1565output of C<perl -V>, will be sent off to <F<perlbug@perl.com>> to be
1566analysed by the Perl porting team.
5f05dabc 1567
1568=head1 SEE ALSO
1569
1570The F<Changes> file for exhaustive details on what changed.
1571
1572The F<INSTALL> file for how to build Perl. This file has been
1573significantly updated for 5.004, so even veteran users should
1574look through it.
1575
1576The F<README> file for general stuff.
1577
1578The F<Copying> file for copyright information.
1579
1580=head1 HISTORY
1581
1582Constructed by Tom Christiansen, grabbing material with permission
1583from innumerable contributors, with kibitzing by more than a few Perl
1584porters.
1585
c90c0ff4 1586Last update: Wed May 14 11:14:09 EDT 1997