Csistck
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# we shouldn't really depend on it. See RT #24194 for detail.
# (Also, this module only supports Perl 5.6 and above).
eval "use Win32::UTCFileTime" if $^O eq 'MSWin32' && $] >= 5.006;
# If the script that is loading Module::Install is from the future,
# then make will detect this and cause it to re-run over and over
# again. This is bad. Rather than taking action to touch it (which
# is unreliable on some platforms and requires write permissions)
# for now we should catch this and refuse to run.
if ( -f $0 ) {
my $s = (stat($0))[9];
# If the modification time is only slightly in the future,
# sleep briefly to remove the problem.
my $a = $s - time;
if ( $a > 0 and $a < 5 ) { sleep 5 }
# Too far in the future, throw an error.
my $t = time;
if ( $s > $t ) { die <<"END_DIE" }
lib/Csistck/Test/FileBase.pm view on Meta::CPAN
return 1 unless ($self->gid);
die("Invalid group id")
if ($self->gid !~ m/^[0-9]+$/);
&{$func}($self->dest, $self->gid);
}
# Mode operations
sub mode_check {
my ($file, $mode) = @_;
my $fh = stat($file);
if ($fh) {
my $curmode = sprintf "%04o", $fh->mode & 07777;
debug("File mode: file=<$file> mode=<$curmode>");
return 1 if ($curmode eq $mode);
}
}
sub mode_repair {
my ($file, $mode) = @_;
debug("Chmod file: file=<$file> mode=<$mode>");
chmod(oct($mode), $file);
}
# UID operations
sub uid_check {
my ($file, $uid) = @_;
my $fh = stat($file);
my $curuid = undef;
if ($fh) {
my $curuid = $fh->uid;
debug("File owner: file=<$file> uid=<$uid>");
}
return ($curuid == $uid);
}
sub uid_repair {
my ($file, $uid) = @_;
debug("Chown file: file=<$file> uid=<$uid>");
chown($uid, -1, $file);
}
# GID operations
sub gid_check {
my ($file, $gid) = @_;
my $fh = stat($file);
my $curgid = undef;
if ($fh) {
$curgid = $fh->gid;
debug("File group: file=<$file> gid=<$gid>");
}
return ($curgid == $gid);
}
sub gid_repair {
my ($file, $gid) = @_;
( run in 1.163 second using v1.01-cache-2.11-cpan-49f99fa48dc )