Seth Woolley's Man Viewer

filetest(3) - filetest - Perl pragma to control the filetest permission operators - man 3 filetest

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

filetest(3)            Perl Programmers Reference Guide            filetest(3)



NAME
       filetest - Perl pragma to control the filetest permission operators

SYNOPSIS
           $can_perhaps_read = -r "file(1,n)";      # use the mode bits
           {
               use filetest 'access(2,5)';          # intuit harder
               $can_really_read = -r "file(1,n)";
           }
           $can_perhaps_read = -r "file(1,n)";      # use the mode bits again

DESCRIPTION
       This pragma tells the compiler to change the behaviour of the filetest
       permission operators, "-r" "-w" "-x" "-R" "-W" "-X" (see perlfunc).

       The default behaviour is to use the mode bits as returned by the stat(1,2)()
       family of calls.  This, however, may not be the right thing to do if(3,n)
       for example various ACL (access(2,5) control lists) schemes are in(1,8) use.  For
       such environments, "use filetest" may help the permission operators to
       return results more consistent with other tools.

       Each "use filetest" or "no filetest" affects statements to the end of
       the enclosing block.

       There may be a slight performance decrease in(1,8) the filetests when "use
       filetest" is in(1,8) effect, because in(1,8) some systems the extended function-
       ality needs to be emulated.

       NOTE: using the file(1,n) tests for security purposes is a lost cause from
       the start: there is a window open(2,3,n) for race conditions (who is to say
       that the permissions will not change between the test and the real
       operation?).  Therefore if(3,n) you are serious about security, just try the
       real operation and test for its success - think in(1,8) terms of atomic
       operations.

       subpragma access(2,5)

       Currently only one subpragma, "access(2,5)" is implemented.  It enables (or
       disables) the use of access(2,5)() or similar system calls.  This extended
       filetest functionality is used only when the argument of the operators
       is a filename, not when it is a filehandle.



perl v5.8.5                       2001-09-21                       filetest(3)

References for this manual (incoming links)