In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/4fb67938d761c2c60668d0aa0ff50b0f31fe2b26?hp=858a358bdd94da8251cdb2210d9bec7c1bbe7464>
- Log ----------------------------------------------------------------- commit 4fb67938d761c2c60668d0aa0ff50b0f31fe2b26 Author: Father Chrysostomos <[email protected]> Date: Sat Feb 19 20:25:44 2011 -0800 perlfunc/-X: rearrange slightly and note llafr exemption The paragraphs explaining -x -r -w and -T -B have grown over time, obscuring the bit about the syntax, so Iâve moved it up. I have also expanded it to note its exemption from the âlooks like a functionâ rule (which is currently mentioned only in perlop, if I remember correctly). M pod/perlfunc.pod commit 5dac7880bdc477876b4ad267f3889e0371bfc070 Author: Father Chrysostomos <[email protected]> Date: Sat Feb 19 19:19:18 2011 -0800 perlfunc tweaks Notable changes, apart from grammar and punctuation: â¢Â âIn generalâ in conjunction with âallâ is slightly contradictory ⢠wait, waitpid, and syscall are not the only functions that do not return undef on failure M pod/perlfunc.pod ----------------------------------------------------------------------- Summary of changes: pod/perlfunc.pod | 30 ++++++++++++++++++++---------- 1 files changed, 20 insertions(+), 10 deletions(-) diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 8a486a8..309e577 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -79,10 +79,10 @@ there, not the list construction version of the comma. That means it was never a list to start with. In general, functions in Perl that serve as wrappers for system calls ("syscalls") -of the same name (like chown(2), fork(2), closedir(2), etc.) all return +of the same name (like chown(2), fork(2), closedir(2), etc.) return true when they succeed and C<undef> otherwise, as is usually mentioned in the descriptions below. This is different from the C interfaces, -which return C<-1> on failure. Exceptions to this rule are C<wait>, +which return C<-1> on failure. Exceptions to this rule include C<wait>, C<waitpid>, and C<syscall>. System calls also set the special C<$!> variable on failure. Other functions do not, except accidentally. @@ -146,7 +146,7 @@ C<readdir>, C<rewinddir>, C<say>, C<seek>, C<seekdir>, C<select>, C<syscall>, C<sysread>, C<sysseek>, C<syswrite>, C<tell>, C<telldir>, C<truncate>, C<warn>, C<write> -=item Functions for fixed length data or records +=item Functions for fixed-length data or records C<pack>, C<read>, C<syscall>, C<sysread>, C<syswrite>, C<unpack>, C<vec> @@ -349,6 +349,20 @@ Example: #... } +Note that C<-s/a/b/> does not do a negated substitution. Saying +C<-exp($foo)> still works as expected, however: only single letters +following a minus are interpreted as file tests. + +These operators are exempt from the "looks like a function rule" described +above. That is, an opening parenthesis after the operator does not affect +how much of the following code constitutes the argument. Put the opening +parentheses before the operator to separate it from code that follows (this +applies only to operators with higher precedence than unary operators, of +course): + + -s($file) + 1024 # probably wrong; same as -s($file + 1024) + (-s $file) + 1024 # correct + The interpretation of the file permission operators C<-r>, C<-R>, C<-w>, C<-W>, C<-x>, and C<-X> is by default based solely on the mode of the file and the uids and gids of the user. There may be other @@ -367,8 +381,8 @@ or temporarily set their effective uid to something else. If you are using ACLs, there is a pragma called C<filetest> that may produce more accurate results than the bare stat() mode bits. -When under the C<use filetest 'access'> the above-mentioned filetests -test whether the permission can (not) be granted using the +When under C<use filetest 'access'> the above-mentioned filetests +test whether the permission can(not) be granted using the access(2) family of system calls. Also note that the C<-x> and C<-X> may under this pragma return true even if there are no execute permission bits set (nor any extra execute permission ACLs). This strangeness is @@ -378,10 +392,6 @@ filehandle won't cache the results of the file tests when this pragma is in effect. Read the documentation for the C<filetest> pragma for more information. -Note that C<-s/a/b/> does not do a negated substitution. Saying -C<-exp($foo)> still works as expected, however: only single letters -following a minus are interpreted as file tests. - The C<-T> and C<-B> switches work as follows. The first block or so of the file is examined for odd characters such as strange control codes or characters with the high bit set. If too many strange characters (>30%) @@ -393,7 +403,7 @@ file, or a file at EOF when testing a filehandle. Because you have to read a file to do the C<-T> test, on most occasions you want to use a C<-f> against the file first, as in C<next unless -f $file && -T $file>. -If any of the file tests (or either the C<stat> or C<lstat> operators) are given +If any of the file tests (or either the C<stat> or C<lstat> operator) is given the special filehandle consisting of a solitary underline, then the stat structure of the previous file test (or stat operator) is used, saving a system call. (This doesn't work with C<-t>, and you need to remember -- Perl5 Master Repository
