1PERL593DELTA(1) Perl Programmers Reference Guide PERL593DELTA(1)
2
3
4
6 perl593delta - what is new for perl v5.9.3
7
9 This document describes differences between the 5.9.2 and the 5.9.3
10 development releases. See perl590delta, perl591delta and perl592delta
11 for the differences between 5.8.0 and 5.9.2.
12
14 Parsing of "-f _"
15 The identifier "_" is now forced to be a bareword after a filetest
16 operator. This solves a number of misparsing issues when a global "_"
17 subroutine is defined.
18
19 "mkdir()"
20 "mkdir()" without arguments now defaults to $_.
21
22 Magic goto and eval
23 The construct "eval { goto &foo }" is now disallowed. (Note that the
24 similar construct, but with "eval("")" instead, was already forbidden.)
25
26 $# has been removed
27 The deprecated $# variable (output format for numbers) has been
28 removed. A new warning, "$# is no longer supported", has been added.
29
30 ":unique"
31 The ":unique" attribute has been made a no-op, since its current
32 implementation was fundamentally flawed and not threadsafe.
33
34 Scoping of the "sort" pragma
35 The "sort" pragma is now lexically scoped. Its effect used to be
36 global.
37
39 The "feature" pragma
40 The "feature" pragma is used to enable new syntax that would break
41 Perl's backwards-compatibility with older releases of the language.
42 It's a lexical pragma, like "strict" or "warnings".
43
44 Currently the following new features are available: "switch" (adds a
45 switch statement), "~~" (adds a Perl 6-like smart match operator),
46 "say" (adds a "say" built-in function), and "err" (adds an "err"
47 keyword). Those features are described below.
48
49 Note that "err" low-precedence defined-or operator used to be enabled
50 by default (although as a weak keyword, meaning that any function would
51 override it). It's now only recognized when explicitly turned on (and
52 is then a regular keyword).
53
54 Those features, and the "feature" pragma itself, have been contributed
55 by Robin Houston.
56
57 Switch and Smart Match operator
58 Perl 5 now has a switch statement. It's available when "use feature
59 'switch'" is in effect. This feature introduces three new keywords,
60 "given", "when", and "default":
61
62 given ($foo) {
63 when (/^abc/) { $abc = 1; }
64 when (/^def/) { $def = 1; }
65 when (/^xyz/) { $xyz = 1; }
66 default { $nothing = 1; }
67 }
68
69 A more complete description of how Perl matches the switch variable
70 against the "when" conditions is given in "Switch statements" in
71 perlsyn.
72
73 This kind of match is called smart match, and it's also possible to use
74 it outside of switch statements, via the new "~~" operator (enabled via
75 the "use feature '~~'" directive). See "Smart matching in detail" in
76 perlsyn.
77
78 "say()"
79 say() is a new built-in, only available when "use feature 'say'" is in
80 effect, that is similar to print(), but that implicitly appends a
81 newline to the printed string. See "say" in perlfunc.
82
83 "CLONE_SKIP()"
84 Perl has now support for the "CLONE_SKIP" special subroutine. Like
85 "CLONE", "CLONE_SKIP" is called once per package; however, it is called
86 just before cloning starts, and in the context of the parent thread. If
87 it returns a true value, then no objects of that class will be cloned.
88 See perlmod for details. (Contributed by Dave Mitchell.)
89
90 "${^CHILD_ERROR_NATIVE}"
91 A new internal variable, "${^CHILD_ERROR_NATIVE}", gives the native
92 status returned by the last pipe close, backtick command, successful
93 call to wait() or waitpid(), or from the system() operator. See perlrun
94 for details. (Contributed by Gisle Aas.)
95
96 Assertions
97 The support for assertions, introduced in perl 5.9.0, has been
98 improved. The syntax for the "-A" command-line switch has changed; it
99 now accepts an optional module name, defaulting to
100 "assertions::activate". See assertions and perlrun. (Contributed by
101 Salvador Fandin~o Garcia.)
102
103 Unicode Character Database 4.1.0
104 The copy of the Unicode Character Database included in Perl 5.9 has
105 been updated to 4.1.0.
106
107 "no VERSION"
108 You can now use "no" followed by a version number to specify that you
109 want to use a version of perl older than the specified one.
110
111 Recursive sort subs
112 You can now use recursive subroutines with sort(), thanks to Robin
113 Houston.
114
115 Effect of pragmas in eval
116 The compile-time value of the "%^H" hint variable can now propagate
117 into eval("")uated code. This makes it more useful to implement lexical
118 pragmas.
119
120 As a side-effect of this, the overloaded-ness of constants now
121 propagates into eval("").
122
123 New -E command-line switch
124 -E is equivalent to -e, but it implicitly enables all optional features
125 (like "use feature ":5.10"").
126
127 "chdir", "chmod" and "chown" on filehandles
128 "chdir", "chmod" and "chown" can now work on filehandles as well as
129 filenames, if the system supports respectively "fchdir", "fchmod" and
130 "fchown", thanks to a patch provided by Gisle Aas.
131
132 OS groups
133 $( and $) now return groups in the order where the OS returns them,
134 thanks to Gisle Aas. This wasn't previously the case.
135
137 New Core Modules
138 · A new pragma, "feature", has been added; see above in "Core
139 Enhancements".
140
141 · "assertions::compat", also available on CPAN, allows the use of
142 assertions on perl versions prior to 5.9.0 (that is the first one
143 to natively support them).
144
145 · "Math::BigInt::FastCalc" is an XS-enabled, and thus faster, version
146 of "Math::BigInt::Calc".
147
148 · "Compress::Zlib" is an interface to the zlib compression library.
149 It comes with a bundled version of zlib, so having a working zlib
150 is not a prerequisite to install it. It's used by "Archive::Tar"
151 (see below).
152
153 · "IO::Zlib" is an "IO::"-style interface to "Compress::Zlib".
154
155 · "Archive::Tar" is a module to manipulate "tar" archives.
156
157 · "Digest::SHA" is a module used to calculate many types of SHA
158 digests, has been included for SHA support in the CPAN module.
159
160 · "ExtUtils::CBuilder" and "ExtUtils::ParseXS" have been added.
161
163 "ptar"
164 "ptar" is a pure perl implementation of "tar", that comes with
165 "Archive::Tar".
166
167 "ptardiff"
168 "ptardiff" is a small script used to generate a diff between the
169 contents of a tar archive and a directory tree. Like "ptar", it comes
170 with "Archive::Tar".
171
172 "shasum"
173 This command-line utility, used to print or to check SHA digests, comes
174 with the new "Digest::SHA" module.
175
176 "h2xs" enhancements
177 "h2xs" implements a new option "--use-xsloader" to force use of
178 "XSLoader" even in backwards compatible modules.
179
180 The handling of authors' names that had apostrophes has been fixed.
181
182 Any enums with negative values are now skipped.
183
184 "perlivp" enhancements
185 "perlivp" no longer checks for *.ph files by default. Use the new "-a"
186 option to run all tests.
187
189 Perl Glossary
190 The perlglossary manpage is a glossary of terms used in the Perl
191 documentation, technical and otherwise, kindly provided by O'Reilly
192 Media, Inc.
193
194 perltodo now lists a rough roadmap to Perl 5.10.
195
197 XS-assisted SWASHGET
198 Some pure-perl code that perl was using to retrieve Unicode properties
199 and transliteration mappings has been reimplemented in XS.
200
201 Constant subroutines
202 The interpreter internals now support a far more memory efficient form
203 of inlineable constants. Storing a reference to a constant value in a
204 symbol table is equivalent to a full typeglob referencing a constant
205 subroutine, but using about 400 bytes less memory. This proxy constant
206 subroutine is automatically upgraded to a real typeglob with subroutine
207 if necessary. The approach taken is analogous to the existing space
208 optimisation for subroutine stub declarations, which are stored as
209 plain scalars in place of the full typeglob.
210
211 Several of the core modules have been converted to use this feature for
212 their system dependent constants - as a result "use POSIX;" now takes
213 about 200K less memory.
214
215 "PERL_DONT_CREATE_GVSV"
216 The new compilation flag "PERL_DONT_CREATE_GVSV", introduced as an
217 option in perl 5.8.8, is turned on by default in perl 5.9.3. It
218 prevents perl from creating an empty scalar with every new typeglob.
219 See perl589delta for details.
220
221 Weak references are cheaper
222 Weak reference creation is now O(1) rather than O(n), courtesy of
223 Nicholas Clark. Weak reference deletion remains O(n), but if deletion
224 only happens at program exit, it may be skipped completely.
225
226 sort() enhancements
227 Salvador Fandin~o provided improvements to reduce the memory usage of
228 "sort" and to speed up some cases.
229
231 Compilation improvements
232 Parallel makes should work properly now, although there may still be
233 problems if "make test" is instructed to run in parallel.
234
235 Building with Borland's compilers on Win32 should work more smoothly.
236 In particular Steve Hay has worked to side step many warnings emitted
237 by their compilers and at least one C compiler internal error.
238
239 Perl extensions on Windows now can be statically built into the Perl
240 DLL, thanks to a work by Vadim Konovalov.
241
242 New Or Improved Platforms
243 Perl is being ported to Symbian OS. See perlsymbian for more
244 information.
245
246 The VMS port has been improved. See perlvms.
247
248 DynaLoader::dl_unload_file() now works on Windows.
249
250 Portability of Perl on various recent compilers on Windows has been
251 improved (Borland C++, Visual C++ 7.0).
252
253 New probes
254 "Configure" will now detect "clearenv" and "unsetenv", thanks to a
255 patch from Alan Burlison. It will also probe for "futimes" (and use it
256 internally if available), and whether "sprintf" correctly returns the
257 length of the formatted string.
258
259 Module auxiliary files
260 README files and changelogs for CPAN modules bundled with perl are no
261 longer installed.
262
264 "defined $$x"
265 "use strict "refs"" was ignoring taking a hard reference in an argument
266 to defined(), as in :
267
268 use strict "refs";
269 my $x = "foo";
270 if (defined $$x) {...}
271
272 This now correctly produces the run-time error "Can't use string as a
273 SCALAR ref while "strict refs" in use". (However, "defined @$foo" and
274 "defined %$foo" are still allowed. Those constructs are discouraged
275 anyway.)
276
277 Calling CORE::require()
278 CORE::require() and CORE::do() were always parsed as require() and do()
279 when they were overridden. This is now fixed.
280
281 Subscripts of slices
282 You can now use a non-arrowed form for chained subscripts after a list
283 slice, like in:
284
285 ({foo => "bar"})[0]{foo}
286
287 This used to be a syntax error; a "->" was required.
288
289 Remove over-optimisation
290 Perl 5.9.2 introduced a change so that assignments of "undef" to a
291 scalar, or of an empty list to an array or a hash, were optimised out.
292 As this could cause problems when "goto" jumps were involved, this
293 change was backed out.
294
295 sprintf() fixes
296 Using the sprintf() function with some formats could lead to a buffer
297 overflow in some specific cases. This has been fixed, along with
298 several other bugs, notably in bounds checking.
299
300 In related fixes, it was possible for badly written code that did not
301 follow the documentation of "Sys::Syslog" to have formatting
302 vulnerabilities. "Sys::Syslog" has been changed to protect people from
303 poor quality third party code.
304
305 no warnings 'category' works correctly with -w
306 Previously when running with warnings enabled globally via "-w",
307 selective disabling of specific warning categories would actually turn
308 off all warnings. This is now fixed; now "no warnings 'io';" will only
309 turn off warnings in the "io" class. Previously it would erroneously
310 turn off all warnings.
311
312 Smaller fixes
313 · "FindBin" now works better with directories where access rights are
314 more restrictive than usual.
315
316 · Several memory leaks in ithreads were closed. Also, ithreads were
317 made less memory-intensive.
318
319 · Trailing spaces are now trimmed from $! and $^E.
320
321 · Operations that require perl to read a process' list of groups,
322 such as reads of $( and $), now dynamically allocate memory rather
323 than using a fixed sized array. The fixed size array could cause C
324 stack exhaustion on systems configured to use large numbers of
325 groups.
326
327 · "PerlIO::scalar" now works better with non-default $/ settings.
328
329 · The "x" repetition operator is now able to operate on "qw//" lists.
330 This used to raise a syntax error.
331
332 · The debugger now traces correctly execution in eval("")uated code
333 that contains #line directives.
334
335 · The value of the "open" pragma is no longer ignored for three-
336 argument opens.
337
338 · Perl will now use the C library calls "unsetenv" and "clearenv" if
339 present to delete keys from %ENV and delete %ENV entirely, thanks
340 to a patch from Alan Burlison.
341
342 More Unicode Fixes
343 · chr() on a negative value now gives "\x{FFFD}", the Unicode
344 replacement character, unless when the "bytes" pragma is in effect,
345 where the low eight bytes of the value are used.
346
347 · Some case insensitive matches between UTF-8 encoded data and 8 bit
348 regexps, and vice versa, could give malformed character warnings.
349 These have been fixed by Dave Mitchell and Yves Orton.
350
351 · "lcfirst" and "ucfirst" could corrupt the string for certain cases
352 where the length UTF-8 encoding of the string in lower case, upper
353 case or title case differed. This was fixed by Nicholas Clark.
354
356 Attempt to set length of freed array
357 This is a new warning, produced in situations like the following one:
358
359 $r = do {my @a; \$#a};
360 $$r = 503;
361
362 Non-string passed as bitmask
363 This is a new warning, produced when number has been passed as a
364 argument to select(), instead of a bitmask.
365
366 # Wrong, will now warn
367 $rin = fileno(STDIN);
368 ($nfound,$timeleft) = select($rout=$rin, undef, undef, $timeout);
369
370 # Should be
371 $rin = '';
372 vec($rin,fileno(STDIN),1) = 1;
373 ($nfound,$timeleft) = select($rout=$rin, undef, undef, $timeout);
374
375 Search pattern not terminated or ternary operator parsed as search pattern
376 This syntax error indicates that the lexer couldn't find the final
377 delimiter of a "?PATTERN?" construct. Mentioning the ternary operator
378 in this error message makes syntax diagnostic easier.
379
380 "%s" variable %s masks earlier declaration
381 This warning is now emitted in more consistent cases; in short, when
382 one of the declarations involved is a "my" variable:
383
384 my $x; my $x; # warns
385 my $x; our $x; # warns
386 our $x; my $x; # warns
387
388 On the other hand, the following:
389
390 our $x; our $x;
391
392 now gives a ""our" variable %s redeclared" warning.
393
394 readdir()/closedir()/etc. attempted on invalid dirhandle
395 These new warnings are now emitted when a dirhandle is used but is
396 either closed or not really a dirhandle.
397
399 In general, the source code of perl has been refactored, tied up, and
400 optimized in many places. Also, memory management and allocation has
401 been improved in a couple of points.
402
403 Andy Lester supplied many improvements to determine which function
404 parameters and local variables could actually be declared "const" to
405 the C compiler. Steve Peters provided new *_set macros and reworked the
406 core to use these rather than assigning to macros in LVALUE context.
407
408 Dave Mitchell improved the lexer debugging output under "-DT".
409
410 A new file, mathoms.c, has been added. It contains functions that are
411 no longer used in the perl core, but that remain available for binary
412 or source compatibility reasons. However, those functions will not be
413 compiled in if you add "-DNO_MATHOMS" in the compiler flags.
414
415 The "AvFLAGS" macro has been removed.
416
417 The "av_*()" functions, used to manipulate arrays, no longer accept
418 null "AV*" parameters.
419
420 B:: modules inheritance changed
421 The inheritance hierarchy of "B::" modules has changed; "B::NV" now
422 inherits from "B::SV" (it used to inherit from "B::IV").
423
425 If you find what you think is a bug, you might check the articles
426 recently posted to the comp.lang.perl.misc newsgroup and the perl bug
427 database at http://bugs.perl.org/ . There may also be information at
428 http://www.perl.org/ , the Perl Home Page.
429
430 If you believe you have an unreported bug, please run the perlbug
431 program included with your release. Be sure to trim your bug down to a
432 tiny but sufficient test case. Your bug report, along with the output
433 of "perl -V", will be sent off to perlbug@perl.org to be analysed by
434 the Perl porting team.
435
437 The Changes file for exhaustive details on what changed.
438
439 The INSTALL file for how to build Perl.
440
441 The README file for general stuff.
442
443 The Artistic and Copying files for copyright information.
444
445
446
447perl v5.10.1 2009-08-11 PERL593DELTA(1)