/usr/share/perl5/File/Util/Definitions.pm is in libfile-util-perl 4.132140-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | use strict;
use warnings;
package File::Util::Definitions;
{
$File::Util::Definitions::VERSION = '4.132140';
}
# ABSTRACT: Global symbols and constants used in most File::Util classes
use Fcntl qw( :flock );
use vars qw(
@ISA @EXPORT_OK %EXPORT_TAGS
$OS $MODES $READ_LIMIT $ABORT_DEPTH
$USE_FLOCK @ONLOCKFAIL $ILLEGAL_CHR $CAN_FLOCK
$EBCDIC $DIRSPLIT $_LOCKS $NEEDS_BINMODE
$WINROOT $ATOMIZER $SL $NL $EMPTY_WRITES_OK
$FSDOTS $AUTHORITY $EBL $EBR $HAVE_UU
);
use Exporter;
$AUTHORITY = 'cpan:TOMMY';
@ISA = qw( Exporter );
@EXPORT_OK = qw(
$OS OS $MODES $READ_LIMIT $ABORT_DEPTH
$USE_FLOCK @ONLOCKFAIL $ILLEGAL_CHR $CAN_FLOCK
$EBCDIC $DIRSPLIT $_LOCKS $NEEDS_BINMODE
$WINROOT $ATOMIZER $SL $NL $EMPTY_WRITES_OK
$FSDOTS $AUTHORITY SL NL $EBL $EBR
$HAVE_UU
);
%EXPORT_TAGS = ( all => [ @EXPORT_OK ] );
BEGIN {
# Some OS logic.
unless ( $OS = $^O )
{
require Config;
{ no warnings 'once'; $OS = $Config::Config{osname} }
};
{ local $@; $HAVE_UU = eval { require 5.008001 } }
if ( $OS =~ /^darwin/i ) { $OS = 'UNIX' }
elsif ( $OS =~ /^cygwin/i ) { $OS = 'CYGWIN' }
elsif ( $OS =~ /^MSWin/i ) { $OS = 'WINDOWS' }
elsif ( $OS =~ /^vms/i ) { $OS = 'VMS' }
elsif ( $OS =~ /^bsdos/i ) { $OS = 'UNIX' }
elsif ( $OS =~ /^dos/i ) { $OS = 'DOS' }
elsif ( $OS =~ /^MacOS/i ) { $OS = 'MACINTOSH' }
elsif ( $OS =~ /^epoc/ ) { $OS = 'EPOC' }
elsif ( $OS =~ /^os2/i ) { $OS = 'OS2' }
else { $OS = 'UNIX' }
$EBCDIC = qq[\t] ne qq[\011] ? 1 : 0;
$NEEDS_BINMODE = $OS =~ /WINDOWS|DOS|OS2|MSWin/ ? 1 : 0;
$NL =
$NEEDS_BINMODE ? qq[\015\012]
: $EBCDIC || $OS eq 'VMS' ? qq[\n]
: $OS eq 'MACINTOSH' ? qq[\015]
: qq[\012];
$SL =
{ DOS => '\\', EPOC => '/', MACINTOSH => ':',
OS2 => '\\', UNIX => '/', WINDOWS => chr(92),
VMS => '/', CYGWIN => '/', }->{ $OS } || '/';
$_LOCKS = { };
} BEGIN {
use constant NL => $NL;
use constant SL => $SL;
use constant OS => $OS;
}
$WINROOT = qr/^(?: [[:alpha:]]{1} ) : (?: \\{1,2} )/x;
$DIRSPLIT = qr/$WINROOT | [\\:\/]/x;
$ATOMIZER = qr/
(^ $DIRSPLIT ){0,1}
(?: (.*) $DIRSPLIT ){0,1}
(.*) /x;
$ILLEGAL_CHR = qr/[\/\|\\$NL\r\n\t\013\*\"\?\<\:\>]/;
$FSDOTS = qr/^\.{1,2}$/;
$READ_LIMIT = 52428800; # set read_limit to a default of 50 megabytes
$ABORT_DEPTH = 1000; # maximum depth for recursive list_dir calls
{
local $@;
eval {
flock( STDOUT, &Fcntl::LOCK_SH );
flock( STDOUT, &Fcntl::LOCK_UN );
};
$CAN_FLOCK = $@ ? 0 : 1;
}
# try to use file locking, define flock race conditions policy
$USE_FLOCK = 1;
@ONLOCKFAIL = qw( NOBLOCKEX FAIL );
$MODES->{popen} = {
write => '>', trunc => '>', rwupdate => '+<',
append => '>>', read => '<', rwclobber => '+>',
rwcreate => '+>', rwappend => '+>>',
};
$MODES->{sysopen} = {
read => &Fcntl::O_RDONLY,
write => &Fcntl::O_WRONLY | &Fcntl::O_CREAT,
append => &Fcntl::O_WRONLY | &Fcntl::O_APPEND | &Fcntl::O_CREAT,
trunc => &Fcntl::O_WRONLY | &Fcntl::O_CREAT | &Fcntl::O_TRUNC,
rwcreate => &Fcntl::O_RDWR | &Fcntl::O_CREAT,
rwclobber => &Fcntl::O_RDWR | &Fcntl::O_TRUNC | &Fcntl::O_CREAT,
rwappend => &Fcntl::O_RDWR | &Fcntl::O_APPEND | &Fcntl::O_CREAT,
rwupdate => &Fcntl::O_RDWR,
};
# --------------------------------------------------------
# %$File::Util::Definitions::LOCKS
# --------------------------------------------------------
$_LOCKS->{IGNORE} = sub { $_[2] };
$_LOCKS->{ZERO} = sub { 0 };
$_LOCKS->{UNDEF} = sub { };
$_LOCKS->{NOBLOCKEX} = sub {
return $_[2] if flock( $_[2], &Fcntl::LOCK_EX | &Fcntl::LOCK_NB ); return
};
$_LOCKS->{NOBLOCKSH} = sub {
return $_[2] if flock( $_[2], &Fcntl::LOCK_SH | &Fcntl::LOCK_NB ); return
};
$_LOCKS->{BLOCKEX} = sub {
return $_[2] if flock( $_[2], &Fcntl::LOCK_EX ); return
};
$_LOCKS->{BLOCKSH} = sub {
return $_[2] if flock( $_[2], &Fcntl::LOCK_SH ); return
};
$_LOCKS->{WARN} = sub {
my $this = shift;
return $this->_throw(
'bad flock' =>
{
filename => shift,
exception => $!,
onfail => 'warn',
opts => $this->_remove_opts( \@_ ),
},
);
};
$_LOCKS->{FAIL} = sub {
my $this = shift;
return $this->_throw(
'bad flock' =>
{
filename => shift,
exception => $!,
opts => $this->_remove_opts( \@_ ),
},
);
};
# (for use in error messages)
( $EBL, $EBR ) = ('( ', ' )'); # error bracket left, error bracket right
# --------------------------------------------------------
# File::Util::Definitions::DESTROY()
# --------------------------------------------------------
sub DESTROY { }
1;
__END__
=pod
=head1 NAME
File::Util::Definitions - Global symbols and constants used in most File::Util classes
=head1 VERSION
version 4.132140
=head1 DESCRIPTION
Defines constants and special variables that File::Util uses internally,
many of which are calculated dynamically based on the platform where
your program runs.
Users, don't use this module by itself. It is for internal use only.
=cut
|