X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pod%2Fperlfunc.pod;h=80f1fe0cc821c3225994ecc6960bb55cb06e07d2;hb=f4dad39ef1a76c1f6bbf6733d7c2ee209381be78;hp=1a5e0e6846d64528dd1be840a67ac5fd04b247e0;hpb=a5871d1a83cd3d5c7292135cbb30a336a8552ab0;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 1a5e0e6..80f1fe0 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -657,7 +657,7 @@ Breaks the binding between a DBM file and a hash. [This function has been superseded by the tie() function.] -This binds a dbm(3), ndbm(3), sdbm(3), gdbm(), or Berkeley DB file to a +This binds a dbm(3), ndbm(3), sdbm(3), gdbm(3), or Berkeley DB file to a hash. HASH is the name of the hash. (Unlike normal open, the first argument is I a filehandle, even though it looks like one). DBNAME is the name of the database (without the F<.dir> or F<.pag> extension if @@ -1083,6 +1083,15 @@ use system() instead of exec() if you want it to return. It fails and returns FALSE only if the command does not exist I it is executed directly instead of via your system's command shell (see below). +Since it's a common mistake to use system() instead of exec(), Perl +warns you if there is a following statement which isn't die(), warn() +or exit() (if C<-w> is set - but you always do that). If you +I want to follow an exec() with some other statement, you +can use one of these styles to avoid the warning: + + exec ('foo') or print STDERR "couldn't exec foo"; + { exec ('foo') }; print STDERR "couldn't exec foo"; + If there is more than one argument in LIST, or if LIST is an array with more than one value, calls execvp(3) with the arguments in LIST. If there is only one scalar argument, the argument is checked for shell @@ -1279,7 +1288,7 @@ you're done. You should reopen those to /dev/null if it's any issue. =item format -Declare a picture format with use by the write() function. For +Declare a picture format for use by the write() function. For example: format Something = @@ -1600,7 +1609,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's index variable aliases the list +much like the way that a for loops's index variable aliases the list elements. That is, modifying an element of a list returned by grep (for example, in a C, C or another C) actually modifies the element in the original list. @@ -1812,8 +1821,8 @@ subroutine, C, or C. If more than one value is listed, the list must be placed in parentheses. See L for details, including issues with tied arrays and hashes. -But you really probably want to be using my() instead, because local() isn't -what most people think of as "local"). See L for details. =item localtime EXPR @@ -2636,8 +2645,26 @@ replaces "F<::>" with "F" in the filename for you, to make it easy to load standard modules. This form of loading of modules does not risk altering your namespace. -For a yet-more-powerful import facility, see L and -L. +In other words, if you try this: + + require Foo::Bar ; # a splendid bareword + +The require function will actually look for the "Foo/Bar.pm" file in the +directories specified in the @INC array. + +But if you try this : + + $class = 'Foo::Bar'; + require $class ; # $class is not a bareword +or + require "Foo::Bar" ; # not a bareword because of the "" + +The require function will look for the "Foo::Bar" file in the @INC array and +will complain about not finding "Foo::Bar" there. In this case you can do : + + eval "require $class"; + +For a yet-more-powerful import facility, see L and L. =item reset EXPR @@ -2981,7 +3008,7 @@ always sleep the full amount. For delays of finer granularity than one second, you may use Perl's syscall() interface to access setitimer(2) if your system supports it, -or else see L below. +or else see L above. See also the POSIX module's sigpause() function. @@ -3175,9 +3202,9 @@ splits on whitespace (after skipping any leading whitespace). Anything matching PATTERN is taken to be a delimiter separating the fields. (Note that the delimiter may be longer than one character.) -If LIMIT is specified and is not negative, splits into no more than -that many fields (though it may split into fewer). If LIMIT is -unspecified, trailing null fields are stripped (which potential users +If LIMIT is specified and is positive, splits into no more than that +many fields (though it may split into fewer). If LIMIT is unspecified +or zero, trailing null fields are stripped (which potential users of pop() would do well to remember). If LIMIT is negative, it is treated as if an arbitrarily large LIMIT had been specified. @@ -3326,7 +3353,7 @@ omitted, uses a semi-random value based on the current time and process ID, among other things. In versions of Perl prior to 5.004 the default seed was just the current time(). This isn't a particularly good seed, so many old programs supply their own seed value (often C