view release on metacpan or search on metacpan
lib/Comparer/file_mtime.pm view on Meta::CPAN
my $follow_symlink = $args{follow_symlink} // 1;
my $reverse = $args{reverse};
sub {
my @st1 = $follow_symlink ? stat($_[0]) : lstat($_[0]);
my @st2 = $follow_symlink ? stat($_[1]) : lstat($_[1]);
(
$st1[9] <=> $st2[9]
) * ($reverse ? -1 : 1)
};
lib/Comparer/file_mtime.pm view on Meta::CPAN
=head1 COMPARER ARGUMENTS
=head2 follow_symlink
Bool, default true. If set to false, will use C<lstat()> function instead of the
default C<stat()>.
=head2 reverse
Bool.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Comparer/file_num_links.pm view on Meta::CPAN
my $follow_symlink = $args{follow_symlink} // 1;
my $reverse = $args{reverse};
sub {
my @st1 = $follow_symlink ? stat($_[0]) : lstat($_[0]);
my @st2 = $follow_symlink ? stat($_[1]) : lstat($_[1]);
(
$st1[3] <=> $st2[3]
) * ($reverse ? -1 : 1)
};
lib/Comparer/file_num_links.pm view on Meta::CPAN
=head1 COMPARER ARGUMENTS
=head2 follow_symlink
Bool, default true. If set to false, will use C<lstat()> function instead of the
default C<stat()>.
=head2 reverse
Bool.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Comparer/file_size.pm view on Meta::CPAN
my $follow_symlink = $args{follow_symlink} // 1;
my $reverse = $args{reverse};
sub {
my @st1 = $follow_symlink ? stat($_[0]) : lstat($_[0]);
my @st2 = $follow_symlink ? stat($_[1]) : lstat($_[1]);
(
$st1[7] <=> $st2[7]
) * ($reverse ? -1 : 1)
};
lib/Comparer/file_size.pm view on Meta::CPAN
=head1 COMPARER ARGUMENTS
=head2 follow_symlink
Bool, default true. If set to false, will use C<lstat()> function instead of the
default C<stat()>.
=head2 reverse
Bool.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Complete/File.pm view on Meta::CPAN
my $filter;
if ($args{filter} && !ref($args{filter})) {
my @seqs = split /\s*\|\s*/, $args{filter};
$filter = sub {
my $name = shift;
my @st = stat($name) or return 0;
my $mode = $st[2];
my $pass;
SEQ:
for my $seq (@seqs) {
my $neg = sub { $_[0] };
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Compress/Bzip2.pm view on Meta::CPAN
if ( !@statbuf ) {
print STDERR "Error: failed to stat $infile: '$!'\n";
next;
}
if ( !_check_stat( $infile, \@statbuf, $opts{f} ) ) {
print STDERR "Error: file $infile stat check fails: $bzerrno\n";
next;
}
}
view all matches for this distribution
view release on metacpan or search on metacpan
ext/zstd/contrib/diagnose_corruption/check_flipped_bits.c view on Meta::CPAN
int ret;
FILE* f;
char *buf;
size_t bytes_read;
ret = stat(filename, &statbuf);
if (ret != 0) {
fprintf(stderr, "stat failed: %m\n");
return NULL;
}
if ((statbuf.st_mode & S_IFREG) != S_IFREG) {
view all matches for this distribution
view release on metacpan or search on metacpan
ext/zstd/contrib/pzstd/utils/FileSystem.h view on Meta::CPAN
inline file_status status(StringPiece path, std::error_code& ec) noexcept {
file_status status;
#if defined(_MSC_VER)
const auto error = ::_stat64(path.data(), &status);
#else
const auto error = ::stat(path.data(), &status);
#endif
if (error) {
ec.assign(errno, std::generic_category());
} else {
ec.clear();
ext/zstd/contrib/pzstd/utils/FileSystem.h view on Meta::CPAN
#if defined(S_ISREG)
return S_ISREG(status.st_mode);
#elif !defined(S_ISREG) && defined(S_IFMT) && defined(S_IFREG)
return (status.st_mode & S_IFMT) == S_IFREG;
#else
static_assert(false, "No POSIX stat() support.");
#endif
}
/// http://en.cppreference.com/w/cpp/filesystem/is_regular_file
inline bool is_regular_file(StringPiece path, std::error_code& ec) noexcept {
ext/zstd/contrib/pzstd/utils/FileSystem.h view on Meta::CPAN
#if defined(S_ISDIR)
return S_ISDIR(status.st_mode);
#elif !defined(S_ISDIR) && defined(S_IFMT) && defined(S_IFDIR)
return (status.st_mode & S_IFMT) == S_IFDIR;
#else
static_assert(false, "NO POSIX stat() support.");
#endif
}
/// http://en.cppreference.com/w/cpp/filesystem/is_directory
inline bool is_directory(StringPiece path, std::error_code& ec) noexcept {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
scripts/generate_index.pl view on Meta::CPAN
$total_pct
);
}
my $timestamp = 'Unknown';
if (my $stat = stat($config{cover_db})) {
$timestamp = strftime('%Y-%m-%d %H:%M:%S', localtime($stat->mtime));
}
Readonly my $commit_url => "https://github.com/$config{github_user}/$config{github_repo}/commit/$commit_sha";
my $short_sha = substr($commit_sha, 0, 7);
scripts/generate_index.pl view on Meta::CPAN
next unless $json->{summary}{Total};
my ($sha) = $file =~ /-(\w{7})\.json$/;
next unless $commit_messages{$sha}; # Skip merge commits
my $timestamp = $commit_times{$sha} // strftime('%Y-%m-%dT%H:%M:%S', localtime((stat($file))->mtime));
$timestamp =~ s/ /T/;
$timestamp =~ s/\s+([+-]\d{2}):?(\d{2})$/$1:$2/; # Fix space before timezone
$timestamp =~ s/ //g; # Remove any remaining spaces
my $pct = $json->{summary}{Total}{total}{percentage} // 0;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/Augeas/Exporter.pm view on Meta::CPAN
my %stat;
($stat{dev}, $stat{ino}, $stat{mode}, $stat{nlink},
$stat{uid}, $stat{gid}, $stat{rdev}, $stat{size},
$stat{atime}, $stat{mtime}, $stat{ctime},
$stat{blksize}, $stat{blocks}) = stat("${aug_root}${path}");
my $stat_elem = XML::LibXML::Element->new('stat');
for my $k (keys(%stat)) {
$stat_elem->setAttribute($k, $stat{$k});
view all matches for this distribution
view release on metacpan or search on metacpan
t/Config-AugeasC.t view on Meta::CPAN
# test augeas without backup file
cleanup;
my $h_file = $aug_root."etc/hosts" ;
my $h_size = stat($h_file)->size ;
my $aug = Config::Augeas::init($aug_root, '' ,0) ;
ok($aug,"Created new Augeas object without backup file");
t/Config-AugeasC.t view on Meta::CPAN
is($ret,0,"Set new host name");
$ret = $aug->save ;
is($ret,0,"Save with backup done") ;
is( stat($h_file)->size , $h_size + 6 , "Check new file size") ;
# test augeas with backup file
cleanup;
my $augb = Config::Augeas::init($aug_root, '' ,
t/Config-AugeasC.t view on Meta::CPAN
$ret = $augb->save ;
is($ret,0,"Save with backup done") ;
my $b_file = $h_file.".augsave" ;
ok( -e $b_file , "Backup file was written" ) ;
is( stat($b_file)->size , $h_size, "compare file sizes") ;
# complete test with save file
cleanup ;
view all matches for this distribution
view release on metacpan or search on metacpan
t/02.compile.t view on Meta::CPAN
);
Config::AutoConf->write_config_h();
ok(-f "config.h", "default config.h created");
my $fsize;
ok($fsize = (stat("config.h"))[7], "config.h contains content");
$ac->write_config_h();
ok(-f "config.h", "default config.h created");
cmp_ok((stat("config.h"))[7], ">", $fsize, "2nd config.h is bigger than first (more checks made)");
my ($fh, $fbuf, $dbuf);
open($fh, "<", "config.h");
{ local $/; $fbuf = <$fh>; }
close($fh);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/Autoload.pm view on Meta::CPAN
if ( defined($construct) && ref($construct) ne 'CODE' ) {
croak "The second argument for new() must be a coderef";
}
my $mtime = (stat($file))[9];
my $c;
if ( defined $construct ) {
$c = $construct->($file);
unless (ref($c) eq 'HASH') {
lib/Config/Autoload.pm view on Meta::CPAN
last if -f $file;
}
}
croak "The config file seems not exists" unless -f $file;
my $mtime = (stat($file))[9];
if ( $mtime != $self->{mtime} ) {
$self = __PACKAGE__->new($file,$self->{construct});
}
view all matches for this distribution
view release on metacpan or search on metacpan
&set_comment;
}
sub get_filemode {
my ($f) = @_;
($par->{'mode'}, $par->{'uid'}, $par->{'gid'}) = (stat($f))[2,4,5];
$par->{'mode'} &= 0777;
&verbose('get_filemode',
sprintf("mode=0%o, uid=%d, gid=%d", $par->{'mode'},
$par->{'uid'}, $par->{'gid'}));
}
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/Extend/MySQL.pm view on Meta::CPAN
sub __new_from {
my ($backend, $fh, $content_r) = @_;
if ($backend eq "Config::IniFiles") {
local $SIG{__WARN__} = sub {}; # avoid a warning from stat() on this $fh
local *IO::String::FILENO = sub { -1 };
return Config::IniFiles->new(-file => $fh)
}
elsif ($backend eq "Config::Format::Ini") {
local $SIG{__WARN__} = sub {}; # avoid "slurp redefined" warning
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/Generator/File.pm view on Meta::CPAN
sub _ensure_absent ($) {
my($path) = @_;
my($what);
lstat($path) or return;
if (-f _) {
$what = sprintf("file %s", $path);
if ($NoAction) {
_printf1("would have removed %s\n", $what);
} elsif (unlink($path)) {
lib/Config/Generator/File.pm view on Meta::CPAN
my(@stat, $tmpath);
$tmpath = $path . ".tmp";
_unlink($tmpath) if -e $tmpath;
file_write($tmpath, data => $data);
@stat = stat($path);
if (@stat) {
_chmod($stat[ST_MODE] & oct(7777), $tmpath);
_chown($stat[ST_UID], $stat[ST_GID], $tmpath);
_unlink($path);
}
lib/Config/Generator/File.pm view on Meta::CPAN
$rpath = $RootDir . $path;
log_debug("checking symlink %s", $rpath);
dief("duplicate symlink: %s", $path) if $_Registered{$path};
$_Registered{$path} = { type => "symlink" };
$what = sprintf("symlink %s -> %s", $rpath, $target);
@stat = lstat($rpath);
if (-e _) {
dief("path exists already and is not a symlink: %s", $rpath)
unless -l _;
$actual = readlink($rpath);
dief("cannot readlink(%s): %s", $rpath, $!)
lib/Config/Generator/File.pm view on Meta::CPAN
dief("duplicate mode: %s", $path) if $_Registered{$path}{mode};
$_Registered{$path}{mode} = sprintf("%04o", $mode);
dief("invalid mode: %s", $_Registered{$path}{mode})
unless 0 < $mode and $mode <= oct(7777);
$what = sprintf("the mode of %s: %s", $rpath, $_Registered{$path}{mode});
@stat = stat($rpath);
unless (@stat) {
dief("cannot stat(%s): %s", $rpath, $!)
unless $NoAction and $! == ENOENT;
_printf2("would have checked %s (but it does no exist yet)\n", $what);
return;
}
if (($stat[ST_MODE] & oct(7777)) == $mode) {
lib/Config/Generator/File.pm view on Meta::CPAN
_printf2("would have checked %s (but we are not root)\n", $what);
return;
}
$uid = getpwnam($user);
dief("unknown user: %s", $user) unless defined($uid);
@stat = stat($rpath);
unless (@stat) {
dief("cannot stat(%s): %s", $rpath, $!)
unless $NoAction and $! == ENOENT;
_printf2("would have checked %s (but it does no exist yet)\n", $what);
return;
}
if ($stat[ST_UID] == $uid) {
lib/Config/Generator/File.pm view on Meta::CPAN
_printf2("would have checked %s (but we are not root)\n", $what);
return;
}
$gid = getgrnam($group);
dief("unknown group: %s", $group) unless defined($gid);
@stat = stat($rpath);
unless (@stat) {
dief("cannot stat(%s): %s", $rpath, $!)
unless $NoAction and $! == ENOENT;
_printf2("would have checked %s (but it does no exist yet)\n", $what);
return;
}
if ($stat[ST_GID] == $gid) {
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Config/HAProxy.pm view on Meta::CPAN
croak $err;
}
}
return 1 if $dry_run;
my $sb = stat($self->filename);
$self->backup;
rename($tempfile, $self->filename)
or croak "can't rename $tempfile to ".$self->tempfile.": $!";
# This will succeed: we've created the file, so we're owning it.
chmod $sb->mode & 0777, $self->filename;
view all matches for this distribution
view release on metacpan or search on metacpan
t/26scalar-filehandle.t view on Meta::CPAN
#
# https://rt.cpan.org/Ticket/Display.html?id=54997
#
# Failure to read the ini file contents from a filehandle made out of a scalar
#
# <<< [patch] stat() on unopened filehandle warning thrown when using
# filehandle made from a scalar. >>>
use Test::More;
use strict;
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 and (stat($0))[9] > time ) {
die << "END_DIE";
Your installer $0 has a modification time in the future.
This is known to create infinite loops in make.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 and (stat($0))[9] > time ) { die <<"END_DIE" }
Your installer $0 has a modification time in the future.
This is known to create infinite loops in make.
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution
view release on metacpan or search on metacpan
inc/Module/Install.pm view on Meta::CPAN
# 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 }
view all matches for this distribution