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