diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-06-27 09:15:27 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-06-27 09:15:40 -0700 |
commit | 598798734f1d8d888ae9ce9a815a9803424db490 (patch) | |
tree | 9c56e882524ab3af13dfe8df0d54276ab13fd517 | |
parent | edc523b277207196dd4e936394910c069687507a (diff) | |
parent | 1ce0c787556e71ef13152c91563bf92f2ac54941 (diff) | |
download | perl-598798734f1d8d888ae9ce9a815a9803424db490.tar.gz |
[Merge] [perl #109408] Documentation that refers to Perl 5 as new
Quoting Brian Fraser:
So.
I more or less went ahead and did this, to some extent. To some other
extent the changes are stylistic, like consistently using v5.x.y instead of
5.x or 5.x.y or whatnot in perlvar (and only in perlvar, so as to avoid
bikeshedding). I also bumped most odd versions, post 5.6, to the next
stable release (so, for example, 5.7.1 became 5.8.0, and 5.9.0 became
5.10.0, but 5.005 is still 5.005).
There's only one big deletion, which was most of perltrap.pod -- It dealt
with traps for Perl 4 programmers migrating to Perl 5. It would be really
swell if someone could update perltrap for their other favorite language of
choice, since right now the document is severely lacking, only dealing with
awk, shell, C/C++, and Perl itself.
There's some stuff that I didn't really know about, so I left it alone,
including all of perlhack(tips)? and perl(re|deb)?guts.
One thing that came up in IRC while I was doing this is that having a table
in perlvar detailing in which version each variable became available would
be really swell. And I know that brian d foy compiled one for string/regex
escapes, which strikes me like a good candidate to get in as well.
-rw-r--r-- | pod/perlcall.pod | 4 | ||||
-rw-r--r-- | pod/perldata.pod | 3 | ||||
-rw-r--r-- | pod/perldsc.pod | 25 | ||||
-rw-r--r-- | pod/perlform.pod | 2 | ||||
-rw-r--r-- | pod/perlfunc.pod | 53 | ||||
-rw-r--r-- | pod/perlipc.pod | 21 | ||||
-rw-r--r-- | pod/perllocale.pod | 7 | ||||
-rw-r--r-- | pod/perlmod.pod | 7 | ||||
-rw-r--r-- | pod/perlop.pod | 13 | ||||
-rw-r--r-- | pod/perlpod.pod | 6 | ||||
-rw-r--r-- | pod/perlport.pod | 21 | ||||
-rw-r--r-- | pod/perlre.pod | 2 | ||||
-rw-r--r-- | pod/perlrebackslash.pod | 2 | ||||
-rw-r--r-- | pod/perlref.pod | 9 | ||||
-rw-r--r-- | pod/perlreftut.pod | 9 | ||||
-rw-r--r-- | pod/perlretut.pod | 12 | ||||
-rw-r--r-- | pod/perlrun.pod | 6 | ||||
-rw-r--r-- | pod/perlsec.pod | 6 | ||||
-rw-r--r-- | pod/perlsub.pod | 7 | ||||
-rw-r--r-- | pod/perlthrtut.pod | 2 | ||||
-rw-r--r-- | pod/perltrap.pod | 1239 | ||||
-rw-r--r-- | pod/perlunicode.pod | 21 | ||||
-rw-r--r-- | pod/perlunifaq.pod | 4 | ||||
-rw-r--r-- | pod/perluniintro.pod | 14 | ||||
-rw-r--r-- | pod/perlutil.pod | 2 | ||||
-rw-r--r-- | pod/perlvar.pod | 76 | ||||
-rw-r--r-- | t/porting/known_pod_issues.dat | 2 |
27 files changed, 139 insertions, 1436 deletions
diff --git a/pod/perlcall.pod b/pod/perlcall.pod index 4c7ffc9fb2..47947631e0 100644 --- a/pod/perlcall.pod +++ b/pod/perlcall.pod @@ -1031,8 +1031,8 @@ Here is a snippet of XSUB which defines I<CallSubPV>. call_pv(name, G_DISCARD|G_NOARGS); That is fine as far as it goes. The thing is, the Perl subroutine -can be specified as only a string. For Perl 4 this was adequate, -but Perl 5 allows references to subroutines and anonymous subroutines. +can be specified as only a string, however, Perl allows references +to subroutines and anonymous subroutines. This is where I<call_sv> is useful. The code below for I<CallSubSV> is identical to I<CallSubPV> except diff --git a/pod/perldata.pod b/pod/perldata.pod index c89b6754be..3a4776c550 100644 --- a/pod/perldata.pod +++ b/pod/perldata.pod @@ -232,8 +232,7 @@ which is a different value since there is ordinarily a 0th element. Assigning to C<$#days> actually changes the length of the array. Shortening an array this way destroys intervening values. Lengthening an array that was previously shortened does not recover values -that were in those elements. (It used to do so in Perl 4, but we -had to break this to make sure destructors were called when expected.) +that were in those elements. X<$#> X<array, length> You can also gain some minuscule measure of efficiency by pre-extending diff --git a/pod/perldsc.pod b/pod/perldsc.pod index b30948c32a..c5f53d8c16 100644 --- a/pod/perldsc.pod +++ b/pod/perldsc.pod @@ -5,19 +5,8 @@ perldsc - Perl Data Structures Cookbook =head1 DESCRIPTION -The single feature most sorely lacking in the Perl programming language -prior to its 5.0 release was complex data structures. Even without direct -language support, some valiant programmers did manage to emulate them, but -it was hard work and not for the faint of heart. You could occasionally -get away with the C<$m{$AoA,$b}> notation borrowed from B<awk> in which the -keys are actually more like a single concatenated string C<"$AoA$b">, but -traversal and sorting were difficult. More desperate programmers even -hacked Perl's internal symbol table directly, a strategy that proved hard -to develop and maintain--to put it mildly. - -The 5.0 release of Perl let us have complex data structures. You -may now write something like this and all of a sudden, you'd have an array -with three dimensions! +Perl lets us have complex data structures. You can write something like +this and all of a sudden, you'd have an array with three dimensions! for $x (1 .. 10) { for $y (1 .. 10) { @@ -309,11 +298,8 @@ X<AoA, debugging> X<HoA, debugging> X<AoH, debugging> X<HoH, debugging> X<array of arrays, debugging> X<hash of arrays, debugging> X<array of hashes, debugging> X<hash of hashes, debugging> -Before version 5.002, the standard Perl debugger didn't do a very nice job of -printing out complex data structures. With 5.002 or above, the -debugger includes several new features, including command line editing as -well as the C<x> command to dump out complex data structures. For -example, given the assignment to $AoA above, here's the debugger output: +You can use the debugger's C<x> command to dump out complex data structures. +For example, given the assignment to $AoA above, here's the debugger output: DB<1> x $AoA $AoA = ARRAY(0x13b5a0) @@ -842,6 +828,3 @@ L<perlref>, L<perllol>, L<perldata>, L<perlobj> =head1 AUTHOR Tom Christiansen <F<tchrist@perl.com>> - -Last update: -Wed Oct 23 04:57:50 MET DST 1996 diff --git a/pod/perlform.pod b/pod/perlform.pod index b00d394296..fc5d02bb07 100644 --- a/pod/perlform.pod +++ b/pod/perlform.pod @@ -440,7 +440,7 @@ SMTP cutoff. Lexical variables (declared with "my") are not visible within a format unless the format is declared within the scope of the lexical -variable. (They weren't visible at all before version 5.001.) +variable. If a program's environment specifies an LC_NUMERIC locale and C<use locale> is in effect when the format is declared, the locale is used diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index f409872036..a3363a78aa 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -480,7 +480,7 @@ Example: print "Text\n" if -T _; print "Binary\n" if -B _; -As of Perl 5.9.1, as a form of purely syntactic sugar, you can stack file +As of Perl 5.10.0, as a form of purely syntactic sugar, you can stack file test operators, in a way that C<-f -w -x $file> is equivalent to C<-x $file && -w _ && -f _>. (This is only fancy fancy: if you use the return value of C<-f $file> as an argument to another filetest @@ -1989,11 +1989,11 @@ program, passing it C<"surprise"> an argument. The second version didn't; it tried to run a program named I<"echo surprise">, didn't find it, and set C<$?> to a non-zero value indicating failure. -Beginning with v5.6.0, Perl attempts to flush all files opened for -output before the exec, but this may not be supported on some platforms -(see L<perlport>). To be safe, you may need to set C<$|> ($AUTOFLUSH -in English) or call the C<autoflush()> method of C<IO::Handle> on any -open handles to avoid lost output. +Perl attempts to flush all files opened for output before the exec, +but this may not be supported on some platforms (see L<perlport>). +To be safe, you may need to set C<$|> ($AUTOFLUSH in English) or +call the C<autoflush()> method of C<IO::Handle> on any open handles +to avoid lost output. Note that C<exec> will not call your C<END> blocks, nor will it invoke C<DESTROY> methods on your objects. @@ -2331,7 +2331,7 @@ fork(), great care has gone into making it extremely efficient (for example, using copy-on-write technology on data pages), making it the dominant paradigm for multitasking over the last few decades. -Beginning with v5.6.0, Perl attempts to flush all files opened for +Perl attempts to flush all files opened for output before forking the child process, but this may not be supported on some platforms (see L<perlport>). To be safe, you may need to set C<$|> ($AUTOFLUSH in English) or call the C<autoflush()> method of @@ -2844,7 +2844,7 @@ each pairing of fruits and colors: @many = glob "{apple,tomato,cherry}={green,yellow,red}"; -Beginning with v5.6.0, this operator is implemented using the standard +This operator is implemented using the standard C<File::Glob> extension. See L<File::Glob> for details, including C<bsd_glob> which does not treat whitespace as a pattern separator. @@ -3935,7 +3935,7 @@ works for symmetry, but you really should consider writing something to the temporary file first. You will need to seek() to do the reading. -Since v5.8.0, Perl has built using PerlIO by default. Unless you've +Perl is built using PerlIO by default; Unless you've changed this (such as building Perl with C<Configure -Uuseperlio>), you can open filehandles directly to Perl scalars via: @@ -4135,7 +4135,7 @@ that intentionally contain shell metacharacters, such as: See L<perlipc/"Safe Pipe Opens"> for more examples of this. -Beginning with v5.6.0, Perl will attempt to flush all files opened for +Perl will attempt to flush all files opened for output before any operation that may do a fork, but this may not be supported on some platforms (see L<perlport>). To be safe, you may need to set C<$|> ($AUTOFLUSH in English) or call the C<autoflush()> method @@ -4730,7 +4730,7 @@ immediately below. See also L<perlport>. =item * -Starting with Perl 5.9.2, integer and floating-point formats, along with +Starting with Perl 5.10.0, integer and floating-point formats, along with the C<p> and C<P> formats and C<()> groups, may all be followed by the C<< > >> or C<< < >> endianness modifiers to respectively enforce big- or little-endian byte-order. These modifiers are especially useful @@ -5407,7 +5407,7 @@ C<chdir> there, it would have been testing the wrong file. @dots = grep { /^\./ && -f "$some_dir/$_" } readdir($dh); closedir $dh; -As of Perl 5.11.2 you can use a bare C<readdir> in a C<while> loop, +As of Perl 5.12 you can use a bare C<readdir> in a C<while> loop, which will set C<$_> on every iteration. opendir(my $dh, $some_dir) || die; @@ -7257,12 +7257,8 @@ of a recent vintage: use 5.014; # so srand returns the seed If C<srand()> is not called explicitly, it is called implicitly without a -parameter at the first use of the C<rand> operator. However, this was not true -of versions of Perl before 5.004, so if your script will run under older -Perl versions, it should call C<srand>; otherwise most programs won't call -C<srand()> at all. - -But there are a few situations in recent Perls where programs are likely to +parameter at the first use of the C<rand> operator. +However, there are a few situations where programs are likely to want to call C<srand>. One is for generating predictable results, generally for testing or debugging. There, you use C<srand($seed)>, with the same C<$seed> each time. Another case is that you may want to call C<srand()> @@ -7279,21 +7275,6 @@ truncate decimal numbers. This means C<srand(42)> will usually produce the same results as C<srand(42.1)>. To be safe, always pass C<srand> an integer. -In versions of Perl prior to 5.004 the default seed was just the -current C<time>. This isn't a particularly good seed, so many old -programs supply their own seed value (often C<time ^ $$> or C<time ^ -($$ + ($$ << 15))>), but that isn't necessary any more. - -Frequently called programs (like CGI scripts) that simply use - - time ^ $$ - -for a seed can fall prey to the mathematical property that - - a^b == (a+1)^(b+1) - -one-third of the time. So don't do that. - A typical use of the returned seed is for a test program which has too many combinations to test comprehensively in the time available to it each run. It can test a random subset each time, and should there be a failure, log the seed @@ -7843,7 +7824,7 @@ platforms). If there are no shell metacharacters in the argument, it is split into words and passed directly to C<execvp>, which is more efficient. -Beginning with v5.6.0, Perl will attempt to flush all files opened for +Perl will attempt to flush all files opened for output before any operation that may do a fork, but this may not be supported on some platforms (see L<perlport>). To be safe, you may need to set C<$|> ($AUTOFLUSH in English) or call the C<autoflush()> method @@ -8419,7 +8400,7 @@ C<use VERSION> also enables all features available in the requested version as defined by the C<feature> pragma, disabling any features not in the requested version's feature bundle. See L<feature>. Similarly, if the specified Perl version is greater than or equal to -5.11.0, strictures are enabled lexically as +5.12.0, strictures are enabled lexically as with C<use strict>. Any explicit use of C<use strict> or C<no strict> overrides C<use VERSION>, even if it comes before it. In both cases, the F<feature.pm> and F<strict.pm> files are @@ -8516,7 +8497,7 @@ the user running the program: $atime = $mtime = time; utime $atime, $mtime, @ARGV; -Since Perl 5.7.2, if the first two elements of the list are C<undef>, +Since Perl 5.8.0, if the first two elements of the list are C<undef>, the utime(2) syscall from your C library is called with a null second argument. On most systems, this will set the file's access and modification times to the current time (i.e., equivalent to the example diff --git a/pod/perlipc.pod b/pod/perlipc.pod index a9c2dda964..854ffa2a34 100644 --- a/pod/perlipc.pod +++ b/pod/perlipc.pod @@ -31,7 +31,7 @@ For example, to trap an interrupt signal, set up a handler like this: $SIG{INT} = __PACKAGE__ . "::catch_zap"; $SIG{INT} = \&catch_zap; # best strategy -Prior to Perl 5.7.3 it was necessary to do as little as you possibly +Prior to Perl 5.8.0 it was necessary to do as little as you possibly could in your handler; notice how all we do is set a global variable and then raise an exception. That's because on most systems, libraries are not re-entrant; particularly, memory allocation and I/O @@ -224,7 +224,7 @@ info to show that it works; it should be replaced with the real code. =head2 Deferred Signals (Safe Signals) -Before Perl 5.7.3, installing Perl code to deal with signals exposed you to +Before Perl 5.8.0, installing Perl code to deal with signals exposed you to danger from two things. First, few system library functions are re-entrant. If the signal interrupts while Perl is executing one function (like malloc(3) or printf(3)), and your signal handler then calls the same @@ -244,7 +244,7 @@ The pragmatic approach was to say "I know the risks, but prefer the convenience", and to do anything you wanted in your signal handler, and be prepared to clean up core dumps now and again. -Perl 5.7.3 and later avoid these problems by "deferring" signals. That is, +Perl 5.8.0 and later avoid these problems by "deferring" signals. That is, when the signal is delivered to the process by the system (to the C code that implements Perl) a flag is set, and the handler returns immediately. Then at strategic "safe" points in the Perl interpreter (e.g. when it is @@ -293,7 +293,7 @@ that you want to be able to break into with signals. (The C<:perlio> layer checks the signal flags and calls %SIG handlers before resuming IO operation.) -The default in Perl 5.7.3 and later is to automatically use +The default in Perl 5.8.0 and later is to automatically use the C<:perlio> layer. Note that it is not advisable to access a file handle within a signal @@ -328,7 +328,7 @@ On systems that supported it, older versions of Perl used the SA_RESTART flag when installing %SIG handlers. This meant that restartable system calls would continue rather than returning when a signal arrived. In order to deliver deferred signals promptly, -Perl 5.7.3 and later do I<not> use SA_RESTART. Consequently, +Perl 5.8.0 and later do I<not> use SA_RESTART. Consequently, restartable system calls can fail (with $! set to C<EINTR>) in places where they previously would have succeeded. @@ -1096,7 +1096,7 @@ living dead. Within the while loop we call accept() and check to see if it returns a false value. This would normally indicate a system error needs to be reported. However, the introduction of safe signals (see -L</Deferred Signals (Safe Signals)> above) in Perl 5.7.3 means that +L</Deferred Signals (Safe Signals)> above) in Perl 5.8.0 means that accept() might also be interrupted when the process receives a signal. This typically happens when one of the forked subprocesses exits and notifies the parent process with a CHLD signal. @@ -1277,10 +1277,8 @@ as a Unix-domain client and connects to your private server. =head1 TCP Clients with IO::Socket For those preferring a higher-level interface to socket programming, the -IO::Socket module provides an object-oriented approach. IO::Socket has -been included in the standard Perl distribution ever since Perl 5.004. If -you're running an earlier version of Perl (in which case, how are you -reading this manpage?), just fetch IO::Socket from CPAN, where you'll also +IO::Socket module provides an object-oriented approach. If for some reason +you lack this module, you can just fetch IO::Socket from CPAN, where you'll also find modules providing easy interfaces to the following systems: DNS, FTP, Ident (RFC 931), NIS and NISPlus, NNTP, Ping, POP3, SMTP, SNMP, SSLeay, Telnet, and Time--to name just a few. @@ -1748,8 +1746,7 @@ Call this file F<give>: semop($id, $opstring) || die "semop: $!"; The SysV IPC code above was written long ago, and it's definitely -clunky looking. For a more modern look, see the IPC::SysV module -which is included with Perl starting from Perl 5.005. +clunky looking. For a more modern look, see the IPC::SysV module. A small example demonstrating SysV message queues: diff --git a/pod/perllocale.pod b/pod/perllocale.pod index 7ecff029ef..9217eec5f2 100644 --- a/pod/perllocale.pod +++ b/pod/perllocale.pod @@ -22,7 +22,7 @@ these kinds of matters is called B<internationalization> (often abbreviated as B<i18n>); telling such an application about a particular set of preferences is known as B<localization> (B<l10n>). -Perl was extended, starting in 5.004, to support the locale system. This +Perl was extended to support the locale system. This is controlled per application by using one pragma, one function call, and several environment variables. @@ -246,9 +246,6 @@ untrustworthy. See L<"SECURITY">. You can switch locales as often as you wish at run time with the POSIX::setlocale() function: - # This functionality not usable prior to Perl 5.004 - require 5.004; - # Import locale-handling tool set from POSIX module. # This example uses: setlocale -- the function call # LC_CTYPE -- explained below @@ -506,8 +503,6 @@ current locale. Here's a simple-minded example program that rewrites its command-line parameters as integers correctly formatted in the current locale: - # See comments in previous example - require 5.004; use POSIX qw(locale_h); # Get some of locale's numeric formatting parameters diff --git a/pod/perlmod.pod b/pod/perlmod.pod index 9d02c3f70a..7f243fa311 100644 --- a/pod/perlmod.pod +++ b/pod/perlmod.pod @@ -545,15 +545,14 @@ X<threadsafe> X<thread safe> X<module, threadsafe> X<module, thread safe> X<CLONE> X<CLONE_SKIP> X<thread> X<threads> X<ithread> -Since 5.6.0, Perl has had support for a new type of threads called -interpreter threads (ithreads). These threads can be used explicitly -and implicitly. +Perl supports a type of threads called interpreter threads (ithreads). +These threads can be used explicitly and implicitly. Ithreads work by cloning the data tree so that no data is shared between different threads. These threads can be used by using the C<threads> module or by doing fork() on win32 (fake fork() support). When a thread is cloned all Perl data is cloned, however non-Perl data cannot -be cloned automatically. Perl after 5.7.2 has support for the C<CLONE> +be cloned automatically. Perl after 5.8.0 has support for the C<CLONE> special subroutine. In C<CLONE> you can do whatever you need to do, like for example handle the cloning of non-Perl data, if necessary. diff --git a/pod/perlop.pod b/pod/perlop.pod index c9f17a789d..508853a20c 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -1775,11 +1775,10 @@ regex with an C<m> (so C<//> becomes C<m//>). If the C</g> option is not used, C<m//> in list context returns a list consisting of the subexpressions matched by the parentheses in the -pattern, that is, (C<$1>, C<$2>, C<$3>...). (Note that here C<$1> etc. are -also set, and that this differs from Perl 4's behavior.) When there are -no parentheses in the pattern, the return value is the list C<(1)> for -success. With or without parentheses, an empty list is returned upon -failure. +pattern, that is, (C<$1>, C<$2>, C<$3>...) (Note that here C<$1> etc. are +also set). When there are no parentheses in the pattern, the return +value is the list C<(1)> for success. +With or without parentheses, an empty list is returned upon failure. Examples: @@ -2010,7 +2009,7 @@ specific options: Any non-whitespace delimiter may replace the slashes. Add space after the C<s> when using a character allowed in identifiers. If single quotes are used, no interpretation is done on the replacement string (the C</e> -modifier overrides this, however). Unlike Perl 4, Perl 5 treats backticks +modifier overrides this, however). Note that Perl treats backticks as normal delimiters; the replacement text is not evaluated as a command. If the PATTERN is delimited by bracketing quotes, the REPLACEMENT has its own pair of quotes, which may or may not be bracketing quotes, for example, @@ -2201,7 +2200,7 @@ multiple commands in a single line by separating them with the command separator character, if your shell supports that (for example, C<;> on many Unix shells and C<&> on the Windows NT C<cmd> shell). -Beginning with v5.6.0, Perl will attempt to flush all files opened for +Perl will attempt to flush all files opened for output before starting the child process, but this may not be supported on some platforms (see L<perlport>). To be safe, you may need to set C<$|> ($AUTOFLUSH in English) or call the C<autoflush()> method of diff --git a/pod/perlpod.pod b/pod/perlpod.pod index 0491dec1b7..f4c6ccc8a0 100644 --- a/pod/perlpod.pod +++ b/pod/perlpod.pod @@ -98,10 +98,8 @@ heading. For example: =head2 Object Attributes -The text "Object Attributes" comprises the heading there. (Note that -head3 and head4 are recent additions, not supported in older Pod -translators.) The text in these heading commands can use -formatting codes, as seen here: +The text "Object Attributes" comprises the heading there. +The text in these heading commands can use formatting codes, as seen here: =head2 Possible Values for C<$/> diff --git a/pod/perlport.pod b/pod/perlport.pod index 867b66e291..3e50873bed 100644 --- a/pod/perlport.pod +++ b/pod/perlport.pod @@ -212,7 +212,7 @@ them in big-endian mode. To avoid this problem in network (socket) connections use the C<pack> and C<unpack> formats C<n> and C<N>, the "network" orders. These are guaranteed to be portable. -As of perl 5.9.2, you can also use the C<E<gt>> and C<E<lt>> modifiers +As of perl 5.10.0, you can also use the C<E<gt>> and C<E<lt>> modifiers to force big- or little-endian byte-order. This is useful if you want to store signed integers or 64-bit integers, for example. @@ -236,9 +236,9 @@ transferring or storing raw binary numbers. One can circumnavigate both these problems in two ways. Either transfer and store numbers always in text format, instead of raw -binary, or else consider using modules like Data::Dumper (included in -the standard distribution as of Perl 5.005) and Storable (included as -of perl 5.8). Keeping all data as text significantly simplifies matters. +binary, or else consider using modules like Data::Dumper and Storable +(included as of perl 5.8). Keeping all data as text significantly +simplifies matters. The v-strings are portable only up to v2147483647 (0x7FFFFFFF), that's how far EBCDIC, or more precisely UTF-EBCDIC will go. @@ -679,9 +679,8 @@ ISO 8859-1 bytes beyond 0x7f into your strings might cause trouble later. If the bytes are native 8-bit bytes, you can use the C<bytes> pragma. If the bytes are in a string (regular expression being a curious string), you can often also use the C<\xHH> notation instead -of embedding the bytes as-is. (If you want to write your code in UTF-8, -you can use the C<utf8>.) The C<bytes> and C<utf8> pragmata are -available since Perl 5.6.0. +of embedding the bytes as-is. If you want to write your code in UTF-8, +you can use the C<utf8>. =head2 System Resources @@ -777,8 +776,8 @@ Testing results: L<http://www.cpantesters.org/> =head1 PLATFORMS -As of version 5.002, Perl is built with a C<$^O> variable that -indicates the operating system it was built on. This was implemented +Perl is built with a C<$^O> variable that indicates the operating +system it was built on. This was implemented to help speed up code that would otherwise have to C<use Config> and use the value of C<$Config{osname}>. Of course, to get more detailed information about the system, looking into C<%Config> is @@ -1241,7 +1240,7 @@ systems). On the mainframe perl currently works under the "Unix system services for OS/390" (formerly known as OpenEdition), VM/ESA OpenEdition, or the BS200 POSIX-BC system (BS2000 is supported in perl 5.6 and greater). See L<perlos390> for details. Note that for OS/400 there is also a port of -Perl 5.8.1/5.9.0 or later to the PASE which is ASCII-based (as opposed to +Perl 5.8.1/5.10.0 or later to the PASE which is ASCII-based (as opposed to ILE which is EBCDIC-based), see L<perlos400>. As of R2.5 of USS for OS/390 and Version 2.3 of VM/ESA these Unix @@ -2038,7 +2037,7 @@ should not be held open elsewhere. (Win32) =item umask -Returns undef where unavailable, as of version 5.005. +Returns undef where unavailable. C<umask> works but the correct permissions are set only when the file is finally closed. (AmigaOS) diff --git a/pod/perlre.pod b/pod/perlre.pod index 46fa494234..6bb20e7edb 100644 --- a/pod/perlre.pod +++ b/pod/perlre.pod @@ -491,7 +491,7 @@ newline within the string (except if the newline is the last character in the string), and "$" will match before any newline. At the cost of a little more overhead, you can do this by using the /m modifier on the pattern match operator. (Older programs did this by setting C<$*>, -but this option was removed in perl 5.9.) +but this option was removed in perl 5.10.) X<^> X<$> X</m> To simplify multi-line substitutions, the "." character never matches a diff --git a/pod/perlrebackslash.pod b/pod/perlrebackslash.pod index f81af0c6dd..a1e158a625 100644 --- a/pod/perlrebackslash.pod +++ b/pod/perlrebackslash.pod @@ -575,7 +575,7 @@ categories above. These are: C<\C> always matches a single octet, even if the source string is encoded in UTF-8 format, and the character to be matched is a multi-octet character. -C<\C> was introduced in perl 5.6. This is very dangerous, because it violates +This is very dangerous, because it violates the logical character abstraction and can cause UTF-8 sequences to become malformed. Mnemonic: oI<C>tet. diff --git a/pod/perlref.pod b/pod/perlref.pod index 0fab80969a..5f9ce0a06a 100644 --- a/pod/perlref.pod +++ b/pod/perlref.pod @@ -543,7 +543,7 @@ People frequently expect it to work like this. So it does. ${$name x 2} = 3; # Sets $foofoo $name->[0] = 4; # Sets $foo[0] @$name = (); # Clears @foo - &$name(); # Calls &foo() (as in Perl 4) + &$name(); # Calls &foo() $pack = "THAT"; ${"${pack}::$name"} = 5; # Sets $THAT::foo without eval @@ -575,7 +575,7 @@ variables, which are all "global" to the package. =head2 Not-so-symbolic references -Since Perl verion 5.001, brackets around a symbolic reference can simply +Brackets around a symbolic reference can simply serve to isolate an identifier or variable name from the rest of an expression, just as they always have within a string. For example, @@ -583,7 +583,7 @@ expression, just as they always have within a string. For example, print "${push}over"; has always meant to print "pop on over", even though push is -a reserved word. In 5.001, this was generalized to work the same +a reserved word. This is generalized to work the same without the enclosing double quotes, so that print ${push} . "over"; @@ -592,8 +592,7 @@ and even print ${ push } . "over"; -will have the same effect. (This would have been a syntax error in -Perl 5.000, though Perl 4 allowed it in the spaceless form.) This +will have the same effect. This construct is I<not> considered to be a symbolic reference when you're using strict refs: diff --git a/pod/perlreftut.pod b/pod/perlreftut.pod index 9565562711..04db7b4039 100644 --- a/pod/perlreftut.pod +++ b/pod/perlreftut.pod @@ -18,9 +18,9 @@ Fortunately, you only need to know 10% of what's in the main page to get =head1 Who Needs Complicated Data Structures? -One problem that came up all the time in Perl 4 was how to represent a -hash whose values were lists. Perl 4 had hashes, of course, but the -values had to be scalars; they couldn't be lists. +One problem that comes up all the time is needing a hash whose values are +lists. Perl has hashes, of course, but the values have to be scalars; +they can't be lists. Why would you want a hash of lists? Let's take a simple example: You have a file of city and country names, like this: @@ -47,8 +47,7 @@ country, and append the new city to the list. When you're done reading the input, iterate over the hash as usual, sorting each list of cities before you print it out. -If hash values can't be lists, you lose. In Perl 4, hash values can't -be lists; they can only be strings. You lose. You'd probably have to +If hash values couldn't be lists, you lose. You'd probably have to combine all the cities into a single string somehow, and then when time came to write the output, you'd have to break the string into a list, sort the list, and turn it back into a string. This is messy diff --git a/pod/perlretut.pod b/pod/perlretut.pod index 226b0ffba4..bf4ab3bc29 100644 --- a/pod/perlretut.pod +++ b/pod/perlretut.pod @@ -869,7 +869,7 @@ with one higher than the maximum reached across all the alternatives. =head2 Position information -In addition to what was matched, Perl (since 5.6.0) also provides the +In addition to what was matched, Perl also provides the positions of what was matched as contents of the C<@-> and C<@+> arrays. C<$-[0]> is the position of the start of the entire match and C<$+[0]> is the position of the end. Similarly, C<$-[n]> is the @@ -1874,8 +1874,8 @@ work if they appear in a regular expression embedded directly in a program, but not when contained in a string that is interpolated in a pattern. -With the advent of 5.6.0, Perl regexps can handle more than just the -standard ASCII character set. Perl now supports I<Unicode>, a standard +Perl regexps can handle more than just the +standard ASCII character set. Perl supports I<Unicode>, a standard for representing the alphabets from virtually all of the world's written languages, and a host of symbols. Perl's text strings are Unicode strings, so they can contain characters with a value (codepoint or character number) higher @@ -1926,13 +1926,13 @@ Consortium, L<http://www.unicode.org/charts/charindex.html>; explanatory material with links to other resources at L<http://www.unicode.org/standard/where>. -The answer to requirement 2) is, as of 5.6.0, that a regexp (mostly) -uses Unicode characters. (The "mostly" is for messy backward +The answer to requirement 2) is that a regexp (mostly) +uses Unicode characters. The "mostly" is for messy backward compatibility reasons, but starting in Perl 5.14, any regex compiled in the scope of a C<use feature 'unicode_strings'> (which is automatically turned on within the scope of a C<use 5.012> or higher) will turn that "mostly" into "always". If you want to handle Unicode properly, you -should ensure that C<'unicode_strings'> is turned on.) +should ensure that C<'unicode_strings'> is turned on. Internally, this is encoded to bytes using either UTF-8 or a native 8 bit encoding, depending on the history of the string, but conceptually it is a sequence of characters, not bytes. See L<perlunitut> for a diff --git a/pod/perlrun.pod b/pod/perlrun.pod index 2897b5dd7c..9421a3b281 100644 --- a/pod/perlrun.pod +++ b/pod/perlrun.pod @@ -90,7 +90,7 @@ A similar trick involves the I<env> program, if you have it. The examples above use a relative path to the perl interpreter, getting whatever version is first in the user's path. If you want -a specific version of Perl, say, perl5.005_57, you should place +a specific version of Perl, say, perl5.14.1, you should place that directly in the C<#!> line's path. If the C<#!> line does not contain the word "perl" nor the word "indir" @@ -205,12 +205,12 @@ In this documentation, C<#!/usr/bin/perl> on the first line of the program will stand in for whatever method works on your system. You are advised to use a specific path if you care about a specific version. - #!/usr/local/bin/perl5.00554 + #!/usr/local/bin/perl5.14 or if you just want to be running at least version, place a statement like this at the top of your program: - use 5.005_54; + use 5.014; =head2 Command Switches X<perl, command switches> X<command switches> diff --git a/pod/perlsec.pod b/pod/perlsec.pod index d8470ecccc..634024d92f 100644 --- a/pod/perlsec.pod +++ b/pod/perlsec.pod @@ -134,10 +134,8 @@ For example: @files = <*.c>; # insecure (uses readdir() or similar) @files = glob('*.c'); # insecure (uses readdir() or similar) - # In Perl releases older than 5.6.0 the <*.c> and glob('*.c') would - # have used an external program to do the filename expansion; but in - # either case the result is tainted since the list of filenames comes - # from outside of the program. + # In either case, the results of glob are tainted, since the list of + # filenames comes from outside of the program. $bad = ($arg, 23); # $bad will be tainted $arg, `true`; # Insecure (although it isn't really) diff --git a/pod/perlsub.pod b/pod/perlsub.pod index 760e496fab..54441a097f 100644 --- a/pod/perlsub.pod +++ b/pod/perlsub.pod @@ -451,7 +451,7 @@ if you want to stay compatible with releases older than 5.10. =head3 Persistent variables via state() -Beginning with Perl 5.9.4, you can declare variables with the C<state> +Beginning with Perl 5.10.0, you can declare variables with the C<state> keyword in place of C<my>. For that to work, though, you must have enabled that feature beforehand, either by using the C<feature> pragma, or by using C<-E> on one-liners (see L<feature>). Beginning with Perl 5.16, @@ -616,7 +616,7 @@ This feature allows code like this to work : { local $/ = undef; $slurp = <FILE>; } Note, however, that this restricts localization of some values ; for -example, the following statement dies, as of perl 5.9.0, with an error +example, the following statement dies, as of perl 5.10.0, with an error I<Modification of a read-only value attempted>, because the $1 variable is magical and read-only : @@ -923,8 +923,7 @@ is done on dynamics: } # interruptibility automatically restored here -But it also works on lexically declared aggregates. Prior to 5.005, -this operation could on occasion misbehave. +But it also works on lexically declared aggregates. =back diff --git a/pod/perlthrtut.pod b/pod/perlthrtut.pod index 6b693d1b0e..cec07e04f2 100644 --- a/pod/perlthrtut.pod +++ b/pod/perlthrtut.pod @@ -7,7 +7,7 @@ perlthrtut - Tutorial on threads in Perl =head1 DESCRIPTION This tutorial describes the use of Perl interpreter threads (sometimes -referred to as I<ithreads>) that was first introduced in Perl 5.6.0. In this +referred to as I<ithreads>). In this model, each thread runs in its own Perl interpreter, and any data sharing between threads must be explicit. The user-level interface for I<ithreads> uses the L<threads> class. diff --git a/pod/perltrap.pod b/pod/perltrap.pod index e4fbb23a53..ee17470266 100644 --- a/pod/perltrap.pod +++ b/pod/perltrap.pod @@ -347,1245 +347,6 @@ external name is still an alias for the original. =back -=head2 Perl4 to Perl5 Traps - -Practicing Perl4 Programmers should take note of the following -Perl4-to-Perl5 specific traps. - -They're crudely ordered according to the following list: - -=over 4 - -=item Discontinuance, Deprecation, and BugFix traps - -Anything that's been fixed as a perl4 bug, removed as a perl4 feature -or deprecated as a perl4 feature with the intent to encourage usage of -some other perl5 feature. - -=item Parsing Traps - -Traps that appear to stem from the new parser. - -=item Numerical Traps - -Traps having to do with numerical or mathematical operators. - -=item General data type traps - -Traps involving perl standard data types. - -=item Context Traps - scalar, list contexts - -Traps related to context within lists, scalar statements/declarations. - -=item Precedence Traps - -Traps related to the precedence of parsing, evaluation, and execution of -code. - -=item General Regular Expression Traps using s///, etc. - -Traps related to the use of pattern matching. - -=item Subroutine, Signal, Sorting Traps - -Traps related to the use of signals and signal handlers, general subroutines, -and sorting, along with sorting subroutines. - -=item OS Traps - -OS-specific traps. - -=item DBM Traps - -Traps specific to the use of C<dbmopen()>, and specific dbm implementations. - -=item Unclassified Traps - -Everything else. - -=back - -If you find an example of a conversion trap that is not listed here, -please submit it to <F<perlbug@perl.org>> for inclusion. -Also note that at least some of these can be caught with the -C<use warnings> pragma or the B<-w> switch. - -=head2 Discontinuance, Deprecation, and BugFix traps - -Anything that has been discontinued, deprecated, or fixed as -a bug from perl4. - -=over 4 - -=item * Symbols starting with "_" no longer forced into main - -Symbols starting with "_" are no longer forced into package main, except -for C<$_> itself (and C<@_>, etc.). - - package test; - $_legacy = 1; - - package main; - print "\$_legacy is ",$_legacy,"\n"; - - # perl4 prints: $_legacy is 1 - # perl5 prints: $_legacy is - -=item * Double-colon valid package separator in variable name - -Double-colon is now a valid package separator in a variable name. Thus these -behave differently in perl4 vs. perl5, because the packages don't exist. - - $a=1;$b=2;$c=3;$var=4; - print "$a::$b::$c "; - print "$var::abc::xyz\n"; - - # perl4 prints: 1::2::3 4::abc::xyz - # perl5 prints: 3 - -Given that C<::> is now the preferred package delimiter, it is debatable -whether this should be classed as a bug or not. -(The older package delimiter, ' ,is used here) - - $x = 10; - print "x=${'x}\n"; - - # perl4 prints: x=10 - # perl5 prints: Can't find string terminator "'" anywhere before EOF - -You can avoid this problem, and remain compatible with perl4, if you -always explicitly include the package name: - - $x = 10; - print "x=${main'x}\n"; - -Also see precedence traps, for parsing C<$:>. - -=item * 2nd and 3rd args to C<splice()> are now in scalar context - -The second and third arguments of C<splice()> are now evaluated in scalar -context (as the Camel says) rather than list context. - - sub sub1{return(0,2) } # return a 2-element list - sub sub2{ return(1,2,3)} # return a 3-element list - @a1 = ("a","b","c","d","e"); - @a2 = splice(@a1,&sub1,&sub2); - print join(' ',@a2),"\n"; - - # perl4 prints: a b - # perl5 prints: c d e - -=item * Can't do C<goto> into a block that is optimized away - -You can't do a C<goto> into a block that is optimized away. Darn. - - goto marker1; - - for(1){ - marker1: - print "Here I is!\n"; - } - - # perl4 prints: Here I is! - # perl5 errors: Can't "goto" into the middle of a foreach loop - -=item * Can't use whitespace as variable name or quote delimiter - -It is no longer syntactically legal to use whitespace as the name -of a variable, or as a delimiter for any kind of quote construct. -Double darn. - - $a = ("foo bar"); - $b = q baz ; - print "a is $a, b is $b\n"; - - # perl4 prints: a is foo bar, b is baz - # perl5 errors: Bareword found where operator expected - -=item * C<while/if BLOCK BLOCK> gone - -The archaic while/if BLOCK BLOCK syntax is no longer supported. - - if { 1 } { - print "True!"; - } - else { - print "False!"; - } - - # perl4 prints: True! - # perl5 errors: syntax error at test.pl line 1, near "if {" - -=item * C<**> binds tighter than unary minus - -The C<**> operator now binds more tightly than unary minus. -It was documented to work this way before, but didn't. - - print -4**2,"\n"; - - # perl4 prints: 16 - # perl5 prints: -16 - -=item * C<foreach> changed when iterating over a list - -The meaning of C<foreach{}> has changed slightly when it is iterating over a -list which is not an array. This used to assign the list to a -temporary array, but no longer does so (for efficiency). This means -that you'll now be iterating over the actual values, not over copies of -the values. Modifications to the loop variable can change the original -values. - - @list = ('ab','abc','bcd','def'); - foreach $var (grep(/ab/,@list)){ - $var = 1; - } - print (join(':',@list)); - - # perl4 prints: ab:abc:bcd:def - # perl5 prints: 1:1:bcd:def - -To retain Perl4 semantics you need to assign your list -explicitly to a temporary array and then iterate over that. For -example, you might need to change - - foreach $var (grep(/ab/,@list)){ - -to - - foreach $var (@tmp = grep(/ab/,@list)){ - -Otherwise changing $var will clobber the values of @list. (This most often -happens when you use C<$_> for the loop variable, and call subroutines in -the loop that don't properly localize C<$_>.) - -=item * C<split> with no args behavior changed - -C<split> with no arguments now behaves like C<split ' '> (which doesn't -return an initial null field if $_ starts with whitespace), it used to -behave like C<split /\s+/> (which does). - - $_ = ' hi mom'; - print join(':', split); - - # perl4 prints: :hi:mom - # perl5 prints: hi:mom - -=item * B<-e> behavior fixed - -Perl 4 would ignore any text which was attached to an B<-e> switch, -always taking the code snippet from the following arg. Additionally, it -would silently accept an B<-e> switch without a following arg. Both of -these behaviors have been fixed. - - perl -e'print "attached to -e"' 'print "separate arg"' - - # perl4 prints: separate arg - # perl5 prints: attached to -e - - perl -e - - # perl4 prints: - # perl5 dies: No code specified for -e. - -=item * C<push> returns number of elements in resulting list - -In Perl 4 the return value of C<push> was undocumented, but it was -actually the last value being pushed onto the target list. In Perl 5 -the return value of C<push> is documented, but has changed, it is the -number of elements in the resulting list. - - @x = ('existing'); - print push(@x, 'first new', 'second new'); - - # perl4 prints: second new - # perl5 prints: 3 - -=item * Some error messages differ - -Some error messages will be different. - -=item * C<split()> honors subroutine args - -In Perl 4, if in list context the delimiters to the first argument of -C<split()> were C<??>, the result would be placed in C<@_> as well as -being returned. Perl 5 has more respect for your subroutine arguments. - -=item * Bugs removed - -Some bugs may have been inadvertently removed. :-) - -=back - -=head2 Parsing Traps - -Perl4-to-Perl5 traps from having to do with parsing. - -=over 4 - -=item * Space between . and = triggers syntax error - -Note the space between . and = - - $string . = "more string"; - print $string; - - # perl4 prints: more string - # perl5 prints: syntax error at - line 1, near ". =" - -=item * Better parsing in perl 5 - -Better parsing in perl 5 - - sub foo {} - &foo - print("hello, world\n"); - - # perl4 prints: hello, world - # perl5 prints: syntax error - -=item * Function parsing - -"if it looks like a function, it is a function" rule. - - print - ($foo == 1) ? "is one\n" : "is zero\n"; - - # perl4 prints: is zero - # perl5 warns: "Useless use of a constant in void context" if using -w - -=item * String interpolation of C<$#array> differs - -String interpolation of the C<$#array> construct differs when braces -are to used around the name. - - @a = (1..3); - print "${#a}"; - - # perl4 prints: 2 - # perl5 fails with syntax error - - @a = (1..3); - print "$#{a}"; - - # perl4 prints: {a} - # perl5 prints: 2 - -=item * Perl guesses on C<map>, C<grep> followed by C<{> if it starts BLOCK or hash ref - -When perl sees C<map {> (or C<grep {>), it has to guess whether the C<{> -starts a BLOCK or a hash reference. If it guesses wrong, it will report -a syntax error near the C<}> and the missing (or unexpected) comma. - -Use unary C<+> before C<{> on a hash reference, and unary C<+> applied -to the first thing in a BLOCK (after C<{>), for perl to guess right all -the time. (See L<perlfunc/map>.) - -=back - -=head2 Numerical Traps - -Perl4-to-Perl5 traps having to do with numerical operators, -operands, or output from same. - -=over 5 - -=item * Formatted output and significant digits - -Formatted output and significant digits. In general, Perl 5 -tries to be more precise. For example, on a Solaris Sparc: - - print 7.373504 - 0, "\n"; - printf "%20.18f\n", 7.373504 - 0; - - # Perl4 prints: - 7.3750399999999996141 - 7.375039999999999614 - - # Perl5 prints: - 7.373504 - 7.373503999999999614 - -Notice how the first result looks better in Perl 5. - -Your results may vary, since your floating point formatting routines -and even floating point format may be slightly different. - -=item * Auto-increment operator over signed int limit deleted - -This specific item has been deleted. It demonstrated how the auto-increment -operator would not catch when a number went over the signed int limit. Fixed -in version 5.003_04. But always be wary when using large integers. -If in doubt: - - use Math::BigInt; - -=item * Assignment of return values from numeric equality tests doesn't work - -Assignment of return values from numeric equality tests -does not work in perl5 when the test evaluates to false (0). -Logical tests now return a null, instead of 0 - - $p = ($test == 1); - print $p,"\n"; - - # perl4 prints: 0 - # perl5 prints: - -Also see L<"General Regular Expression Traps using s///, etc."> -for another example of this new feature... - -=item * Bitwise string ops - -When bitwise operators which can operate upon either numbers or -strings (C<& | ^ ~>) are given only strings as arguments, perl4 would -treat the operands as bitstrings so long as the program contained a call -to the C<vec()> function. perl5 treats the string operands as bitstrings. -(See L<perlop/Bitwise String Operators> for more details.) - - $fred = "10"; - $barney = "12"; - $betty = $fred & $barney; - print "$betty\n"; - # Uncomment the next line to change perl4's behavior - # ($dummy) = vec("dummy", 0, 0); - - # Perl4 prints: - 8 - - # Perl5 prints: - 10 - - # If vec() is used anywhere in the program, both print: - 10 - -=back - -=head2 General data type traps - -Perl4-to-Perl5 traps involving most data-types, and their usage -within certain expressions and/or context. - -=over 5 - -=item * Negative array subscripts now count from the end of array - -Negative array subscripts now count from the end of the array. - - @a = (1, 2, 3, 4, 5); - print "The third element of the array is $a[3] also expressed as $a[-2] \n"; - - # perl4 prints: The third element of the array is 4 also expressed as - # perl5 prints: The third element of the array is 4 also expressed as 4 - -=item * Setting C<$#array> lower now discards array elements - -Setting C<$#array> lower now discards array elements, and makes them -impossible to recover. - - @a = (a,b,c,d,e); - print "Before: ",join('',@a); - $#a =1; - print ", After: ",join('',@a); - $#a =3; - print ", Recovered: ",join('',@a),"\n"; - - # perl4 prints: Before: abcde, After: ab, Recovered: abcd - # perl5 prints: Before: abcde, After: ab, Recovered: ab - -=item * Hashes get defined before use - -Hashes get defined before use - - local($s,@a,%h); - die "scalar \$s defined" if defined($s); - die "array \@a defined" if defined(@a); - die "hash \%h defined" if defined(%h); - - # perl4 prints: - # perl5 dies: hash %h defined - -Perl will now generate a warning when it sees defined(@a) and -defined(%h). - -=item * Glob assignment from localized variable to variable - -glob assignment from variable to variable will fail if the assigned -variable is localized subsequent to the assignment - - @a = ("This is Perl 4"); - *b = *a; - local(@a); - print @b,"\n"; - - # perl4 prints: This is Perl 4 - # perl5 prints: - -=item * Assigning C<undef> to glob - -Assigning C<undef> to a glob has no effect in Perl 5. In Perl 4 -it undefines the associated scalar (but may have other side effects -including SEGVs). Perl 5 will also warn if C<undef> is assigned to a -typeglob. (Note that assigning C<undef> to a typeglob is different -than calling the C<undef> function on a typeglob (C<undef *foo>), which -has quite a few effects. - - $foo = "bar"; - *foo = undef; - print $foo; - - # perl4 prints: - # perl4 warns: "Use of uninitialized variable" if using -w - # perl5 prints: bar - # perl5 warns: "Undefined value assigned to typeglob" if using -w - -=item * Changes in unary negation (of strings) - -Changes in unary negation (of strings) -This change effects both the return value and what it -does to auto(magic)increment. - - $x = "aaa"; - print ++$x," : "; - print -$x," : "; - print ++$x,"\n"; - - # perl4 prints: aab : -0 : 1 - # perl5 prints: aab : -aab : aac - -=item * Modifying of constants prohibited - -perl 4 lets you modify constants: - - $foo = "x"; - &mod($foo); - for ($x = 0; $x < 3; $x++) { - &mod("a"); - } - sub mod { - print "before: $_[0]"; - $_[0] = "m"; - print " after: $_[0]\n"; - } - - # perl4: - # before: x after: m - # before: a after: m - # before: m after: m - # before: m after: m - - # Perl5: - # before: x after: m - # Modification of a read-only value attempted at foo.pl line 12. - # before: a - -=item * C<defined $var> behavior changed - -The behavior is slightly different for: - - print "$x", defined $x - - # perl 4: 1 - # perl 5: <no output, $x is not called into existence> - -=item * Variable Suicide - -Variable suicide behavior is more consistent under Perl 5. -Perl5 exhibits the same behavior for hashes and scalars, -that perl4 exhibits for only scalars. - - $aGlobal{ "aKey" } = "global value"; - print "MAIN:", $aGlobal{"aKey"}, "\n"; - $GlobalLevel = 0; - &test( *aGlobal ); - - sub test { - local( *theArgument ) = @_; - local( %aNewLocal ); # perl 4 != 5.001l,m - $aNewLocal{"aKey"} = "this should never appear"; - print "SUB: ", $theArgument{"aKey"}, "\n"; - $aNewLocal{"aKey"} = "level $GlobalLevel"; # what should print - $GlobalLevel++; - if( $GlobalLevel<4 ) { - &test( *aNewLocal ); - } - } - - # Perl4: - # MAIN:global value - # SUB: global value - # SUB: level 0 - # SUB: level 1 - # SUB: level 2 - - # Perl5: - # MAIN:global value - # SUB: global value - # SUB: this should never appear - # SUB: this should never appear - # SUB: this should never appear - -=back - -=head2 Context Traps - scalar, list contexts - -=over 5 - -=item * Elements of argument lists for formats evaluated in list context - -The elements of argument lists for formats are now evaluated in list -context. This means you can interpolate list values now. - - @fmt = ("foo","bar","baz"); - format STDOUT= - @<<<<< @||||| @>>>>> - @fmt; - . - write; - - # perl4 errors: Please use commas to separate fields in file - # perl5 prints: foo bar baz - -=item * C<caller()> returns false value in scalar context if no caller present - -The C<caller()> function now returns a false value in a scalar context -if there is no caller. This lets library files determine if they're -being required. - - caller() ? (print "You rang?\n") : (print "Got a 0\n"); - - # perl4 errors: There is no caller - # perl5 prints: Got a 0 - -=item * Comma operator in scalar context gives scalar context to args - -The comma operator in a scalar context is now guaranteed to give a -scalar context to its last argument. It gives scalar or void context -to any preceding arguments, depending on circumstances. - - @y= ('a','b','c'); - $x = (1, 2, @y); - print "x = $x\n"; - - # Perl4 prints: x = c # Interpolates array @y into the list - # Perl5 prints: x = 3 # Evaluates array @y in scalar context - -=item * C<sprintf()> prototyped as C<($;@)> - -C<sprintf()> is prototyped as ($;@), so its first argument is given scalar -context. Thus, if passed an array, it will probably not do what you want, -unlike Perl 4: - - @z = ('%s%s', 'foo', 'bar'); - $x = sprintf(@z); - print $x; - - # perl4 prints: foobar - # perl5 prints: 3 - -C<printf()> works the same as it did in Perl 4, though: - - @z = ('%s%s', 'foo', 'bar'); - printf STDOUT (@z); - - # perl4 prints: foobar - # perl5 prints: foobar - -=back - -=head2 Precedence Traps - -Perl4-to-Perl5 traps involving precedence order. - -Perl 4 has almost the same precedence rules as Perl 5 for the operators -that they both have. Perl 4 however, seems to have had some -inconsistencies that made the behavior differ from what was documented. - -=over 5 - -=item * LHS vs. RHS of any assignment operator - -LHS vs. RHS of any assignment operator. LHS is evaluated first -in perl4, second in perl5; this can affect the relationship -between side-effects in sub-expressions. - - @arr = ( 'left', 'right' ); - $a{shift @arr} = shift @arr; - print join( ' ', keys %a ); - - # perl4 prints: left - # perl5 prints: right - -=item * Semantic errors introduced due to precedence - -These are now semantic errors because of precedence: - - @list = (1,2,3,4,5); - %map = ("a",1,"b",2,"c",3,"d",4); - $n = shift @list + 2; # first item in list plus 2 - print "n is $n, "; - $m = keys %map + 2; # number of items in hash plus 2 - print "m is $m\n"; - - # perl4 prints: n is 3, m is 6 - # perl5 errors and fails to compile - -=item * Precedence of assignment operators same as the precedence of assignment - -The precedence of assignment operators is now the same as the precedence -of assignment. Perl 4 mistakenly gave them the precedence of the associated -operator. So you now must parenthesize them in expressions like - - /foo/ ? ($a += 2) : ($a -= 2); - -Otherwise - - /foo/ ? $a += 2 : $a -= 2 - -would be erroneously parsed as - - (/foo/ ? $a += 2 : $a) -= 2; - -On the other hand, - - $a += /foo/ ? 1 : 2; - -now works as a C programmer would expect. - -=item * C<open> requires parentheses around filehandle - - open FOO || die; - -is now incorrect. You need parentheses around the filehandle. -Otherwise, perl5 leaves the statement as its default precedence: - - open(FOO || die); - - # perl4 opens or dies - # perl5 opens FOO, dying only if 'FOO' is false, i.e. never - -=item * C<$:> precedence over C<$::> gone - -perl4 gives the special variable, C<$:> precedence, where perl5 -treats C<$::> as main C<package> - - $a = "x"; print "$::a"; - - # perl 4 prints: -:a - # perl 5 prints: x - -=item * Precedence of file test operators documented - -perl4 had buggy precedence for the file test operators vis-a-vis -the assignment operators. Thus, although the precedence table -for perl4 leads one to believe C<-e $foo .= "q"> should parse as -C<((-e $foo) .= "q")>, it actually parses as C<(-e ($foo .= "q"))>. -In perl5, the precedence is as documented. - - -e $foo .= "q" - - # perl4 prints: no output - # perl5 prints: Can't modify -e in concatenation - -=item * C<keys>, C<each>, C<values> are regular named unary operators - -In perl4, keys(), each() and values() were special high-precedence operators -that operated on a single hash, but in perl5, they are regular named unary -operators. As documented, named unary operators have lower precedence -than the arithmetic and concatenation operators C<+ - .>, but the perl4 -variants of these operators actually bind tighter than C<+ - .>. -Thus, for: - - %foo = 1..10; - print keys %foo - 1 - - # perl4 prints: 4 - # perl5 prints: Type of arg 1 to keys must be hash (not subtraction) - -The perl4 behavior was probably more useful, if less consistent. - -=back - -=head2 General Regular Expression Traps using s///, etc. - -All types of RE traps. - -=over 5 - -=item * C<s'$lhs'$rhs'> interpolates on either side - -C<s'$lhs'$rhs'> now does no interpolation on either side. It used to -interpolate $lhs but not $rhs. (And still does not match a literal -'$' in string) - - $a=1;$b=2; - $string = '1 2 $a $b'; - $string =~ s'$a'$b'; - print $string,"\n"; - - # perl4 prints: $b 2 $a $b - # perl5 prints: 1 2 $a $b - -=item * C<m//g> attaches its state to the searched string - -C<m//g> now attaches its state to the searched string rather than the -regular expression. (Once the scope of a block is left for the sub, the -state of the searched string is lost) - - $_ = "ababab"; - while(m/ab/g){ - &doit("blah"); - } - sub doit{local($_) = shift; print "Got $_ "} - - # perl4 prints: Got blah Got blah Got blah Got blah - # perl5 prints: infinite loop blah... - -=item * C<m//o> used within an anonymous sub - -Currently, if you use the C<m//o> qualifier on a regular expression -within an anonymous sub, I<all> closures generated from that anonymous -sub will use the regular expression as it was compiled when it was used -the very first time in any such closure. For instance, if you say - - sub build_match { - my($left,$right) = @_; - return sub { $_[0] =~ /$left stuff $right/o; }; - } - $good = build_match('foo','bar'); - $bad = build_match('baz','blarch'); - print $good->('foo stuff bar') ? "ok\n" : "not ok\n"; - print $bad->('baz stuff blarch') ? "ok\n" : "not ok\n"; - print $bad->('foo stuff bar') ? "not ok\n" : "ok\n"; - -For most builds of Perl5, this will print: -ok -not ok -not ok - -build_match() will always return a sub which matches the contents of -$left and $right as they were the I<first> time that build_match() -was called, not as they are in the current call. - -=item * C<$+> isn't set to whole match - -If no parentheses are used in a match, Perl4 sets C<$+> to -the whole match, just like C<$&>. Perl5 does not. - - "abcdef" =~ /b.*e/; - print "\$+ = $+\n"; - - # perl4 prints: bcde - # perl5 prints: - -=item * Substitution now returns null string if it fails - -substitution now returns the null string if it fails - - $string = "test"; - $value = ($string =~ s/foo//); - print $value, "\n"; - - # perl4 prints: 0 - # perl5 prints: - -Also see L<Numerical Traps> for another example of this new feature. - -=item * C<s`lhs`rhs`> is now a normal substitution - -C<s`lhs`rhs`> (using backticks) is now a normal substitution, with no -backtick expansion - - $string = ""; - $string =~ s`^`hostname`; - print $string, "\n"; - - # perl4 prints: <the local hostname> - # perl5 prints: hostname - -=item * Stricter parsing of variables in regular expressions - -Stricter parsing of variables used in regular expressions - - s/^([^$grpc]*$grpc[$opt$plus$rep]?)//o; - - # perl4: compiles w/o error - # perl5: with Scalar found where operator expected ..., near "$opt$plus" - -an added component of this example, apparently from the same script, is -the actual value of the s'd string after the substitution. -C<[$opt]> is a character class in perl4 and an array subscript in perl5 - - $grpc = 'a'; - $opt = 'r'; - $_ = 'bar'; - s/^([^$grpc]*$grpc[$opt]?)/foo/; - print; - - # perl4 prints: foo - # perl5 prints: foobar - -=item * C<m?x?> matches only once - -Under perl5, C<m?x?> matches only once, like C<?x?>. Under perl4, it matched -repeatedly, like C</x/> or C<m!x!>. - - $test = "once"; - sub match { $test =~ m?once?; } - &match(); - if( &match() ) { - # m?x? matches more then once - print "perl4\n"; - } else { - # m?x? matches only once - print "perl5\n"; - } - - # perl4 prints: perl4 - # perl5 prints: perl5 - -=item * Failed matches don't reset the match variables - -Unlike in Ruby, failed matches in Perl do not reset the match variables -($1, $2, ..., C<$`>, ...). - -=back - -=head2 Subroutine, Signal, Sorting Traps - -The general group of Perl4-to-Perl5 traps having to do with -Signals, Sorting, and their related subroutines, as well as -general subroutine traps. Includes some OS-Specific traps. - -=over 5 - -=item * Barewords that used to look like strings look like subroutine calls - -Barewords that used to look like strings to Perl will now look like subroutine -calls if a subroutine by that name is defined before the compiler sees them. - - sub SeeYa { warn"Hasta la vista, baby!" } - $SIG{'TERM'} = SeeYa; - print "SIGTERM is now $SIG{'TERM'}\n"; - - # perl4 prints: SIGTERM is now main'SeeYa - # perl5 prints: SIGTERM is now main::1 (and warns "Hasta la vista, baby!") - -Use B<-w> to catch this one - -=item * Reverse is no longer allowed as the name of a sort subroutine - -reverse is no longer allowed as the name of a sort subroutine. - - sub reverse{ print "yup "; $a <=> $b } - print sort reverse (2,1,3); - - # perl4 prints: yup yup 123 - # perl5 prints: 123 - # perl5 warns (if using -w): Ambiguous call resolved as CORE::reverse() - -=item * C<warn()> won't let you specify a filehandle. - -Although it _always_ printed to STDERR, warn() would let you specify a -filehandle in perl4. With perl5 it does not. - - warn STDERR "Foo!"; - - # perl4 prints: Foo! - # perl5 prints: String found where operator expected - -=back - -=head2 OS Traps - -=over 5 - -=item * SysV resets signal handler correctly - -Under HPUX, and some other SysV OSes, one had to reset any signal handler, -within the signal handler function, each time a signal was handled with -perl4. With perl5, the reset is now done correctly. Any code relying -on the handler _not_ being reset will have to be reworked. - -Since version 5.002, Perl uses sigaction() under SysV. - - sub gotit { - print "Got @_... "; - } - $SIG{'INT'} = 'gotit'; - - $| = 1; - $pid = fork; - if ($pid) { - kill('INT', $pid); - sleep(1); - kill('INT', $pid); - } else { - while (1) {sleep(10);} - } - - # perl4 (HPUX) prints: Got INT... - # perl5 (HPUX) prints: Got INT... Got INT... - -=item * SysV C<seek()> appends correctly - -Under SysV OSes, C<seek()> on a file opened to append C<<< >> >>> now does -the right thing w.r.t. the fopen() manpage. e.g., - When a file is opened -for append, it is impossible to overwrite information already in -the file. - - open(TEST,">>seek.test"); - $start = tell TEST; - foreach(1 .. 9){ - print TEST "$_ "; - } - $end = tell TEST; - seek(TEST,$start,0); - print TEST "18 characters here"; - - # perl4 (solaris) seek.test has: 18 characters here - # perl5 (solaris) seek.test has: 1 2 3 4 5 6 7 8 9 18 characters here - - - -=back - -=head2 Interpolation Traps - -Perl4-to-Perl5 traps having to do with how things get interpolated -within certain expressions, statements, contexts, or whatever. - -=over 5 - -=item * C<@> always interpolates an array in double-quotish strings - -@ now always interpolates an array in double-quotish strings. - - print "To: someone@somewhere.com\n"; - - # perl4 prints: To:someone@somewhere.com - # perl < 5.6.1, error : In string, @somewhere now must be written as \@somewhere - # perl >= 5.6.1, warning : Possible unintended interpolation of @somewhere in string - -=item * Double-quoted strings may no longer end with an unescaped $ - -Double-quoted strings may no longer end with an unescaped $. - - $foo = "foo$"; - print "foo is $foo\n"; - - # perl4 prints: foo is foo$ - # perl5 errors: Final $ should be \$ or $name - -Note: perl5 DOES NOT error on the terminating @ in $bar - -=item * Arbitrary expressions are evaluated inside braces within double quotes - -Perl now sometimes evaluates arbitrary expressions inside braces that occur -within double quotes (usually when the opening brace is preceded by C<$> -or C<@>). - - @www = "buz"; - $foo = "foo"; - $bar = "bar"; - sub foo { return "bar" }; - print "|@{w.w.w}|${main'foo}|"; - - # perl4 prints: |@{w.w.w}|foo| - # perl5 prints: |buz|bar| - -Note that you can C<use strict;> to ward off such trappiness under perl5. - -=item * C<$$x> now tries to dereference $x - -The construct "this is $$x" used to interpolate the pid at that point, but -now tries to dereference $x. C<$$> by itself still works fine, however. - - $s = "a reference"; - $x = *s; - print "this is $$x\n"; - - # perl4 prints: this is XXXx (XXX is the current pid) - # perl5 prints: this is a reference - -=item * Creation of hashes on the fly with C<eval "EXPR"> requires protection - -Creation of hashes on the fly with C<eval "EXPR"> now requires either both -C<$>'s to be protected in the specification of the hash name, or both curlies -to be protected. If both curlies are protected, the result will be compatible -with perl4 and perl5. This is a very common practice, and should be changed -to use the block form of C<eval{}> if possible. - - $hashname = "foobar"; - $key = "baz"; - $value = 1234; - eval "\$$hashname{'$key'} = q|$value|"; - (defined($foobar{'baz'})) ? (print "Yup") : (print "Nope"); - - # perl4 prints: Yup - # perl5 prints: Nope - -Changing - - eval "\$$hashname{'$key'} = q|$value|"; - -to - - eval "\$\$hashname{'$key'} = q|$value|"; - -causes the following result: - - # perl4 prints: Nope - # perl5 prints: Yup - -or, changing to - - eval "\$$hashname\{'$key'\} = q|$value|"; - -causes the following result: - - # perl4 prints: Yup - # perl5 prints: Yup - # and is compatible for both versions - - -=item * Bugs in earlier perl versions - -perl4 programs which unconsciously rely on the bugs in earlier perl versions. - - perl -e '$bar=q/not/; print "This is $foo{$bar} perl5"' - - # perl4 prints: This is not perl5 - # perl5 prints: This is perl5 - -=item * Array and hash brackets during interpolation - -You also have to be careful about array and hash brackets during -interpolation. - - print "$foo[" - - perl 4 prints: [ - perl 5 prints: syntax error - - print "$foo{" - - perl 4 prints: { - perl 5 prints: syntax error - -Perl 5 is expecting to find an index or key name following the respective -brackets, as well as an ending bracket of the appropriate type. In order -to mimic the behavior of Perl 4, you must escape the bracket like so. - - print "$foo\["; - print "$foo\{"; - -=item * Interpolation of C<\$$foo{bar}> - -Similarly, watch out for: C<\$$foo{bar}> - - $foo = "baz"; - print "\$$foo{bar}\n"; - - # perl4 prints: $baz{bar} - # perl5 prints: $ - -Perl 5 is looking for C<$foo{bar}> which doesn't exist, but perl 4 is -happy just to expand $foo to "baz" by itself. Watch out for this -especially in C<eval>'s. - -=item * C<qq()> string passed to C<eval> will not find string terminator - -C<qq()> string passed to C<eval> - - eval qq( - foreach \$y (keys %\$x\) { - \$count++; - } - ); - - # perl4 runs this ok - # perl5 prints: Can't find string terminator ")" - -=back - -=head2 DBM Traps - -General DBM traps. - -=over 5 - -=item * Perl5 must have been linked with same dbm/ndbm as the default for C<dbmopen()> - -Existing dbm databases created under perl4 (or any other dbm/ndbm tool) -may cause the same script, run under perl5, to fail. The build of perl5 -must have been linked with the same dbm/ndbm as the default for C<dbmopen()> -to function properly without C<tie>'ing to an extension dbm implementation. - - dbmopen (%dbm, "file", undef); - print "ok\n"; - - # perl4 prints: ok - # perl5 prints: ok (IFF linked with -ldbm or -lndbm) - - -=item * DBM exceeding limit on the key/value size will cause perl5 to exit immediately - -Existing dbm databases created under perl4 (or any other dbm/ndbm tool) -may cause the same script, run under perl5, to fail. The error generated -when exceeding the limit on the key/value size will cause perl5 to exit -immediately. - - dbmopen(DB, "testdb",0600) || die "couldn't open db! $!"; - $DB{'trap'} = "x" x 1024; # value too large for most dbm/ndbm - print "YUP\n"; - - # perl4 prints: - dbm store returned -1, errno 28, key "trap" at - line 3. - YUP - - # perl5 prints: - dbm store returned -1, errno 28, key "trap" at - line 3. - -=back - -=head2 Unclassified Traps - -Everything else. - -=over 5 - -=item * C<require>/C<do> trap using returned value - -If the file doit.pl has: - - sub foo { - $rc = do "./do.pl"; - return 8; - } - print &foo, "\n"; - -And the do.pl file has the following single line: - - return 3; - -Running doit.pl gives the following: - - # perl 4 prints: 3 (aborts the subroutine early) - # perl 5 prints: 8 - -Same behavior if you replace C<do> with C<require>. - -=item * C<split> on empty string with LIMIT specified - - $string = ''; - @list = split(/foo/, $string, 2) - -Perl4 returns a one element list containing the empty string but Perl5 -returns an empty list. - -=back - As always, if any of these are ever officially declared as bugs, they'll be fixed and removed. diff --git a/pod/perlunicode.pod b/pod/perlunicode.pod index e893571dfd..4692e34d45 100644 --- a/pod/perlunicode.pod +++ b/pod/perlunicode.pod @@ -74,8 +74,7 @@ See L</"Byte and Character Semantics"> for more details. =head2 Byte and Character Semantics -Beginning with version 5.6, Perl uses logically-wide characters to -represent strings internally. +Perl uses logically-wide characters to represent strings internally. Starting in Perl 5.14, Perl-level operations work with characters rather than bytes within the scope of a @@ -1332,7 +1331,7 @@ results, or both, but it is not. The following are such interfaces. Also, see L</The "Unicode Bug">. For all of these interfaces Perl -currently (as of 5.8.3) simply assumes byte strings both as arguments +currently (as of v5.16.0) simply assumes byte strings both as arguments and results, or UTF-8 strings if the (problematic) C<encoding> pragma has been used. One reason that Perl does not attempt to resolve the role of Unicode in @@ -1724,7 +1723,7 @@ to work under 5.6, so you should be safe to try them out. A filehandle that should read or write UTF-8 - if ($] > 5.007) { + if ($] > 5.008) { binmode $fh, ":encoding(utf8)"; } @@ -1735,10 +1734,10 @@ A scalar that is going to be passed to some extension Be it Compress::Zlib, Apache::Request or any extension that has no mention of Unicode in the manpage, you need to make sure that the UTF8 flag is stripped off. Note that at the time of this writing -(October 2002) the mentioned modules are not UTF-8-aware. Please +(January 2012) the mentioned modules are not UTF-8-aware. Please check the documentation to verify if this is still true. - if ($] > 5.007) { + if ($] > 5.008) { require Encode; $val = Encode::encode_utf8($val); # make octets } @@ -1750,7 +1749,7 @@ A scalar we got back from an extension If you believe the scalar comes back as UTF-8, you will most likely want the UTF8 flag restored: - if ($] > 5.007) { + if ($] > 5.008) { require Encode; $val = Encode::decode_utf8($val); } @@ -1759,7 +1758,7 @@ want the UTF8 flag restored: Same thing, if you are really sure it is UTF-8 - if ($] > 5.007) { + if ($] > 5.008) { require Encode; Encode::_utf8_on($val); } @@ -1772,14 +1771,14 @@ When the database contains only UTF-8, a wrapper function or method is a convenient way to replace all your fetchrow_array and fetchrow_hashref calls. A wrapper function will also make it easier to adapt to future enhancements in your database driver. Note that at the -time of this writing (October 2002), the DBI has no standardized way +time of this writing (January 2012), the DBI has no standardized way to deal with UTF-8 data. Please check the documentation to verify if that is still true. sub fetchrow { # $what is one of fetchrow_{array,hashref} my($self, $sth, $what) = @_; - if ($] < 5.007) { + if ($] < 5.008) { return $sth->$what; } else { require Encode; @@ -1815,7 +1814,7 @@ Scalars that contain only ASCII and are marked as UTF-8 are sometimes a drag to your program. If you recognize such a situation, just remove the UTF8 flag: - utf8::downgrade($val) if $] > 5.007; + utf8::downgrade($val) if $] > 5.008; =back diff --git a/pod/perlunifaq.pod b/pod/perlunifaq.pod index 9bd103c9ac..ca3a180cfd 100644 --- a/pod/perlunifaq.pod +++ b/pod/perlunifaq.pod @@ -141,8 +141,8 @@ concern, and you can just C<eval> dumped data as always. Starting in Perl 5.14 (and partially in Perl 5.12), just put a C<use feature 'unicode_strings'> near the beginning of your program. Within its lexical scope you shouldn't have this problem. It also is -automatically enabled under C<use feature ':5.12'> or using C<-E> on the -command line for Perl 5.12 or higher. +automatically enabled under C<use feature ':5.12'> or C<use v5.12> or +using C<-E> on the command line for Perl 5.12 or higher. The rationale for requiring this is to not break older programs that rely on the way things worked before Unicode came along. Those older diff --git a/pod/perluniintro.pod b/pod/perluniintro.pod index 8ce4b7b446..92c5d97644 100644 --- a/pod/perluniintro.pod +++ b/pod/perluniintro.pod @@ -145,12 +145,12 @@ I<surrogates> and I<byte order marks> (BOMs) are--see L<perlunicode>. =head2 Perl's Unicode Support -Starting from Perl 5.6.0, Perl has had the capacity to handle Unicode -natively. Perl 5.8.0, however, is the first recommended release for +Starting from Perl v5.6.0, Perl has had the capacity to handle Unicode +natively. Perl v5.8.0, however, is the first recommended release for serious Unicode work. The maintenance release 5.6.1 fixed many of the problems of the initial Unicode implementation, but for example regular expressions still do not work with Unicode in 5.6.1. -Perl 5.14.0 is the first release where Unicode support is +Perl v5.14.0 is the first release where Unicode support is (almost) seamlessly integrable without some gotchas (the exception being some differences in L<quotemeta|perlfunc/quotemeta>, which is fixed starting in Perl 5.16.0). To enable this @@ -159,12 +159,12 @@ automatically selected if you C<use 5.012> or higher). See L<feature>. (5.14 also fixes a number of bugs and departures from the Unicode standard.) -Before Perl 5.8.0, the use of C<use utf8> was used to declare +Before Perl v5.8.0, the use of C<use utf8> was used to declare that operations in the current block or file would be Unicode-aware. This model was found to be wrong, or at least clumsy: the "Unicodeness" is now carried with the data, instead of being attached to the operations. -Starting with Perl 5.8.0, only one case remains where an explicit C<use +Starting with Perl v5.8.0, only one case remains where an explicit C<use utf8> is needed: if your Perl script itself is encoded in UTF-8, you can use UTF-8 in your identifier names, and in string and regular expression literals, by saying C<use utf8>. This is not the default because @@ -176,7 +176,7 @@ Perl supports both pre-5.6 strings of eight-bit native bytes, and strings of Unicode characters. The general principle is that Perl tries to keep its data as eight-bit bytes for as long as possible, but as soon as Unicodeness cannot be avoided, the data is transparently upgraded -to Unicode. Prior to Perl 5.14, the upgrade was not completely +to Unicode. Prior to Perl v5.14.0, the upgrade was not completely transparent (see L<perlunicode/The "Unicode Bug">), and for backwards compatibility, full transparency is not gained unless C<use feature 'unicode_strings'> (see L<feature>) or C<use 5.012> (or higher) is @@ -415,7 +415,7 @@ streams, use explicit layers directly in the C<open()> call. You can switch encodings on an already opened stream by using C<binmode()>; see L<perlfunc/binmode>. -The C<:locale> does not currently (as of Perl 5.8.0) work with +The C<:locale> does not currently work with C<open()> and C<binmode()>, only with the C<open> pragma. The C<:utf8> and C<:encoding(...)> methods do work with all of C<open()>, C<binmode()>, and the C<open> pragma. diff --git a/pod/perlutil.pod b/pod/perlutil.pod index 040f51d5f6..3f53ad0fa5 100644 --- a/pod/perlutil.pod +++ b/pod/perlutil.pod @@ -232,7 +232,7 @@ came along modules included in the perl distribution. B<piconv> is a Perl version of B<iconv>, a character encoding converter widely available for various Unixen today. This script was primarily a -technology demonstrator for Perl 5.8.0, but you can use piconv in the +technology demonstrator for Perl v5.8.0, but you can use piconv in the place of iconv for virtually any case. =item L<ptar> diff --git a/pod/perlvar.pod b/pod/perlvar.pod index cfa82f9beb..da02cc6a3b 100644 --- a/pod/perlvar.pod +++ b/pod/perlvar.pod @@ -24,7 +24,7 @@ C<W>) is the scalar variable whose name is the single character control-C<W>. This is better than typing a literal control-C<W> into your program. -Since Perl 5.6, Perl variable names may be alphanumeric +Since Perl v5.6.0, Perl variable names may be alphanumeric strings that begin with control characters (or better yet, a caret). These variables must be written in the form C<${^Foo}>; the braces are not optional. C<${^Foo}> denotes the scalar variable whose @@ -145,7 +145,7 @@ test. Outside a C<while> test, this will not happen. =back As C<$_> is a global variable, this may lead in some cases to unwanted -side-effects. As of perl 5.10, you can now use a lexical version of +side-effects. As of perl v5.10.0, you can now use a lexical version of C<$_> by declaring it in a file or in a block with C<my>. Moreover, declaring C<our $_> restores the global C<$_> in the current scope. @@ -250,7 +250,7 @@ have their own copies of it. If the program has been given to perl via the switches C<-e> or C<-E>, C<$0> will contain the string C<"-e">. -On Linux as of perl 5.14 the legacy process name will be set with +On Linux as of perl v5.14.0 the legacy process name will be set with C<prctl(2)>, in addition to altering the POSIX name via C<argv[0]> as perl has done since version 4.000. Now system utilities that read the legacy process name such as ps, top and killall will recognize the @@ -549,7 +549,7 @@ lest you inadvertently call it. If your system has the C<sigaction()> function then signal handlers are installed using it. This means you get reliable signal handling. -The default delivery policy of signals changed in Perl 5.8.0 from +The default delivery policy of signals changed in Perl v5.8.0 from immediate (also known as "unsafe") to deferred, also known as "safe signals". See L<perlipc> for more information. @@ -629,8 +629,8 @@ X<$^V> X<$PERL_VERSION> The revision, version, and subversion of the Perl interpreter, represented as a C<version> object. -This variable first appeared in perl 5.6.0; earlier versions of perl -will see an undefined value. Before perl 5.10.0 C<$^V> was represented +This variable first appeared in perl v5.6.0; earlier versions of perl +will see an undefined value. Before perl v5.10.0 C<$^V> was represented as a v-string. C<$^V> can be used to determine whether the Perl interpreter executing @@ -648,7 +648,7 @@ for a convenient way to fail if the running Perl interpreter is too old. See also C<$]> for an older representation of the Perl version. -This variable was added in Perl 5.6. +This variable was added in Perl v5.6.0. Mnemonic: use ^V for Version Control. @@ -667,7 +667,7 @@ default. See the documentation for B<-f> in L<perlrun|perlrun/"Command Switches"> for more information about site customization. -This variable was added in Perl 5.10. +This variable was added in Perl v5.10.0. =item $EXECUTABLE_NAME @@ -785,7 +785,7 @@ The C<Devel::NYTProf> and C<Devel::FindAmpersand> modules can help you find uses of these problematic match variables in your code. -Since Perl 5.10, you can use the C</p> match operator flag and the +Since Perl v5.10.0, you can use the C</p> match operator flag and the C<${^PREMATCH}>, C<${^MATCH}>, and C<${^POSTMATCH}> variables instead so you only suffer the performance penalties. @@ -814,7 +814,7 @@ BLOCK). The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. To avoid this penalty, you can extract the same substring by using L</@->. Starting -with Perl 5.10, you can use the C</p> match flag and the C<${^MATCH}> +with Perl v5.10.0, you can use the C</p> match flag and the C<${^MATCH}> variable to do the same thing for particular match operations. This variable is read-only and dynamically-scoped. @@ -829,7 +829,7 @@ performance penalty associated with that variable, and is only guaranteed to return a defined value when the pattern was compiled or executed with the C</p> modifier. -This variable was added in Perl 5.10. +This variable was added in Perl v5.10.0. This variable is read-only and dynamically-scoped. @@ -845,7 +845,7 @@ enclosed by the current BLOCK. The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. To avoid this penalty, you can extract the same substring by using L</@->. Starting -with Perl 5.10, you can use the C</p> match flag and the +with Perl v5.10.0, you can use the C</p> match flag and the C<${^PREMATCH}> variable to do the same thing for particular match operations. @@ -861,7 +861,7 @@ performance penalty associated with that variable, and is only guaranteed to return a defined value when the pattern was compiled or executed with the C</p> modifier. -This variable was added in Perl 5.10 +This variable was added in Perl v5.10.0 This variable is read-only and dynamically-scoped. @@ -881,7 +881,7 @@ enclosed by the current BLOCK). Example: The use of this variable anywhere in a program imposes a considerable performance penalty on all regular expression matches. To avoid this penalty, you can extract the same substring by -using L</@->. Starting with Perl 5.10, you can use the C</p> match flag +using L</@->. Starting with Perl v5.10.0, you can use the C</p> match flag and the C<${^POSTMATCH}> variable to do the same thing for particular match operations. @@ -897,7 +897,7 @@ performance penalty associated with that variable, and is only guaranteed to return a defined value when the pattern was compiled or executed with the C</p> modifier. -This variable was added in Perl 5.10. +This variable was added in Perl v5.10.0. This variable is read-only and dynamically-scoped. @@ -934,7 +934,7 @@ recently matched. For example, to effectively capture text to a variable By setting and then using C<$var> in this way relieves you from having to worry about exactly which numbered set of parentheses they are. -This variable was added in Perl 5.8. +This variable was added in Perl v5.8.0. Mnemonic: the (possibly) Nested parenthesis that most recently closed. @@ -954,7 +954,7 @@ past where C<$2> ends, and so on. You can use C<$#+> to determine how many subgroups were in the last successful match. See the examples given for the C<@-> variable. -This variable was added in Perl 5.6. +This variable was added in Perl v5.6.0. =item %LAST_PAREN_MATCH @@ -981,7 +981,7 @@ iterative access to them via C<each> may have unpredictable results. Likewise, if the last successful match changes, then the results may be surprising. -This variable was added in Perl 5.10. +This variable was added in Perl v5.10.0. This variable is read-only and dynamically-scoped. @@ -1027,7 +1027,7 @@ After a match against some variable C<$var>: =back -This variable was added in Perl 5.6. +This variable was added in Perl v5.6.0. =item %LAST_MATCH_START @@ -1075,7 +1075,7 @@ iterative access to them via C<each> may have unpredictable results. Likewise, if the last successful match changes, then the results may be surprising. -This variable was added in Perl 5.10 +This variable was added in Perl v5.10.0. This variable is read-only and dynamically-scoped. @@ -1095,7 +1095,7 @@ X<${^RE_DEBUG_FLAGS}> The current value of the regex debugging flags. Set to 0 for no debug output even when the C<re 'debug'> module is loaded. See L<re> for details. -This variable was added in Perl 5.10. +This variable was added in Perl v5.10.0. =item ${^RE_TRIE_MAXBUF} X<${^RE_TRIE_MAXBUF}> @@ -1109,7 +1109,7 @@ be as conservative of memory as possible but still occur, and set it to a negative value to prevent the optimisation and conserve the most memory. Under normal situations this variable should be of no interest to you. -This variable was added in Perl 5.10. +This variable was added in Perl v5.10.0. =back @@ -1566,7 +1566,7 @@ WSTOPSIG and WIFCONTINUED functions provided by the L<POSIX> module. Under VMS this reflects the actual VMS exit status; i.e. it is the same as C<$?> when the pragma C<use vmsish 'status'> is in effect. -This variable was added in Perl 5.8.9. +This variable was added in Perl v5.10.0. =item $EXTENDED_OS_ERROR @@ -1637,7 +1637,7 @@ It has the same scoping as the C<$^H> and C<%^H> variables. The exact values are considered internal to the L<warnings> pragma and may change between versions of Perl. -This variable was added in Perl 5.6. +This variable was added in Perl v5.6.0. =item $OS_ERROR @@ -1764,7 +1764,7 @@ when being compiled, such as for example to C<AUTOLOAD> at compile time rather than normal, deferred loading. Setting C<$^C = 1> is similar to calling C<B::minus_c>. -This variable was added in Perl 5.6. +This variable was added in Perl v5.6.0. =item $DEBUGGING @@ -1956,7 +1956,7 @@ A module should use only keys that begin with the module's name (the name of its main package) and a "/" character. For example, a module C<Foo::Bar> should use keys such as C<Foo::Bar/baz>. -This variable was added in Perl 5.6. +This variable was added in Perl v5.6.0. =item ${^OPEN} X<${^OPEN}> @@ -1965,7 +1965,7 @@ An internal variable used by PerlIO. A string in two parts, separated by a C<\0> byte, the first part describes the input layers, the second part describes the output layers. -This variable was added in Perl 5.8.0. +This variable was added in Perl v5.8.0. =item $PERLDB @@ -2039,7 +2039,7 @@ B<-t> or B<-TU>). This variable is read-only. -This variable was added in Perl 5.8. +This variable was added in Perl v5.8.0. =item ${^UNICODE} X<${^UNICODE}> @@ -2050,7 +2050,7 @@ the possible values. This variable is set during Perl startup and is thereafter read-only. -This variable was added in Perl 5.8.2. +This variable was added in Perl v5.8.2. =item ${^UTF8CACHE} X<${^UTF8CACHE}> @@ -2059,7 +2059,7 @@ This variable controls the state of the internal UTF-8 offset caching code. 1 for on (the default), 0 for off, -1 to debug the caching code by checking all its results against linear scans, and panicking on any discrepancy. -This variable was added in Perl 5.8.9. +This variable was added in Perl v5.8.9. =item ${^UTF8LOCALE} X<${^UTF8LOCALE}> @@ -2069,7 +2069,7 @@ startup. This information is used by perl when it's in adjust-utf8ness-to-locale mode (as when run with the C<-CL> command-line switch); see L<perlrun> for more info on this. -This variable was added in Perl 5.8.8. +This variable was added in Perl v5.8.8. =back @@ -2093,7 +2093,7 @@ See L<perldiag> for details about error messages. X<$#> X<$OFMT> C<$#> was a variable that could be used to format printed numbers. -After a deprecation cycle, its magic was removed in Perl 5.10 and +After a deprecation cycle, its magic was removed in Perl v5.10.0 and using it now triggers a warning: C<$# is no longer supported>. This is not the sigil you use in front of an array name to get the @@ -2102,19 +2102,19 @@ of an array in Perl. The two have nothing to do with each other. Deprecated in Perl 5. -Removed in Perl 5.10. +Removed in Perl v5.10.0. =item $* X<$*> C<$*> was a variable that you could use to enable multiline matching. -After a deprecation cycle, its magic was removed in Perl 5.10. +After a deprecation cycle, its magic was removed in Perl v5.10.0. Using it now triggers a warning: C<$* is no longer supported>. You should use the C</s> and C</m> regexp modifiers instead. Deprecated in Perl 5. -Removed in Perl 5.10. +Removed in Perl v5.10.0. =item $ARRAY_BASE @@ -2131,12 +2131,12 @@ directive, and cannot influence the behavior of any other file. (That's why you can only assign compile-time constants to it.) Its use is highly discouraged. -Prior to Perl 5.10, assignment to C<$[> could be seen from outer lexical +Prior to Perl v5.10.0, assignment to C<$[> could be seen from outer lexical scopes in the same file, unlike other compile-time directives (such as L<strict>). Using local() on it would bind its value strictly to a lexical block. Now it is always lexically scoped. -As of Perl 5.16, it is implemented by the L<arybase> module. See +As of Perl v5.16.0, it is implemented by the L<arybase> module. See L<arybase> for more details on its behaviour. Under C<use v5.16>, or C<no feature "array_base">, C<$[> no longer has any @@ -2145,7 +2145,7 @@ other value will produce an error. Mnemonic: [ begins subscripts. -Deprecated in Perl 5.12. +Deprecated in Perl v5.12.0. =item $OLD_PERL_VERSION diff --git a/t/porting/known_pod_issues.dat b/t/porting/known_pod_issues.dat index 9e9ae7bdae..42a1bca49e 100644 --- a/t/porting/known_pod_issues.dat +++ b/t/porting/known_pod_issues.dat @@ -274,7 +274,6 @@ pod/perlreguts.pod Verbatim line length including indents exceeds 79 by 17 pod/perlrequick.pod Verbatim line length including indents exceeds 79 by 3 pod/perlretut.pod Verbatim line length including indents exceeds 79 by 13 pod/perlrun.pod Verbatim line length including indents exceeds 79 by 2 -pod/perlsec.pod Verbatim line length including indents exceeds 79 by 1 pod/perlsolaris.pod Verbatim line length including indents exceeds 79 by 14 pod/perlsource.pod ? Should you be using F<...> or maybe L<...> instead of 1 pod/perlsub.pod ? Should you be using F<...> or maybe L<...> instead of 3 @@ -283,7 +282,6 @@ pod/perlsymbian.pod Verbatim line length including indents exceeds 79 by 20 pod/perlthrtut.pod Verbatim line length including indents exceeds 79 by 5 pod/perltie.pod Verbatim line length including indents exceeds 79 by 13 pod/perltrap.pod ? Should you be using F<...> or maybe L<...> instead of 1 -pod/perltrap.pod Verbatim line length including indents exceeds 79 by 15 pod/perltru64.pod ? Should you be using F<...> or maybe L<...> instead of 1 pod/perltru64.pod Verbatim line length including indents exceeds 79 by 4 pod/perlunifaq.pod empty section in previous paragraph 1 |