view release on metacpan or search on metacpan
lib/AxKit/App/Gallery/Plugin.pm view on Meta::CPAN
my $image = Imager->new();
if(! -f $cachedfile
|| -z $cachedfile
|| (stat($r->filename()))[9] > (stat($cachedfile))[9]) {
# $r->log_error("will open " . $r->filename());
$image->open(file => $r->filename())
or die $image->errstr();
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
# 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
lib/AxKit2/Plugin.pm view on Meta::CPAN
In asynchronous I/O the action is requested and a callback is provided to
be called when the action has occured. This allows the event loop to continue
processing other requests while we are waiting for the disk.
This is better explained with a simple example. For this example we'll take the
C<stat()> system call in an attempt to find out if the filename we are
requesting is a directory or not. In perl we would normally perform this with
the following code:
sub hook_response {
my $self = shift;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/B/DeparseTree/PPfns.pm view on Meta::CPAN
sub filetest
{
my($self, $op, $cx, $name) = @_;
if (B::class($op) eq "UNOP") {
# Genuine '-X' filetests are exempt from the LLAFR, but not
# l?stat()
if ($name =~ /^-/) {
my $kid = $self->deparse($op->first, 16, $op);
return $self->info_from_template("filetest $name", $op,
"$name %c", undef, [$kid],
{maybe_parens => [$self, $cx, 16]});
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
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
$tempfile = '/tmp/LMS.t.'.$$;
$count_out = $library->extract($tempfile, type => 'S', name => TESTFILE);
is($library->{return_code}, LMSUP_OK, 'returncode (extract)');
is($library->message(), '', 'diagnostics (extract)');
ok(50 < $count_out && -s $tempfile, 'something written (extract)');
is((stat(_))[7], $count_out, 'correct size (extract, '.$count_out.')');
ok(0 == system('diff /usr/include/'.lc(TESTFILE).' '.$tempfile.' >/dev/null'),
'correct content (extract)');
# 27..33: add
$templib = 'LMS.T.TESTLIB.'.$$;
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
bootstrap BSD::stat $VERSION; # make XS available;
# Looks like as of Perl 5.18.1 the stat cache must be filled
# before BSD::stat makes use of it
CORE::lstat(__FILE__);
my $field = {
dev => 0,
ino => 1,
mode => 2,
$DEBUG >= 2 or return;
eval qq{ require Devel::Peek; } and Devel::Peek::Dump $_[0];
return;
}
sub stat(;$){
my $arg = shift || $_;
my $self =
ref \$arg eq 'SCALAR' ? xs_stat($arg) : xs_fstat(fileno($arg), 0);
defined $self or return;
$USE_OUR_ST and $set_our_st->($self);
return wantarray ? @$self : bless $self;
}
sub lstat(;$){
my $arg = shift || $_;
my $self =
ref \$arg eq 'SCALAR' ? xs_lstat($arg) : xs_fstat(fileno($arg), 1);
defined $self or return;
$USE_OUR_ST and $set_our_st->($self);
return wantarray ? @$self : bless $self;
}
__END__
# Below is stub documentation for your module. You better edit it!
=head1 NAME
BSD::stat - stat() with BSD 4.4 extentions
=head1 SYNOPSIS
use BSD::stat;
# just like CORE::stat
($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks,
$atimensec,$mtimensec,$ctimensec,$flags,$gen)
= stat($filename);
# BSD::stat now accepts filehandles, too
open F, "foo";
my @stat = stat(*F);
# omit an argument and it will use $_;
my $_ = "foo";
my stat = stat;
# stat($file) then -x _ works like CORE::stat();
stat("foo") and -x _ and print "foo is executable"
# but -x $file then stat(_) will not!!!
# just like File::stat
$st = stat($file) or die "No $file: $!";
if ( ($st->mode & 0111) && $st->nlink > 1) ) {
print "$file is executable with lotsa links\n";
}
use BSD::stat qw(:FIELDS);
stat($file) or die "No $file: $!";
if ( ($st_mode & 0111) && $st_nlink > 1) ) {
print "$file is executable with lotsa links\n";
}
# chflags
utimes $when, $when, @files;
lutimes $when, $when, @links;
=head1 DESCRIPTION
This module's default exports override the core stat() and
lstat() functions, replacing them with versions that contain BSD 4.4
extentions such as file flags. This module also adds chflags function.
=head2 BSD::stat vs. CORE::stat
When called as array context, C<lstat()> and C<stat()> return an array
like CORE::stat. Here are the meaning of the fields:
0 dev device number of filesystem
1 ino inode number
2 mode file mode (type and permissions)
16 flags user defined flags for file
17 gen file generation number
Like CORE::stat, BSD::stat supports _ filehandle. It does set "stat
cache" so the following -x _ operators can benefit. Be careful,
however, that BSD::stat::stat(_) will not work (or cannot be made to
work) because BSD::stat::stat() holds more info than that is stored in
Perl's internal stat cache.
C<atimespec>, C<mtimespec>, C<ctimespec> are available only as methods
that return times in floating point.
my $st = stat($path);
printf "%f\n" $st->atimespec; # $st->atime + $st->atimensec / 1e9
=head2 BSD::stat vs File::stat
When called as scalar context, it returns an object whose methods are
named as above, just like File::stat.
Like File::stat, You may also import all the structure fields directly
nto yournamespace as regular variables using the :FIELDS import tag.
(Note that this still overrides your stat() and lstat() functions.)
Access these fields as variables named with a preceding C<st_> in
front their method names. Thus, C<$stat_obj-E<gt>dev()> corresponds to
$st_dev if you import the fields.
Note: besides polluting the name space, :FIELDS comes with
Not too bad, huh?
=head1 EXPORT
stat(), lstat(), chflags() and chflags-related constants are exported
as default. $st_* variables are also exported when used with :FIELDS
=head1 BUGS
This is the best approximation of CORE::stat() and File::stat::stat()
that module can go.
In exchange of '_' support, BSD::stat now peeks and pokes too much of
perlguts in terms tat BSD::stat uses such variables as PL_statcache
that does not appear in "perldoc perlapi" and such.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BackPAN/Index/Create.pm view on Meta::CPAN
next if $path =~ /\s+\z/;
next if $path =~ /\n/;
my $tail = $path;
$tail =~ s!^\Q${stem}\E[^A-Za-z0-9]+!!;
$tail =~ s!\\!/!g if $^O eq 'MSWin32';
my @stat = stat($path);
my $time = $stat[9];
my $size = $stat[7];
# printf $fh "%s %d %d\n", $tail, $time, $size;
$plugin->add_file($tail, $time, $size);
}
view all matches for this distribution
view release on metacpan or search on metacpan
create_backpan_index.pl view on Meta::CPAN
chdir "BACKPAN";
foreach my $filename (sort File::Find::Rule->new->file->in(".")) {
my($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks)
= stat($filename);
print $out "$filename $mtime $size\n";
}
chdir "..";
$out->close;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BackPAN/Version/Discover/_BackPAN/Index.pm view on Meta::CPAN
my $self = shift;
my $file = $self->_backpan_index_file;
return 1 unless -e $file;
my $local_mod_time = stat($file)->mtime;
my $local_age = time - $local_mod_time;
return 0 unless $local_age > $self->cache->ttl;
# We looked, don't have to look again until the ttl is up.
$self->_backpan_index_file->touch;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Backblaze/B2/v1/AnyEvent.pm view on Meta::CPAN
if( not defined $options{ content }) {
open my $fh, '<', $filename
or croak "Couldn't open '$filename': $!";
binmode $fh, ':raw';
$options{ content } = do { local $/; <$fh> }; # sluuuuurp
$options{ mtime } = ((stat($fh))[9]) * 1000;
};
my $payload = delete $options{ content };
if( not $options{ sha1 }) {
my $sha1 = Digest::SHA1->new;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/BackupPC/XS.pm view on Meta::CPAN
#
sub compressCopy
{
my($srcFile, $destFileZ, $destFileNoZ, $compress, $rmSrc) = @_;
my($srcFh);
my(@s) = stat($srcFile);
my $atime = $s[8];
my $mtime = $s[9];
if ( $compress > 0 ) {
my $fh = BackupPC::XS::FileZIO::open($destFileZ, 1, $compress);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Badger/Filesystem.pm view on Meta::CPAN
}
sub stat_path {
my $self = shift;
my $path = $self->definitive_read(shift) || return;
my @stats = (stat($path), -r _, -w _, -x _, -o _, $path);
return $self->error_msg( bad_stat => $self->{ path } )
unless @stats;
return wantarray
lib/Badger/Filesystem.pm view on Meta::CPAN
Returns true if the path exists and is a directory, false if not.
=head2 stat_path($path)
Performs a C<stat()> on the filesystem path. It returns a list (in list
context) or a reference to a list (in scalar context) containing 17 items.
The first 13 are those returned by Perl's inbuilt C<stat()> function. The
next 3 items are flags indicating if the file is readable, writeable and/or
executable. The final item is a flag indicating if the file is owned by the
current user (i.e. owner of the current process.
A summary of the fields is shown below. See C<perldoc -f stat> and the
L<stat()|Badger::Filesystem::Path/stat()> method in
L<Badger::Filesystem::Path> for further details.
Field Description
--------------------------------------------------------
0 device number of filesystem
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Bank/Holidays.pm view on Meta::CPAN
# Cache the content from the FRB since holdays are unlikely to
# change from day to day (or year to year)
my $content;
if ( -f $cache && ( time() - ( stat($cache) )[9] ) < 86400 ) {
open my $fh, "<", $cache or die $!;
$content = do { local $/ = <$fh> };
close $fh;
}
else {
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
# 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
lib/Beam/Make.pm view on Meta::CPAN
if ( !$conf->{ $target } ) {
$LOG->debug(
"$target has no recipe and "
. ( -e $target ? 'exists as a file' : 'does not exist as a file' )
);
return stat( $target )->mtime if -e $target;
die $LOG->errorf( q{No recipe for target "%s" and file does not exist}."\n", $target );
}
# Resolve any references in the recipe object via Beam::Wire
# containers.
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
examples/dashboard/lib/Beekeeper/Service/Dashboard/Worker.pm view on Meta::CPAN
my $pool_id = $self->{_WORKER}->{pool_id};
($pool_id) = ($pool_id =~ m/^([\w-]+)$/); # untaint
my $tmp_file = "/tmp/beekeeper-dashboard-$pool_id-stats.dump";
# Avoid stampede when several workers are exiting simultaneously
return if (-e $tmp_file && (stat($tmp_file))[9] == time());
# Lock file because several workers may try to write simultaneously to it
sysopen(my $fh, $tmp_file, O_RDWR|O_CREAT) or return;
flock($fh, LOCK_EX | LOCK_NB) or return;
truncate($fh, 0) or return;
view all matches for this distribution