Server IP : 149.255.58.128 / Your IP : 216.73.216.69
System : Linux cloud516.thundercloud.uk 5.14.0-427.26.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 17 15:51:13 EDT 2024 x86_64
PHP Version : 8.2.28
Disable Function : allow_url_include, apache_child_terminate, apache_setenv, exec, passthru, pcntl_exec, posix_kill, posix_mkfifo, posix_getpwuid, posix_setpgid, posix_setsid, posix_setuid, posix_setgid, posix_seteuid, posix_setegid, posix_uname, proc_close, proc_get_status, proc_open, proc_terminate, shell_exec, show_source, system
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Upload Files :
Command :
Current File : /usr/share/perl5//filetest.pm
package filetest;
our $VERSION = '1.03';
=head1 NAME
filetest - 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 DESCRIPTION
This pragma tells the compiler to change the behaviour of the filetest
permission operators, C<-r> C<-w> C<-x> C<-R> C<-W> C<-X>
(see L<perlfunc>).
The default behaviour of file test operators is to use the simple
mode bits as returned by the stat() family of system calls. However,
many operating systems have additional features to define more complex
access rights, for example ACLs (Access Control Lists).
For such environments, C<use filetest> may help the permission
operators to return results more consistent with other tools.
The C<use filetest> or C<no filetest> statements affect file tests defined in
their block, up to the end of the closest enclosing block (they are lexically
block-scoped).
Currently, only the C<access> sub-pragma is implemented. It enables (or
disables) the use of access() when available, that is, on most UNIX systems and
other POSIX environments. See details below.
=head2 Consider this carefully
The stat() mode bits are probably right for most of the files and
directories found on your system, because few people want to use the
additional features offered by access(). But you may encounter surprises
if your program runs on a system that uses ACLs, since the stat()
information won't reflect the actual permissions.
There may be a slight performance decrease in the filetest operations
when the filetest pragma is in effect, because checking bits is very
cheap.
Also, note that 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 in terms of atomic
operations. Filetests are more useful for filesystem administrative
tasks, when you have no need for the content of the elements on disk.
=head2 The "access" sub-pragma
UNIX and POSIX systems provide an abstract access() operating system call,
which should be used to query the read, write, and execute rights. This
function hides various distinct approaches in additional operating system
specific security features, like Access Control Lists (ACLs)
The extended filetest functionality is used by Perl only when the argument
of the operators is a filename, not when it is a filehandle.
=head2 Limitation with regard to C<_>
Because access() does not invoke stat() (at least not in a way visible
to Perl), B<the stat result cache "_" is not set>. This means that the
outcome of the following two tests is different. The first has the stat
bits of F</etc/passwd> in C<_>, and in the second case this still
contains the bits of C</etc>.
{ -d '/etc';
-w '/etc/passwd';
print -f _ ? 'Yes' : 'No'; # Yes
}
{ use filetest 'access';
-d '/etc';
-w '/etc/passwd';
print -f _ ? 'Yes' : 'No'; # No
}
Of course, unless your OS does not implement access(), in which case the
pragma is simply ignored. Best not to use C<_> at all in a file where
the filetest pragma is active!
As a side effect, as C<_> doesn't work, stacked filetest operators
(C<-f -w $file>) won't work either.
This limitation might be removed in a future version of perl.
=cut
$filetest::hint_bits = 0x00400000; # HINT_FILETEST_ACCESS
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;
Name |
Size |
Last Modified |
Owner / Group |
Permissions |
Options |
.. | -- | May 20 2025 21:42:20 | 0 / root | 0755 | |
Attribute | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
B | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
CPAN | -- | February 05 2024 20:05:52 | 0 / root | 0755 | |
Class | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Compress | -- | February 05 2024 19:59:43 | 0 / root | 0755 | |
Config | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
DBM_Filter | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Devel | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
ExtUtils | -- | May 30 2024 07:43:48 | 0 / root | 0755 | |
File | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Getopt | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
I18N | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
IO | -- | February 05 2024 19:59:43 | 0 / root | 0755 | |
IPC | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Locale | -- | April 03 2024 14:39:19 | 0 / root | 0755 | |
Math | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Memoize | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Module | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Net | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Pod | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Search | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Term | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Text | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
Thread | -- | May 30 2024 07:43:02 | 0 / root | 0755 | |
Tie | -- | May 30 2024 07:43:02 | 0 / root | 0755 | |
Time | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
URI | -- | October 13 2023 17:01:25 | 0 / root | 0755 | |
Unicode | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
User | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
encoding | -- | May 30 2024 07:43:02 | 0 / root | 0755 | |
overload | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
pod | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
unicore | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
vendor_perl | -- | January 17 2025 17:38:37 | 0 / root | 0755 | |
warnings | -- | May 30 2024 07:43:01 | 0 / root | 0755 | |
| | | | | |
AnyDBM_File.pm | 2.557 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
AutoLoader.pm | 15.427 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
AutoSplit.pm | 19.177 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
Benchmark.pm | 30.299 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
CORE.pod | 3.113 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
DB.pm | 18.479 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
DBM_Filter.pm | 14.048 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
DirHandle.pm | 2.036 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
Dumpvalue.pm | 17.254 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
English.pm | 4.649 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
FileCache.pm | 5.419 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
FileHandle.pm | 6.625 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
FindBin.pm | 4.454 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
Internals.pod | 2.515 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
Memoize.pm | 35.344 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
NEXT.pm | 18.54 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
PerlIO.pm | 14.103 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
Safe.pm | 24.77 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
SelectSaver.pm | 1.051 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
SelfLoader.pm | 17.271 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
Symbol.pm | 4.687 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
Test.pm | 29.338 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
Thread.pm | 8.095 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
UNIVERSAL.pm | 6.439 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
URI.pm | 34.135 KB | March 03 2021 15:16:52 | 0 / root | 0644 | |
XSLoader.pm | 10.988 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
_charnames.pm | 33.351 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
autouse.pm | 4.139 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
base.pm | 10.704 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
blib.pm | 2.014 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
bytes.pm | 3.652 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
bytes_heavy.pl | 0.74 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
charnames.pm | 20.44 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
deprecate.pm | 4.495 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
diagnostics.pm | 18.847 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
dumpvar.pl | 15.19 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
feature.pm | 18.558 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
fields.pm | 9.253 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
filetest.pm | 3.909 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
if.pm | 3.526 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
integer.pm | 3.178 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
less.pm | 3.129 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
locale.pm | 4.741 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
meta_notation.pm | 2.067 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
open.pm | 8.313 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
overload.pm | 52.053 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
overloading.pm | 1.766 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
perl5db.pl | 309.662 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
sigtrap.pm | 8.531 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
sort.pm | 3.819 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
strict.pm | 4.627 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
subs.pm | 0.88 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
utf8.pm | 10.179 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |
vars.pm | 2.4 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
vmsish.pm | 4.212 KB | April 03 2024 14:39:02 | 0 / root | 0644 | |
warnings.pm | 49.353 KB | April 03 2024 14:35:12 | 0 / root | 0644 | |