home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_f264a355e1378d009729c1bc435fdcf6
< prev
next >
Wrap
Text File
|
2000-03-23
|
3KB
|
90 lines
<HTML>
<HEAD>
<TITLE>filetest - Perl pragma to control the filetest permission operators</TITLE>
<LINK REL="stylesheet" HREF="../Active.css" TYPE="text/css">
<LINK REV="made" HREF="mailto:">
</HEAD>
<BODY>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> filetest - Perl pragma to control the filetest permission operators</P></STRONG>
</TD></TR>
</TABLE>
<A NAME="__index__"></A>
<!-- INDEX BEGIN -->
<UL>
<LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
<LI><A HREF="#synopsis">SYNOPSIS</A></LI>
<LI><A HREF="#description">DESCRIPTION</A></LI>
<UL>
<LI><A HREF="#subpragma access">subpragma access</A></LI>
</UL>
</UL>
<!-- INDEX END -->
<HR>
<P>
<H1><A NAME="name">NAME</A></H1>
<P>filetest - Perl pragma to control the filetest permission operators</P>
<P>
<HR>
<H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
<UL>
<LI>Linux</LI>
<LI>Solaris</LI>
<LI>Windows</LI>
</UL>
<HR>
<H1><A NAME="synopsis">SYNOPSIS</A></H1>
<PRE>
$can_perhaps_read = -r "file"; # use the mode bits
{
use filetest 'access'; # intuit harder
$can_really_read = -r "file";
}
$can_perhaps_read = -r "file"; # use the mode bits again</PRE>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>This pragma tells the compiler to change the behaviour of the filetest
permissions operators, the <CODE>-r</CODE> <CODE>-w</CODE> <CODE>-x</CODE> <CODE>-R</CODE> <CODE>-W</CODE> <CODE>-X</CODE>
(see <A HREF="../lib/Pod/perlfunc.html">the perlfunc manpage</A>).</P>
<P>The default behaviour to use the mode bits as returned by the <A HREF="../lib/Pod/perlfunc.html#item_stat"><CODE>stat()</CODE></A>
family of calls. This, however, may not be the right thing to do if
for example various ACL (access control lists) schemes are in use.
For such environments, <CODE>use filetest</CODE> may help the permission
operators to return results more consistent with other tools.</P>
<P>Each ``use filetest'' or ``no filetest'' affects statements to the end of
the enclosing block.</P>
<P>There may be a slight performance decrease in the filetests
when <CODE>use filetest</CODE> is in effect, because in some systems
the extended functionality needs to be emulated.</P>
<P><STRONG>NOTE</STRONG>: using the file tests for security purposes is a lost cause
from the start: there is a window open for race conditions (who is to
say that the permissions will not change between the test and the real
operation?). Therefore if you are serious about security, just try
the real operation and test for its success. Think atomicity.</P>
<P>
<H2><A NAME="subpragma access">subpragma access</A></H2>
<P>Currently only one subpragma, <CODE>access</CODE> is implemented. It enables
(or disables) the use of <CODE>access()</CODE> 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.</P>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
<TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
<STRONG><P CLASS=block> filetest - Perl pragma to control the filetest permission operators</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>