X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/d8ff3e95e0f2357b6f26f5a94c52c46231fb1a74..758600332df6396bd902fa4a761230f89664ecb8:/pod/perlfunc.pod diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 9394e22..af47dc2 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -522,6 +522,10 @@ argument is omitted, tests L|perlvar/$_>, except for C<-t>, which tests STDIN. Unless otherwise documented, it returns C<1> for true and C<''> for false. If the file doesn't exist or can't be examined, it returns L|/undef EXPR> and sets L|perlvar/$!> (errno). +With the exception of the C<-l> test they all follow symbolic links +because they use C and not C (so dangling symlinks can't +be examined and will therefore report failure). + Despite the funny names, precedence is the same as any other named unary operator. The operator may be any of: @@ -814,8 +818,8 @@ translation and marking it as bytes (as opposed to Unicode characters). Note that, despite what may be implied in I<"Programming Perl"> (the Camel, 3rd edition) or elsewhere, C<:raw> is I simply the inverse of C<:crlf>. Other layers that would affect the binary nature of the stream are -I disabled. See L, L, and the discussion about the -PERLIO environment variable. +I disabled. See L, and the discussion about the PERLIO +environment variable in L. The C<:bytes>, C<:crlf>, C<:utf8>, and any other directives of the form C<:...>, are called I/O I. The L pragma can be used to @@ -943,6 +947,10 @@ list context, caller returns # 0 1 2 my ($package, $filename, $line) = caller; +Like L|/__FILE__> and L|/__LINE__>, the filename and +line number returned here may be altered by the mechanism described at +L. + With EXPR, it returns some extra information that the debugger uses to print a stack trace. The value of EXPR indicates how many call frames to go back before the current one. @@ -1224,9 +1232,10 @@ change your current working directory, which is unaffected.) For security reasons, this call is restricted to the superuser. If FILENAME is omitted, does a L|/chroot FILENAME> to L|perlvar/$_>. -B It is good security practice to do C +B It is mandatory for security to C (L|/chdir EXPR> to the root directory) immediately after a -L|/chroot FILENAME>. +L|/chroot FILENAME>, otherwise the current working directory +may be outside of the new root. Portability issues: L. @@ -1904,7 +1913,7 @@ X X X =for Pod::Functions create an immediate core dump This function causes an immediate core dump. See also the B<-u> -command-line switch in L, which does the same thing. +command-line switch in L, which does the same thing. Primarily this is so that you can use the B program (not supplied) to turn your core dump into an executable binary after having initialized all your variables at the beginning of the @@ -2302,7 +2311,7 @@ Examples: If you want to trap errors when loading an XS module, some problems with the binary interface (such as Perl version skew) may be fatal even with C unless C<$ENV{PERL_DL_NONLAZY}> is set. See -L. +L. Using the C form as an exception trap in libraries does have some issues. Due to the current arguably broken state of C<__DIE__> hooks, you @@ -2616,8 +2625,8 @@ L>. For further information on casefolding, refer to the Unicode Standard, specifically sections 3.13 C, 4.2 C, and 5.18 C, -available at L, as well as the -Case Charts available at L. +available at L, as well as the +Case Charts available at L. If EXPR is omitted, uses L|perlvar/$_>. @@ -2696,6 +2705,8 @@ X<__FILE__> =for Pod::Functions the name of the current source file A special token that returns the name of the file in which it occurs. +It can be altered by the mechanism described at +L. =item fileno FILEHANDLE X @@ -3950,6 +3961,8 @@ X<__LINE__> =for Pod::Functions the current source line number A special token that compiles to the current line number. +It can be altered by the mechanism described at +L. =item link OLDFILE,NEWFILE X @@ -4481,9 +4494,10 @@ indicate that you want both read and write access to the file; thus C<< +< >> is almost always preferred for read/write updates--the C<< +> >> mode would clobber the file first. You can't usually use either read-write mode for updating textfiles, since they have -variable-length records. See the B<-i> switch in L for a -better approach. The file is created with permissions of C<0666> -modified by the process's L|/umask EXPR> value. +variable-length records. See the B<-i> switch in +L for a better approach. The file is +created with permissions of C<0666> modified by the process's +L|/umask EXPR> value. These various prefixes correspond to the L modes of C, C, C, C, C, and C. @@ -6032,7 +6046,7 @@ This protects against those locales where characters such as C<"|"> are considered to be word characters. Otherwise, Perl quotes non-ASCII characters using an adaptation from -Unicode (see L). +Unicode (see L). The only code points that are quoted are those that have any of the Unicode properties: Pattern_Syntax, Pattern_White_Space, White_Space, Default_Ignorable_Code_Point, or General_Category=Control. @@ -6266,7 +6280,7 @@ multi-line) string. In list context, returns a list of lines C<$INPUT_RECORD_SEPARATOR> in L)). This is the internal function implementing the C operator, but you can use it directly. The C -operator is discussed in more detail in L. +operator is discussed in more detail in L/>">. If EXPR is omitted, uses L|perlvar/$_>. =item recv SOCKET,SCALAR,LENGTH,FLAGS @@ -6375,7 +6389,9 @@ C, C, C, or C, indicating only which kind of object it is. If the unblessed referent is a scalar, then the return value will be one of the strings C, C, C, C, C, or C, depending on the kind of value the scalar -currently has. Beware that these built-in type names can also be used as +currently has. But note that C scalars are created already +blessed, so C will likely return C. Beware that +these built-in type names can also be used as class names, so C returning one of these names doesn't unambiguously indicate that the referent is of the kind to which the name refers. @@ -6648,7 +6664,8 @@ Generally used in a L|/continue BLOCK> block at the end of a loop to clear variables and reset C searches so that they work again. The expression is interpreted as a list of single characters (hyphens -allowed for ranges). All variables and arrays beginning with one of +allowed for ranges). All variables (scalars, arrays, and hashes) +in the current package beginning with one of those letters are reset to their pristine state. If the expression is omitted, one-match searches (C) are reset to match again. Only resets variables or searches in the current package. Always returns @@ -6661,6 +6678,7 @@ Only resets variables or searches in the current package. Always returns Resetting C<"A-Z"> is not recommended because you'll wipe out your L|perlvar/@ARGV> and L|perlvar/@INC> arrays and your L|perlvar/%ENV> hash. + Resets only package variables; lexical variables are unaffected, but they clean themselves up on scope exit anyway, so you'll probably want to use them instead. See L|/my VARLIST>. @@ -6674,8 +6692,8 @@ X Returns from a subroutine, L|/eval EXPR>, L|/do EXPR>, L|/sort SUBNAME LIST> block or regex -eval block (but not a L|/grep BLOCK LIST> or -L|/map BLOCK LIST> block) with the value +eval block (but not a L|/grep BLOCK LIST>, +L|/map BLOCK LIST>, or L|/do BLOCK> block) with the value given in EXPR. Evaluation of EXPR may be in list, scalar, or void context, depending on how the return value will be used, and the context may vary from one execution to the next (see @@ -6781,8 +6799,8 @@ X =for Pod::Functions +say output a list to a filehandle, appending a newline Just like L|/print FILEHANDLE LIST>, but implicitly appends a -newline. C is simply an abbreviation for -C<{ local $\ = "\n"; print LIST }>. To use FILEHANDLE without a LIST to +newline at the end of the LIST instead of any value L|perlvar/$\> +might have. To use FILEHANDLE without a LIST to print the contents of L|perlvar/$_> to it, you must use a bareword filehandle like C, not an indirect one like C<$fh>. @@ -8057,8 +8075,8 @@ as supported by the compiler used to build Perl: h interpret integer as C type "short" or "unsigned short" j interpret integer as C type "intmax_t" on Perl - 5.14 or later; and only with a C99 compiler - prior to Perl 5.30 (unportable) + 5.14 or later; and prior to Perl 5.30, only with + a C99 compiler (unportable) l interpret integer as C type "long" or "unsigned long" q, L, or ll interpret integer as C type "long long", @@ -8725,7 +8743,7 @@ X X Sets FILEHANDLE's system position I using L. FILEHANDLE may be an expression whose value gives the name of the filehandle. The values -for WHENCE are C<0> to set the new position to POSITION; C<1> to set the it +for WHENCE are C<0> to set the new position to POSITION; C<1> to set it to the current position plus POSITION; and C<2> to set it to EOF plus POSITION, typically negative. @@ -9507,9 +9525,10 @@ I meant to be used to assert that the running Perl is of a earlier version than its argument and I to undo the feature-enabling side effects of C. -See L for a list of standard modules and pragmas. See L -for the C<-M> and C<-m> command-line options to Perl that give -L|/use Module VERSION LIST> functionality from the command-line. +See L for a list of standard modules and pragmas. See +L for the C<-M> and C<-m> command-line +options to Perl that give L|/use Module VERSION LIST> +functionality from the command-line. =item utime LIST X @@ -9661,10 +9680,8 @@ to try to write off the beginning of the string (i.e., negative OFFSET). If the string happens to be encoded as UTF-8 internally (and thus has the UTF8 flag set), L|/vec EXPR,OFFSET,BITS> tries to convert it to use a one-byte-per-character internal representation. However, if the -string contains characters with values of 256 or higher, that conversion -will fail, and a deprecation message will be raised. In that situation, -C will operate on the underlying buffer regardless, in its internal -UTF-8 representation. In Perl 5.32, this will be a fatal error. +string contains characters with values of 256 or higher, a fatal error +will occur. Strings created with L|/vec EXPR,OFFSET,BITS> can also be manipulated with the logical