⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filetest.pm

📁 MSYS在windows下模拟了一个类unix的终端
💻 PM
字号:
package filetest;=head1 NAMEfiletest - Perl pragma to control the filetest permission operators=head1 SYNOPSIS    $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=head1 DESCRIPTIONThis pragma tells the compiler to change the behaviour of the filetestpermissions operators, the C<-r> C<-w> C<-x> C<-R> C<-W> C<-X>(see L<perlfunc>).The default behaviour to use the mode bits as returned by the stat()family of calls.  This, however, may not be the right thing to do iffor example various ACL (access control lists) schemes are in use.For such environments, C<use filetest> may help the permissionoperators to return results more consistent with other tools.Each "use filetest" or "no filetest" affects statements to the end ofthe enclosing block.There may be a slight performance decrease in the filetestswhen C<use filetest> is in effect, because in some systemsthe extended functionality needs to be emulated.B<NOTE>: using the file tests for security purposes is a lost causefrom the start: there is a window open for race conditions (who is tosay that the permissions will not change between the test and the realoperation?).  Therefore if you are serious about security, just trythe real operation and test for its success.  Think atomicity.=head2 subpragma accessCurrently only one subpragma, C<access> is implemented.  It enables(or disables) the use of access() or similar system calls.  Thisextended filetest functionality is used only when the argument of theoperators is a filename, not when it is a filehandle.=cut$filetest::hint_bits = 0x00400000;sub import {    if ( $_[1] eq 'access' ) {	$^H |= $filetest::hint_bits;    } else {	die "filetest: the only implemented subpragma is 'access'.\n";    }}sub unimport {    if ( $_[1] eq 'access' ) {	$^H &= ~$filetest::hint_bits;    } else {	die "filetest: the only implemented subpragma is 'access'.\n";    }}1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -