Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1609 lines
55 KiB

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