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