Install Perl 5.8.8
[msysgit.git] / mingw / html / lib / filetest.html
blob3c948dc3ebbebf7147128267903a4b34e4227e55
1 <?xml version="1.0" ?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5 <title>filetest - Perl pragma to control the filetest permission operators</title>
6 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
7 <link rev="made" href="mailto:" />
8 </head>
10 <body style="background-color: white">
11 <table border="0" width="100%" cellspacing="0" cellpadding="3">
12 <tr><td class="block" style="background-color: #cccccc" valign="middle">
13 <big><strong><span class="block">&nbsp;filetest - Perl pragma to control the filetest permission operators</span></strong></big>
14 </td></tr>
15 </table>
17 <p><a name="__index__"></a></p>
18 <!-- INDEX BEGIN -->
20 <ul>
22 <li><a href="#name">NAME</a></li>
23 <li><a href="#synopsis">SYNOPSIS</a></li>
24 <li><a href="#description">DESCRIPTION</a></li>
25 <ul>
27 <li><a href="#subpragma_access">subpragma access</a></li>
28 </ul>
30 </ul>
31 <!-- INDEX END -->
33 <hr />
34 <p>
35 </p>
36 <h1><a name="name">NAME</a></h1>
37 <p>filetest - Perl pragma to control the filetest permission operators</p>
38 <p>
39 </p>
40 <hr />
41 <h1><a name="synopsis">SYNOPSIS</a></h1>
42 <pre>
43 $can_perhaps_read = -r &quot;file&quot;; # use the mode bits
45 use filetest 'access'; # intuit harder
46 $can_really_read = -r &quot;file&quot;;
48 $can_perhaps_read = -r &quot;file&quot;; # use the mode bits again</pre>
49 <p>
50 </p>
51 <hr />
52 <h1><a name="description">DESCRIPTION</a></h1>
53 <p>This pragma tells the compiler to change the behaviour of the filetest
54 permission operators, <code>-r</code> <code>-w</code> <code>-x</code> <code>-R</code> <code>-W</code> <a href="file://C|\msysgit\mingw\html/pod/perlfunc.html#item__2dx"><code>-X</code></a>
55 (see <a href="file://C|\msysgit\mingw\html/pod/perlfunc.html">the perlfunc manpage</a>).</p>
56 <p>The default behaviour is to use the mode bits as returned by the <a href="file://C|\msysgit\mingw\html/pod/perlfunc.html#item_stat"><code>stat()</code></a>
57 family of calls. This, however, may not be the right thing to do if
58 for example various ACL (access control lists) schemes are in use.
59 For such environments, <code>use filetest</code> may help the permission
60 operators to return results more consistent with other tools.</p>
61 <p>Each ``use filetest'' or ``no filetest'' affects statements to the end of
62 the enclosing block.</p>
63 <p>There may be a slight performance decrease in the filetests
64 when <code>use filetest</code> is in effect, because in some systems
65 the extended functionality needs to be emulated.</p>
66 <p><strong>NOTE</strong>: using the file tests for security purposes is a lost cause
67 from the start: there is a window open for race conditions (who is to
68 say that the permissions will not change between the test and the real
69 operation?). Therefore if you are serious about security, just try
70 the real operation and test for its success - think in terms of atomic
71 operations.</p>
72 <p>
73 </p>
74 <h2><a name="subpragma_access">subpragma access</a></h2>
75 <p>Currently only one subpragma, <code>access</code> is implemented. It enables
76 (or disables) the use of <code>access()</code> or similar system calls. This
77 extended filetest functionality is used only when the argument of the
78 operators is a filename, not when it is a filehandle.</p>
79 <table border="0" width="100%" cellspacing="0" cellpadding="3">
80 <tr><td class="block" style="background-color: #cccccc" valign="middle">
81 <big><strong><span class="block">&nbsp;filetest - Perl pragma to control the filetest permission operators</span></strong></big>
82 </td></tr>
83 </table>
85 </body>
87 </html>