summaryrefslogtreecommitdiff
path: root/pod/perldelta.pod
blob: 329b1d0a089de4edbc80cc61fbca40f45b9bdf7f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
=head1 NAME

perldelta - what's new for perl5.006 (as of 5.005_56)

=head1 DESCRIPTION

This document describes differences between the 5.005 release and this one.

=head1 Incompatible Changes

=head2 Perl Source Incompatibilities

None known at this time.

=head2 C Source Incompatibilities

=over 4

=item C<PERL_POLLUTE>

Release 5.005 grandfathered old global symbol names by providing preprocessor
macros for extension source compatibility.  As of release 5.006, these
preprocessor definitions are not available by default.  You need to explicitly
compile perl with C<-DPERL_POLLUTE> in order to get these definitions.

=item C<PERL_POLLUTE_MALLOC>

Enabling the use of Perl's malloc in release 5.005 and earlier caused
the namespace of system versions of the malloc family of functions to
be usurped by the Perl versions of these functions, since they used the
same names by default.

Besides causing problems on platforms that do not allow these functions to
be cleanly replaced, this also meant that the system versions could not
be called in programs that used Perl's malloc.  Previous versions of Perl
have allowed this behavior to be suppressed with the HIDEMYMALLOC and
EMBEDMYMALLOC preprocessor definitions.

As of release 5.006, Perl's malloc family of functions have default names
distinct from the system versions.  You need to explicitly compile perl with
C<-DPERL_POLLUTE_MALLOC> in order to get the older behavior.  HIDEMYMALLOC
and EMBEDMYMALLOC have no effect, since the behavior they enabled is now
the default.

Note that these functions do B<not> constitute Perl's memory allocation API.
See L<perlguts/"Memory Allocation"> for further information about that.

=item C<PL_na> and C<dTHR> Issues

The C<PL_na> global is now thread local, so a C<dTHR> declaration is needed
in the scope in which it appears.  XSUBs should handle this automatically,
but if you have used C<PL_na> in support functions, you either need to
change the C<PL_na> to a local variable (which is recommended), or put in
a C<dTHR>.

=back

=head2 Compatible C Source API Changes

=over

=item C<PATCHLEVEL> is now C<PERL_VERSION>

The cpp macros C<PERL_REVISION>, C<PERL_VERSION> and C<PERL_SUBVERSION>
are now available by default from perl.h, and reflect the base revision,
patchlevel and subversion respectively.  C<PERL_REVISION> had no
prior equivalent, while C<PERL_VERSION> and C<PERL_SUBVERSION> were
previously available as C<PATCHLEVEL> and C<SUBVERSION>.

The new names cause less pollution of the cpp namespace, and reflect what
the numbers have come to stand for in common practice.  For compatibility,
the old names are still supported when patchlevel.h is explicitly
included (as required before), so there is no source incompatibility
due to the change.

=back

=head2 Binary Incompatibilities

This release is not binary compatible with the 5.005 release and its
maintenance versions.

=head1 Core Changes

=head2 Unicode and UTF-8 support

Perl can optionally use UTF-8 as its internal representation for character
strings.  The C<use utf8> pragma enables this support in the current lexical
scope.  See L<utf8> for more information.

=head2 Lexically scoped warning categories

You can now control the granularity of warnings emitted by perl at a finer
level using the C<use warning> pragma.  See L<warning> for details.

=head2 Binary numbers supported

Binary numbers are now supported as literals, in s?printf formats, and
C<oct()>:

	$answer = 0b101010;
	printf "The answer is: %b\n", oct("0b101010");

=head2 syswrite() ease-of-use

The length argument of C<syswrite()> is now optional.

=head2 64-bit support

Better 64-bit support -- but full support still a distant goal.  One
must Configure with -Duse64bits to get Configure to probe for the
extent of 64-bit support.  Depending on the platform (hints file) more
or less 64-awareness becomes available.  As of 5.005_54 at least
somewhat 64-bit aware platforms are HP-UX 11 or better, Solaris 2.6 or
better, IRIX 6.2 or better.  Naturally 64-bit platforms like Digital
UNIX and UNICOS also have 64-bit support.

