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