diff options
Diffstat (limited to 'pod')
-rw-r--r-- | pod/perlcall.pod | 2 | ||||
-rw-r--r-- | pod/perldebug.pod | 2 | ||||
-rw-r--r-- | pod/perldelta.pod | 95 | ||||
-rw-r--r-- | pod/perldiag.pod | 9 | ||||
-rw-r--r-- | pod/perlfunc.pod | 2 | ||||
-rw-r--r-- | pod/perlguts.pod | 8 | ||||
-rw-r--r-- | pod/perllocale.pod | 6 | ||||
-rw-r--r-- | pod/perlop.pod | 2 | ||||
-rw-r--r-- | pod/perlsub.pod | 13 | ||||
-rw-r--r-- | pod/perltie.pod | 28 | ||||
-rw-r--r-- | pod/perltoc.pod | 19 | ||||
-rw-r--r-- | pod/perltrap.pod | 20 |
12 files changed, 119 insertions, 87 deletions
diff --git a/pod/perlcall.pod b/pod/perlcall.pod index dc965009d6..9a4a886a59 100644 --- a/pod/perlcall.pod +++ b/pod/perlcall.pod @@ -565,7 +565,7 @@ Next, we come to XPUSHs. This is where the parameters actually get pushed onto the stack. In this case we are pushing a string and an integer. -See the L<perlguts/"XSUBs and the Argument Stack"> for details +See the L<perlguts/"XSUB's and the Argument Stack"> for details on how the XPUSH macros work. =item 6. diff --git a/pod/perldebug.pod b/pod/perldebug.pod index 0c61b74350..a682de1ade 100644 --- a/pod/perldebug.pod +++ b/pod/perldebug.pod @@ -465,8 +465,6 @@ corresponds to F</dev/ttyc>, say, by issuing a command like See L<"Debugger Internals"> below for more details. -=over 12 - =item E<lt> [ command ] Set an action (Perl command) to happen before every debugger prompt. diff --git a/pod/perldelta.pod b/pod/perldelta.pod index 734e940b42..cf6036ff02 100644 --- a/pod/perldelta.pod +++ b/pod/perldelta.pod @@ -27,12 +27,17 @@ might have symbol conflicts if you embed Perl in another application, just as in the 5.003 release. By default, binary compatibility is preserved at the expense of symbol table pollution. -=head2 New Opcode Module and Revised Safe Module +=head2 Subroutine Parameters Are Not Autovivified -A new Opcode module supports the creation, manipulation and -application of opcode masks. The revised Safe module has a new API -and is implemented using the new Opcode module. Please read the new -Opcode and Safe documentation. +In Perl versions 5.002 and 5.003, array and hash elements used as +subroutine parameters were "autovivified"; that is, they were brought +into existence if they did not already exist. For example, calling +C<func($h{foo})> would create C<$h{foo}> if it did not already exist, +causing C<exists $h{foo}> to become true and C<keys %h> to return +C<('foo')>. + +Perl 5.004 returns to the pre-5.002 behavior of I<not> autovivifying +array and hash elements used as subroutine parameters. =head2 Fixed Parsing of $$<digit>, &$<digit>, etc. @@ -52,6 +57,13 @@ previously-working script to now fail -- which should be construed as a blessing, since that indicates a potentially-serious security hole was just plugged. +=head2 New Opcode Module and Revised Safe Module + +A new Opcode module supports the creation, manipulation and +application of opcode masks. The revised Safe module has a new API +and is implemented using the new Opcode module. Please read the new +Opcode and Safe documentation. + =head2 Internal Change: FileHandle Class Based on IO::* Classes File handles are now stored internally as type IO::Handle. The @@ -222,7 +234,7 @@ would yield the same sequence of random numbers on most or all machines. Now, when perl sees that you're calling C<rand> and haven't yet called C<srand>, it calls C<srand> with the default seed. You should still call C<srand> manually if your code might ever be run on a pre-5.004 system, -of course, or if you want a seed other than the default. +of course, or if you want a seed other than the default. =item $_ as Default @@ -241,8 +253,8 @@ zero-width assertion. See L<perlop> and L<perlre>. =item nested C<sub{}> closures work now -Prior to the 5.004 release, nested anonymous functions -didn't work right. They do now. +Prior to the 5.004 release, nested anonymous functions didn't work +right. They do now. =item formats work right on changing lexicals @@ -258,7 +270,7 @@ before, and is fine now: $i . write; - } + } =back @@ -324,9 +336,9 @@ This is the constructor for the class. That means it is expected to return an object of some sort. The reference can be used to hold some internal information. - sub TIEHANDLE { - print "<shout>\n"; - my $i; + sub TIEHANDLE { + print "<shout>\n"; + my $i; return bless \$i, shift; } @@ -336,29 +348,46 @@ This method will be triggered every time the tied handle is printed to. Beyond its self reference it also expects the list that was passed to the print function. - sub PRINT { - $r = shift; - $$r++; + sub PRINT { + $r = shift; + $$r++; return print join( $, => map {uc} @_), $\; } +=item READ this LIST + +This method will be called when the handle is read from via the C<read> +or C<sysread> functions. + + sub READ { + $r = shift; + my($buf,$len,$offset) = @_; + print "READ called, \$buf=$buf, \$len=$len, \$offset=$offset"; + } + =item READLINE this This method will be called when the handle is read from. The method should return undef when there is no more data. - sub READLINE { - $r = shift; - return "PRINT called $$r times\n"; + sub READLINE { + $r = shift; + return "PRINT called $$r times\n" } +=item GETC this + +This method will be called when the C<getc> function is called. + + sub GETC { print "Don't GETC, Get Perl"; return "a"; } + =item DESTROY this As with the other types of ties, this method will be called when the tied handle is about to be destroyed. This is useful for debugging and possibly for cleaning up. - sub DESTROY { + sub DESTROY { print "</shout>\n"; } @@ -366,8 +395,15 @@ possibly for cleaning up. =head2 Malloc Enhancements -If perl's malloc() is used, you can print memory statistics at runtime -by running Perl thusly: +Four new compilation flags are recognized by malloc.c. (They have no +effect if perl is compiled with system malloc().) + +=over + +=item -DDEBUGGING_MSTATS + +If perl is compiled with C<DEBUGGING_MSTATS> defined, you can print +memory statistics at runtime by running Perl thusly: env PERL_DEBUG_MSTATS=2 perl your_script_here @@ -376,11 +412,6 @@ exit; with a value of 1, the statistics ares printed only on exit. (If you want the statistics at an arbitrary time, you'll need to install the optional module Devel::Peek.) -In addition, three new compilation flags are recognized by malloc.c. -(They have no effect if perl is compiled with system malloc().) - -=over - =item -DEMERGENCY_SBRK If this macro is defined, running out of memory need not be a fatal @@ -498,7 +529,7 @@ New constants in the existing Fcntl modules are now supported, provided that your operating system happens to support them: F_GETOWN F_SETOWN - O_ASYNC O_DEFER O_DSYNC O_FSYNC O_SYNC + O_ASYNC O_DEFER O_DSYNC O_FSYNC O_SYNC O_EXLOCK O_SHLOCK These constants are intended for use with the Perl operators sysopen() @@ -747,7 +778,7 @@ Although not new, this has been massively updated. Several new conditions will trigger warnings that were silent before. Some only affect certain platforms. -The following new warnings and errors outline these. +The following new warnings and errors outline these. These messages are classified as follows (listed in increasing order of desperation): @@ -906,7 +937,7 @@ used.) You probably wrote something like this: - @list = qw( + @list = qw( a # a comment b # another comment ); @@ -914,7 +945,7 @@ You probably wrote something like this: when you should have written this: @list = qw( - a + a b ); @@ -933,7 +964,7 @@ aren't needed to separate the items. (You may have used different delimiters than the parentheses shown here; braces are also frequently used.) -You probably wrote something like this: +You probably wrote something like this: qw! a, b, c !; @@ -1077,4 +1108,4 @@ Constructed by Tom Christiansen, grabbing material with permission from innumerable contributors, with kibitzing by more than a few Perl porters. -Last update: Tue Jan 14 14:03:02 EST 1997 +Last update: Sat Mar 8 19:51:26 EST 1997 diff --git a/pod/perldiag.pod b/pod/perldiag.pod index c21e28a913..24b16128dd 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -180,6 +180,15 @@ the return value of your socket() call? See L<perlfunc/accept>. (F) You can't allocate more than 2^31+"small amount" bytes. +=item Applying %s to %s will act on scalar(%s) + +(W) The pattern match (//), substitution (s///), and translation (tr///) +operators work on scalar values. If you apply one of them to an array +or a hash, it will convert the array or hash to a scalar value -- the +length of an array, or the population info of a hash -- and then work on +that scalar value. This is probably not what you meant to do. See +L<perlfunc/grep> and L<perlfunc/map> for alternatives. + =item Arg too short for msgsnd (F) msgsnd() requires a string at least as long as sizeof(long). diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 09b5ad3df7..eb7276a3b4 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -1517,7 +1517,7 @@ Note that, because $_ is a reference into the list value, it can be used to modify the elements of the array. While this is useful and supported, it can cause bizarre results if the LIST is not a named array. Similarly, grep returns aliases into the original list, -much like the way that L<foreach>'s index variable aliases the list +much like the way that L<Foreach Loops>'s index variable aliases the list elements. That is, modifying an element of a list returned by grep actually modifies the element in the original list. diff --git a/pod/perlguts.pod b/pod/perlguts.pod index 21e4b2c789..8c78802fb4 100644 --- a/pod/perlguts.pod +++ b/pod/perlguts.pod @@ -162,7 +162,7 @@ bus error, or just weird results. Change the zero to C<&sv_undef> in the first line and all will be well. To free an SV that you've created, call C<SvREFCNT_dec(SV*)>. Normally this -call is not necessary (see the section on L<Mortality>). +call is not necessary (see the section on L<Reference Counts and Mortality>). =head2 What's Really Stored in an SV? @@ -422,8 +422,8 @@ A reference can be blessed into a package with the following function: SV* sv_bless(SV* sv, HV* stash); The C<sv> argument must be a reference. The C<stash> argument specifies -which class the reference will belong to. See the section on L<Stashes> -for information on converting class names into stashes. +which class the reference will belong to. See the section on +L<Stashes and Globs> for information on converting class names into stashes. /* Still under construction */ @@ -995,7 +995,7 @@ The correspondence between OP's and I<target>s is not 1-to-1. Different OP's in the compile tree of the unit can use the same target, if this would not conflict with the expected life of the temporary. -=head2 Scratchpads and recursions +=head2 Scratchpads and recursion In fact it is not 100% true that a compiled unit contains a pointer to the scratchpad AV. In fact it contains a pointer to an AV of diff --git a/pod/perllocale.pod b/pod/perllocale.pod index 9ac77b8e48..d393b81483 100644 --- a/pod/perllocale.pod +++ b/pod/perllocale.pod @@ -63,7 +63,7 @@ C<define>. If you want a Perl application to process and present your data according to a particular locale, the application code should include -the S<C<use locale>> pragma (see L<The use locale Pragma>) where +the S<C<use locale>> pragma (see L<The use locale pragma>) where appropriate, and B<at least one> of the following must be true: =over 4 @@ -345,7 +345,7 @@ call strxfrm() for both their operands, then do a byte-by-byte comparison of the transformed strings. By calling strxfrm() explicitly, and using a non locale-affected comparison, the example attempts to save a couple of transformations. In fact, it doesn't save anything: Perl -magic (see L<perlguts/Magic>) creates the transformed version of a +magic (see L<perlguts/Magic Variables>) creates the transformed version of a string the first time it's needed in a comparison, then keeps it around in case it's needed again. An example rewritten the easy way with C<cmp> runs just about as fast. It also copes with null characters @@ -703,7 +703,7 @@ L<The setlocale function>) was always in force, even if the program environment suggested otherwise. By default, Perl still behaves this way so as to maintain backward compatibility. If you want a Perl application to pay attention to locale information, you B<must> use -the S<C<use locale>> pragma (see L<The S<C<use locale>> Pragma>) to +the S<C<use locale>> pragma (see L<The use locale Pragma>) to instruct it to do so. Versions of Perl from 5.002 to 5.003 did use the C<LC_CTYPE> diff --git a/pod/perlop.pod b/pod/perlop.pod index 88a8af0fd4..71794fa759 100644 --- a/pod/perlop.pod +++ b/pod/perlop.pod @@ -88,7 +88,7 @@ Also parsed as terms are the C<do {}> and C<eval {}> constructs, as well as subroutine and method calls, and the anonymous constructors C<[]> and C<{}>. -See also L<Quote and Quote-Like Operators> toward the end of this section, +See also L<Quote and Quote-like Operators> toward the end of this section, as well as L<"I/O Operators">. =head2 The Arrow Operator diff --git a/pod/perlsub.pod b/pod/perlsub.pod index a38d05be25..9d725abe0d 100644 --- a/pod/perlsub.pod +++ b/pod/perlsub.pod @@ -48,15 +48,8 @@ there's really no difference from the language's perspective.) Any arguments passed to the routine come in as the array @_. Thus if you called a function with two arguments, those would be stored in C<$_[0]> and C<$_[1]>. The array @_ is a local array, but its values are implicit -references (predating L<perlref>) to the actual scalar parameters. What -this means in practice is that when you explicitly modify C<$_[0]> et al., -you will be changing the actual arguments. As a result, all arguments -to functions are treated as lvalues. Any hash or array elements that are -passed to functions will get created if they do not exist (irrespective -of whether the function does modify the contents of C<@_>). This is -frequently a source of surprise. See L<perltrap> for an example. - -The return value of the subroutine is the value of the last expression +references (predating L<perlref>) to the actual scalar parameters. The +return value of the subroutine is the value of the last expression evaluated. Alternatively, a return statement may be used to specify the returned value and exit the subroutine. If you return one or more arrays and/or hashes, these will be flattened together into one large @@ -503,7 +496,7 @@ Even if you don't want to modify an array, this mechanism is useful for passing multiple arrays in a single LIST, because normally the LIST mechanism will merge all the array values so that you can't extract out the individual arrays. For more on typeglobs, see -L<perldata/"Typeglobs and FileHandles">. +L<perldata/"Typeglobs and Filehandles">. =head2 Pass by Reference diff --git a/pod/perltie.pod b/pod/perltie.pod index ffd348fcc1..8dc7c17c14 100644 --- a/pod/perltie.pod +++ b/pod/perltie.pod @@ -413,7 +413,7 @@ Here's the constructor: It's probably worth mentioning that if you're going to filetest the return values out of a readdir, you'd better prepend the directory in question. Otherwise, because we didn't chdir() there, it would -have been testing the wrong file. +have been testing the wrong file. =item FETCH this, key @@ -610,8 +610,9 @@ use the each() function to iterate over such. Example: This is partially implemented now. -A class implementing a tied filehandle should define the following methods: -TIEHANDLE, PRINT and/or READLINE, and possibly DESTROY. +A class implementing a tied filehandle should define the following +methods: TIEHANDLE, at least one of PRINT, READLINE, GETC, or READ, +and possibly DESTROY. It is especially useful when perl is embedded in some other program, where output to STDOUT and STDERR may have to be redirected in some @@ -639,13 +640,30 @@ the print function. sub PRINT { $r = shift; $$r++; print join($,,map(uc($_),@_)),$\ } +=item READ this LIST + +This method will be called when the handle is read from via the C<read> +or C<sysread> functions. + + sub READ { + $r = shift; + my($buf,$len,$offset) = @_; + print "READ called, \$buf=$buf, \$len=$len, \$offset=$offset"; + } + =item READLINE this -This method will be called when the handle is read from. The method -should return undef when there is no more data. +This method will be called when the handle is read from via <HANDLE>. +The method should return undef when there is no more data. sub READLINE { $r = shift; "PRINT called $$r times\n"; } +=item GETC this + +This method will be called when the C<getc> function is called. + + sub GETC { print "Don't GETC, Get Perl"; return "a"; } + =item DESTROY this As with the other types of ties, this method will be called when the diff --git a/pod/perltoc.pod b/pod/perltoc.pod index 9e943d1623..eb59cda02e 100644 --- a/pod/perltoc.pod +++ b/pod/perltoc.pod @@ -50,12 +50,14 @@ expression enhancements, Innumerable Unbundled Modules, Compilability =item Compilation Option: Binary Compatibility With 5.003 -=item New Opcode Module and Revised Safe Module +=item Subroutine Parameters Are Not Autovivified =item Fixed Parsing of $$<digit>, &$<digit>, etc. =item Changes to Tainting Checks +=item New Opcode Module and Revised Safe Module + =item Internal Change: FileHandle Class Based on IO::* Classes =item Internal Change: PerlIO internal IO abstraction interface @@ -78,11 +80,12 @@ isa(CLASS), can(METHOD), VERSION( [NEED] ) =item TIEHANDLE Now Supported -TIEHANDLE classname, LIST, PRINT this, LIST, READLINE this, DESTROY this +TIEHANDLE classname, LIST, PRINT this, LIST, READ this LIST, READLINE this, +GETC this, DESTROY this =item Malloc Enhancements --DEMERGENCY_SBRK, -DPACK_MALLOC, -DTWO_POT_OPTIMIZE +-DDEBUGGING_MSTATS, -DEMERGENCY_SBRK, -DPACK_MALLOC, -DTWO_POT_OPTIMIZE =item Miscellaneous Efficiency Enhancements @@ -962,7 +965,8 @@ this, NEXTKEY this, lastkey, DESTROY this =item Tying FileHandles -TIEHANDLE classname, LIST, PRINT this, LIST, READLINE this, DESTROY this +TIEHANDLE classname, LIST, PRINT this, LIST, READ this LIST, READLINE this, +GETC this, DESTROY this =item The C<untie> Gotcha @@ -1172,8 +1176,7 @@ Regular Expression =item Subroutine, Signal, Sorting Traps -Subroutine calls provide lvalue context to arguments, (Signals), (Sort -Subroutine), warn() won't let you specify a filehandle +(Signals), (Sort Subroutine), warn() won't let you specify a filehandle =item OS Traps @@ -1480,7 +1483,7 @@ B<PerlIO_get_base(f)>, B<PerlIO_get_bufsiz(f)> =item Scratchpads -=item Scratchpads and recursions +=item Scratchpads and recursion =back @@ -3624,6 +3627,6 @@ don't all have manual pages yet: =head1 AUTHOR -Larry Wall E<lt>F<larry@wall.org>E<gt>, with the help of oodles +Larry Wall <F<larry@wall.org>>, with the help of oodles of other folks. diff --git a/pod/perltrap.pod b/pod/perltrap.pod index 6f6688701f..17c576df2f 100644 --- a/pod/perltrap.pod +++ b/pod/perltrap.pod @@ -1137,26 +1137,6 @@ general subroutine traps. Includes some OS-Specific traps. =over 5 -=item * Subroutine calls provide lvalue context to arguments - -Beginning with version 5.002, all subroutine arguments are consistently -given a "value may be modified" context, since all subroutines are able -to modify their arguments by explicitly referring to C<$_[0]> etc. -This means that any array and hash elements provided as arguments -will B<always be created> if they did not exist at the time -the subroutine is called. (perl5 versions before 5.002 used to provide -lvalue context for the second and subsequent arguments, and perl4 did -not provide lvalue context to subroutine arguments at all--even though -arguments were supposedly modifiable in perl4). - - sub test { $_[0] = 1; $_[1] = 2; $_[2] = 3; } - &test($foo{'bar'}, $bar{'foo'}, $foo[5]); - print join(':', %foo), '|', join(':',%bar), '|', join(':',@foo); - - # perl4 prints: || - # perl5 < 5.002 prints: |foo:2|:::::3 - # perl5 >= 5.002 prints: bar:1|foo:2|:::::3 - =item * (Signals) Barewords that used to look like strings to Perl will now look like subroutine |