=head2 Better syntax checks on parenthesized unary operators

Expressions such as:

	print defined(&foo,&bar,&baz);
	print uc("foo","bar","baz");
	undef($foo,&bar);

used to be accidentally allowed in earlier versions, and produced 
unpredictable behavior.  Some of them produced ancillary warnings
when used in this way, while others silently did the wrong thing.

The parenthesized forms of most unary operators that expect a single
argument will now ensure that they are not called with more than one
argument, making the above cases syntax errors.  Note that the usual
behavior of:

	print defined &foo, &bar, &baz;
	print uc "foo", "bar", "baz";
	undef $foo, &bar;

remains unchanged.  See L<perlop>.

=head2 Improved C<qw//> operator

The C<qw//> operator is now evaluated at compile time into a true list
instead of being replaced with a run time call to C<split()>.  This
removes the confusing behavior of C<qw//> in scalar context stemming from
the older implementation, which inherited the behavior from split().  

Thus:

    $foo = ($bar) = qw(a b c); print "$foo|$bar\n";

now correctly prints "3|a", instead of "2|a".

=head2 pack() format 'Z' supported

The new format type 'Z' is useful for packing and unpacking null-terminated
strings.  See L<perlfunc/"pack">.

=head2 pack() format modifier '_' supported

The new format type modifer '_' is useful for packing and unpacking
native shorts, ints, and longs.  See L<perlfunc/"pack">.

=head2 $^X variables may now have names longer than one character

Formerly, $^X was synonymous with ${"\cX"}, but $^XY was a syntax
error.  Now variable names that begin with a control character may be
arbitrarily long.  However, for compatibility reasons, these variables
I<must> be written with explicit braces, as C<${^XY}> for example.
C<${^XYZ}> is synonymous with ${"\cXYZ"}. Variable names with more
than one control character, such as C<${^XY^Z}>, are illegal.

The old syntax has not changed.  As before, the `^X' may either be a
literal control-X character or the two character sequence `caret' plus
`X'.  When the braces are omitted, the variable name stops after the
control character.  Thus C<"$^XYZ"> continues to be synonymous with
C<$^X . "YZ"> as before.  

As before, lexical variables may not have names beginning with control
characters.  As before, variables whose names begin with a control
character are always forced to be in package `main'.  These variables
are all reserved for future extensions, except the ones that begin
with C<^_>, which may be used by user programs and will not acquire a
special meaning in any future version of Perl.

=head1 Significant bug fixes

=head2 E<lt>HANDLEE<gt> on empty files

With C<$/> set to C<undef>, slurping an empty file returns a string of
zero length (instead of C<undef>, as it used to) for the first time the
HANDLE is read.  Subsequent reads yield C<undef>.

This means that the following will append "foo" to an empty file (it used
to not do anything before):

    perl -0777 -pi -e 's/^/foo/' empty_file

Note that the behavior of:

    perl -pi -e 's/^/foo/' empty_file

is unchanged (it continues to leave the file empty).

=head1 Supported Platforms

=over 4

=item *

VM/ESA is now supported.

=item *

Siemens BS2000 is now supported under the POSIX Shell.

=item *

The Mach CThreads (NEXTSTEP, OPENSTEP) are now supported by the Thread
extension.

=item *

GNU/Hurd is now supported.

=back

=head1 New tests

=over 4

=item	op/io_const

IO constants (SEEK_*, _IO*).
	
=item	op/io_dir

Directory-related IO methods (new, read, close, rewind, tied delete).

=item	op/io_multihomed

INET sockets with multi-homed hosts.

=item	op/io_poll

IO poll().

=item	op/io_unix

UNIX sockets.

=item	op/filetest

File test operators.

=item	op/lex_assign

Verify operations that access pad objects (lexicals and temporaries).

=back

=head1 Modules and Pragmata

=head2 Modules

=over 4

=item Dumpvalue

Added Dumpvalue module provides screen dumps of Perl data.

=item Benchmark

You can now run tests for I<x> seconds instead of guessing the right
number of tests to run.

=item Fcntl

More Fcntl constants added: F_SETLK64, F_SETLKW64, O_LARGEFILE for
large (more than 4G) file access (the 64-bit support is not yet
working, though, so no need to get overly excited), Free/Net/OpenBSD
locking behaviour flags F_FLOCK, F_POSIX, Linux F_SHLCK, and
O_ACCMODE: the mask of O_RDONLY, O_WRONLY, and O_RDWR.

=item Math::Complex
 
The accessors methods Re, Im, arg, abs, rho, theta, methods can
($z->Re()) now also act as mutators ($z->Re(3)).

=item Math::Trig

A little bit of radial trigonometry (cylindrical and spherical) added,
for example the great circle distance.

=item Time::Local

The timelocal() and timegm() functions used to silently return bogus
results when the date exceeded the machine's integer range.  They
consistently croak() if the date falls in an unsupported range.

=back

=head2 Pragmata

C<use utf8;>, to enable UTF-8 and Unicode support.

Lexical warnings pragma, C<use warning;>, to control optional warnings.

C<use filetest;>, to control the behaviour of filetests (C<-r> C<-w> ...).
Currently only one subpragma implemented, "use filetest 'access';",
that enables the use of access(2) or equivalent to check the
permissions instead of using stat(2) as usual.  This matters
in filesystems where there are ACLs (access control lists), the
stat(2) might lie, while access(2) knows better.

=head1 Utility Changes

Todo.

=head1 Documentation Changes

=over 4

=item perlopentut.pod

A tutorial on using open() effectively.

=item perlreftut.pod

A tutorial that introduces the essentials of references.

=back

=head1 New Diagnostics

=item /%s/: Unrecognized escape \\%c passed through

(W) You used a backslash-character combination which is not recognized
by Perl.  This combination appears in an interpolated variable or a 
C<'>-delimited regular expression.

=item Unrecognized escape \\%c passed through

(W) You used a backslash-character combination which is not recognized
by Perl.

=item Missing command in piped open

(W) You used the C<open(FH, "| command")> or C<open(FH, "command |")>
construction, but the command was missing or blank.

=head1 Obsolete Diagnostics

Todo.

=head1 Configuration Changes

You can use "Configure -Uinstallusrbinperl" which causes installperl
to skip installing perl also as /usr/bin/perl.  This is useful if you
prefer not to modify /usr/bin for some reason or another but harmful
because many scripts assume to find Perl in /usr/bin/perl.

=head1 Configuration Changes

You can use "Configure -Uinstallusrbinperl" which causes installperl
to skip installing perl also as /usr/bin/perl.  This is useful if you
prefer not to modify /usr/bin for some reason or another but harmful
because many scripts assume to find Perl in /usr/bin/perl.

=head1 BUGS

If you find what you think is a bug, you might check the headers of
recently posted articles in the comp.lang.perl.misc newsgroup.
There may also be information at http://www.perl.com/perl/, the Perl
Home Page.

If you believe you have an unreported bug, please run the B<perlbug>
program included with your release.  Make sure you trim your bug down
to a tiny but sufficient test case.  Your bug report, along with the
output of C<perl -V>, will be sent off to <F<perlbug@perl.com>> to be
analysed by the Perl porting team.

=head1 SEE ALSO

The F<Changes> file for exhaustive details on what changed.

The F<INSTALL> file for how to build Perl.

The F<README> file for general stuff.

The F<Artistic> and F<Copying> files for copyright information.

=head1 HISTORY

Written by Gurusamy Sarathy <F<gsar@umich.edu>>, with many contributions
from The Perl Porters.

Send omissions or corrections to <F<perlbug@perl.com>>.

=cut