view release on metacpan or search on metacpan
lib/Apache/Imager/Resize.pm view on Meta::CPAN
$shrunk .= $suffix;
if (file_ok( $shrunk, $filename )) {
$r->filename($shrunk);
my $mtime = (stat( $shrunk ))[9];
utime time, $mtime, $shrunk;
return OK;
}
# if we're using a separate cache directory, the necessary subdirectory might not exist yet
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/JAF.pm view on Meta::CPAN
my $text = do { local $/; <IN> };
close IN;
unless ($TEMPLATES->{$_}{code} = Template::Document->new( $PARSER->parse($text) )) {
$TEMPLATES->{$_}{error} = $PARSER->error();
} else {
$TEMPLATES->{$_}{mtime} = (stat(_))[9];
}
}
}
sub load_templates {
lib/Apache/JAF.pm view on Meta::CPAN
$ref = $$t;
}
foreach my $p (@{$self->paths()}) {
my $full_name = "$p/$name";
if (exists $ref->{$full_name}) {
if ((stat($full_name))[9] > $ref->{$full_name}{mtime}) {
load_templates(undef, ref $self, $p);
no strict 'refs';
$ref = $$t;
}
return wantarray ? ($ref->{$full_name}{code}, $ref->{$full_name}{error}) : $ref->{$full_name}{code};
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
# get file attributes via stat
# (dev,ino,mode,nlink,uid,gid,rdev,size,atime,mtime,ctime,blksize,blocks)
$log->audit( "checking age of $file1 and $file2" );
my $stat1 = stat($file1)->mtime;
my $stat2 = stat($file2)->mtime;
$log->audit( "timestamps are $stat1 and $stat2");
return 1 if ( $stat2 > $stat1 );
return;
# I could just:
#
# if ( stat($f1)[9] > stat($f2)[9] )
#
# but that forces the reader to read the man page for stat
# to see what's happening
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
return $log->error( "file '$file' does not exist!", %args)
if !-e $file;
# one way to get file mode (using File::mode)
# my $raw_mode = stat($file)->[2];
## no critic
my $mode = sprintf "%04o", stat($file)->[2] & 07777;
# another way to get it
# my $st = stat($file);
# my $mode = sprintf "%lo", $st->mode & 07777;
$log->audit( "file $file has mode: $mode" );
return $mode;
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
if ( !-e $file ) {
$log->audit( "writing process id $PROCESS_ID to $file...");
$self->file_write( $file, lines => [$PROCESS_ID], %args) and return $file;
};
my $age = time() - stat($file)->mtime;
if ( $age < 1200 ) { # less than 20 minutes old
return $log->error( "check_pidfile: $file is " . $age / 60
. " minutes old and might still be running. If it is not running,"
. " please remove the file (rm $file).", %args);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/MONITOR.pm view on Meta::CPAN
elsif( $mon_string =~ /^mtime:(.+)$/ )
{
my $filename = $1;
print "$monitored_uri: checking file mtime of $filename\n";
my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,
$atime,$mtime,$ctime,$blksize,$blocks) = stat($filename);
$modified_time = $mtime;
}
else
{
my $old_checksum = $state;
view all matches for this distribution
view release on metacpan or search on metacpan
my $self = shift;
my $dir = shift;
return DECLINED unless -d $dir;
my $last_modified = (stat(_))[9];
$self->r->headers_out->add('ETag' => sprintf("%lx-%s", $last_modified, $VERSION));
if (my $check = $self->r->headers_in->{"If-None-Match"}) {
my ($time, $ver) = $check =~ /^([a-f0-9]+)-([0-9.]+)$/;
(my $title = $subdir) =~ s/\s/$nb/og; # replace whitespace with
$title =~ s!^.*(/[^/]+/[^/]+)$!...$1!; # if dir is fully pathed, only keep 2 parts for title
my $uri = escape($subdir);
my $result;
my($atime,$mtime) = (stat($subdirpath))[8,9];
my($last,$times);
if($self->r->dir_config('CacheStats')){
($last,$times) = $self->stats($self->r->filename,$subdir);
}
view all matches for this distribution
view release on metacpan or search on metacpan
MiniWiki.pm view on Meta::CPAN
sub get_lastmod {
my ($filename) = @_;
my $lastmod = "never";
if (-f $filename) {
my $mtime = stat($filename)->mtime;
my $date = &ParseDateString("epoch $mtime");
$lastmod = &UnixDate($date, "%B %d, %Y %i:%M %p");
}
return "$lastmod";
MiniWiki.pm view on Meta::CPAN
# returns the timestamp of the given filename in the datadir
sub get_mtime($) {
my ($filename) = @_;
if (-f "$datadir/$filename") {
my $mtime = stat("$datadir/$filename")->mtime;
}
}
sub render($) {
my ($newtext) = @_;
MiniWiki.pm view on Meta::CPAN
my ($r, $uri, $revision) = @_;
my $fileuri = $datadir . "/" . uri_to_filename($uri);
my $thumburi = $datadir . "/THUMB_" . uri_to_filename($uri);
my $file_mtime = stat($fileuri)->mtime;
my ($subtype) = &is_img($uri);
#$r->send_http_header("image/$subtype");
if (-f $thumburi && stat($thumburi)->mtime > $file_mtime) {
# if the thumbnail is newer then the big image,
# then obviously a new one hasn't been uploaded.
# Don't call ImageMagick to check the size.
# Use the existing thumb.
return send_file($r, $thumburi);
MiniWiki.pm view on Meta::CPAN
if ($width < $max_width && $height < $max_height) {
# don't scale it down
return send_file($r, $fileuri);
}
else {
if (!-f $thumburi || stat($thumburi)->mtime < $file_mtime) {
my $resize_ratio;
if ($width > $height) {
# eg. .2 = 1200 / 240
$resize_ratio = $width / $max_width;
} else {
view all matches for this distribution
view release on metacpan or search on metacpan
if( fd < 0 )
XSRETURN_UNDEF;
if( !len ) {
struct stat st;
if( fstat( fd, &st ) == -1 )
XSRETURN_UNDEF;
len = st.st_size;
}
Newz( 0, ret, 1, Mmap );
view all matches for this distribution
view release on metacpan or search on metacpan
my @parloc = Apache->server->dir_config->get('PARInclude');
sub handler {
my $r = shift;
foreach (keys(%MTIME_LIST)) {
my $mtime = (stat($_))[9];
if($mtime > $MTIME_LIST{$_}) {
PAR::reload_libs($_);
if($UNPACK_LIST{$_}) {
unpack_par(undef, $_, Apache->server->dir_config->get('PARTempDir'))
}
if (DEBUG) {
warn "[PAR] archive has been unpacked previously\n";
warn "[PAR] directory age: ", -M $tmppar, "\n";
warn "[PAR] archive age: ", -M $par, "\n";
}
return $tmppar if (stat($tmppar))[9] > (stat($par))[9];
warn "[PAR] removing old unpack dir '$tmppar'" if DEBUG;
File::Path::rmtree $tmppar;
}
# XXX Add signature check here
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/PageKit.pm view on Meta::CPAN
sub _send_static_file {
my ( $pk, $filename ) = @_;
my $apr = $pk->{apr};
my $file_mtime = (stat($filename))[9];
my $ims = $apr->header_in('If-Modified-Since');
if ( $ims ) {
my $t = Apache::Util::parsedate($ims);
if ( $t && $file_mtime <= $t ) {
return HTTP_NOT_MODIFIED;
view all matches for this distribution
view release on metacpan or search on metacpan
ParseFormData.pm view on Meta::CPAN
my ($fh, $path) = @{$_->{'values'}};
seek($fh, 0, 0);
my %hash = (
filename => "",
type => exists($_->{'headers'}->{'content-type'}) ? $_->{'headers'}->{'content-type'} : "",
size => ($fh->stat())[7],
);
my $param = "";
for(@a) {
my ($name, $value) = (/([^=]+)=\"([^\"]+)\"/);
if($name eq "name") {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Reload.pm view on Meta::CPAN
my $TouchModules;
if ($TouchFile) {
warn "Checking mtime of $TouchFile\n" if $DEBUG;
my $touch_mtime = (stat($TouchFile))[9] || return 1;
return 1 unless $touch_mtime > $TouchTime;
$TouchTime = $touch_mtime;
my $sym = Apache->gensym;
open($sym, $TouchFile) || die "Can't open '$TouchFile': $!";
$TouchModules = <$sym>;
lib/Apache/Reload.pm view on Meta::CPAN
Schwartz's Stonehenge::Reload module that attempts to be a little
more intuitive and makes the usage easier. Stonehenge::Reload was
written by Randal to make specific modules reload themselves when
they changed. Unlike Apache::StatINC, Stonehenge::Reload only checked
the change time of modules that registered themselves with
Stonehenge::Reload, thus reducing stat() calls. Apache::Reload also
offers the exact same functionality as Apache::StatINC, and is thus
designed to be a drop-in replacement. Apache::Reload only checks modules
that register themselves with Apache::Reload if you explicitly turn off
the StatINC emulation method (see below). Like Apache::StatINC,
Apache::Reload must be installed as an Init Handler.
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/SdnFw/lib/Core.pm view on Meta::CPAN
close F;
$return .= "</style>\n";
}
return $return;
# my $v = (stat("$s->{plib}/css/$stylefile.css"))[9];
# my $return = qq(\t<link rel="stylesheet" href="/css/$stylefile-r$v.css" />\n);
#
# # check for a custom stylesheet
# my $cv = (stat("/data/$s->{obase}/content/custom.css"))[9];
# if ($cv) {
# $return .= qq(\t<link rel="stylesheet" href="/custom-r$cv.css" />\n);
# }
#
# if ($s->{agent} eq 'iphone') {
view all matches for this distribution
view release on metacpan or search on metacpan
t/05_cache_opts.t view on Meta::CPAN
};
$session{ts} = time;
untie %session;
ok(-d "$cache_root/$ns", 'cache_root');
my $mode = (stat("$cache_root/$ns"))[2];
ok($mode & '0700', 'directory_umask');
Cache::FileCache::Clear($cache_root);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Session/Lock/File.pm view on Meta::CPAN
opendir(DIR, $dir) || die "Could not open directory $dir: $!";
my @files = readdir(DIR);
foreach my $file (@files) {
if ($file =~ /^Apache-Session.*\.lock$/) {
if ($now - (stat($dir.'/'.$file))[8] >= $time) {
if ($^O eq 'MSWin32') {
#Windows cannot unlink open file
unlink($dir.'/'.$file) || next;
} else {
open(FH, "+>$dir/".$file) || next;
view all matches for this distribution
view release on metacpan or search on metacpan
patches/Apache-Session-File-Lock1.54-patch view on Meta::CPAN
+++ Session/Lock/File.pm-patched 2004-01-23 16:29:13.000000000 +0100
@@ -133,7 +133,7 @@
my @files = readdir(DIR);
foreach my $file (@files) {
if ($file =~ /^Apache-Session.*\.lock$/) {
- if ((stat($dir.'/'.$file))[8] - $now >= $time) {
+ if ($now - (stat($dir.'/'.$file))[8] >= $time) {
open(FH, "+>$dir/".$file) || next;
flock(FH, LOCK_EX) || next;
unlink($dir.'/'.$file) || next;
view all matches for this distribution
view release on metacpan or search on metacpan
SetWWWTheme.pm view on Meta::CPAN
# we only want to deal with html files
return DECLINED unless $content_type eq 'text/html';
$filename = $r->filename; # get the filename we're looking for
unless (-e $r->finfo) # Apache does a stat() and puts the results in finfo,
# this is faster than testing the filename.
{
$r->log_error("File does not exist: $filename");
return NOT_FOUND;
}
view all matches for this distribution
view release on metacpan or search on metacpan
SimpleTemplate.pm view on Meta::CPAN
my $fun = $_cache{$_[0]};
my $usecache = $fun ? 1 : $s->{cache};
# check for updated template
if ($fun && ($s->{reload} > 0)) {
my $filetime = (stat($_[0]))[9];
if ($_cache_time{$_[0]} < $filetime) {
print STDERR "-- RELOADING ($package)\n" if ($s->{debug} > 1);
$fun = undef;
}
}
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/Apache/SiteControl/UserFactory.pm view on Meta::CPAN
tied(%session)->delete;
next;
}
if(defined($usermap{$username})) {
# last modify time of session we saw
my $timea = (stat("$sessiondir/$usermap{$username}{_session_id}"))[9];
# last modify time of this session
my $timeb = (stat("$sessiondir/$id"))[9];
$r->log_error("User $username has duplicate session! Expiring old session");
if($timea < $timeb) {
# The one we saw earlier is older. Delete it.
untie %session;
tie %session, 'Apache::Session::File',
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/TS/AdminClient.pm view on Meta::CPAN
#!/usr/bin/perl
use Apache::TS::AdminClient;
my $cli = Apache::TS::AdminClient->new(%input);
my $string = $cli->get_stat("proxy.config.product_company");
print "$string\n";
=head1 DESCRIPTION:
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/Voodoo/Application/ConfigParser.pm view on Meta::CPAN
}
sub changed {
my $self = shift;
return $self->{'conf_mtime'} != (stat($self->{'conf_file'}))[9];
}
sub old_ns { return $_[0]->{'old_ns'} };
sub config { return $_[0]->{'config'} };
sub models { return $_[0]->{'models'} };
lib/Apache/Voodoo/Application/ConfigParser.pm view on Meta::CPAN
$conf{'dynamic_loading'} = $conf{'dynamic_loading'} || 0;
$conf{'halt_on_errors'} = defined($conf{'halt_on_errors'})?$conf{'halt_on_errors'}:1;
}
if ($conf{'dynamic_loading'}) {
$self->{'conf_mtime'} = (stat($self->{'conf_file'}))[9];
}
if (defined($conf{'database'})) {
my $db;
if (ref($conf{'database'}) eq "ARRAY") {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/WebDAV.pm view on Meta::CPAN
}
}
my %wanted_properties = $self->get_wanted_properties($r);
# The list of properties in order which a stat() call must return.
my @properties = qw(dev ino mode nlink uid gid rdev getcontentlength
atime getlastmodified creationdate);
# Loop through all the files and call stat() on each one. Keep track of
# which properties the client requested.
my @results;
foreach my $path (@files)
{
lib/Apache/WebDAV.pm view on Meta::CPAN
{
$info->{'getcontenttype'} = 'httpd/unix-directory';
$info->{'resourcetype'} = 'collection';
}
@stat{@properties} = $handler->stat($path);
foreach my $prop (keys %wanted_properties)
{
# These are set above automatically, don't want to overwrite them
next if $prop eq 'resourcetype';
view all matches for this distribution
view release on metacpan or search on metacpan
Wyrd/DBL.pm view on Meta::CPAN
=pod
=item (scalar) C<mtime> (void)
the modification time of the file currently being served. Derived from
Apache::Wyrd::Handler, by default compatible with the C<stat()> builtin
function.
=cut
sub mtime {
Wyrd/DBL.pm view on Meta::CPAN
}
=item (scalar) C<size> (void)
the file size of the file currently being served. Derived from
Apache::Wyrd::Handler, by default compatible with the C<stat()> builtin
function.
=cut
sub size {
Wyrd/DBL.pm view on Meta::CPAN
=pod
=item (scalar) C<dev> (void)
the device number of filesystem of the file currently being served. Derived
from Apache::Wyrd::Handler, by default compatible with the C<stat()> builtin
function.
=cut
sub dev {
Wyrd/DBL.pm view on Meta::CPAN
=pod
=item (scalar) C<ino> (void)
the inode number of the file currently being served. Derived from
Apache::Wyrd::Handler, by default compatible with the C<stat()> builtin
function.
=cut
sub ino {
Wyrd/DBL.pm view on Meta::CPAN
=pod
=item (scalar) C<mode> (void)
the file mode (type and permissions) of the file currently being served.
Derived from Apache::Wyrd::Handler, by default compatible with the C<stat()>
builtin function.
=cut
sub mode {
Wyrd/DBL.pm view on Meta::CPAN
=pod
=item (scalar) C<nlink> (void)
the number of (hard) links to the file of the file currently being served.
Derived from Apache::Wyrd::Handler, by default compatible with the C<stat()>
builtin function.
=cut
sub nlink {
Wyrd/DBL.pm view on Meta::CPAN
=pod
=item (scalar) C<uid> (void)
the numeric user ID of file's owner of the file currently being served.
Derived from Apache::Wyrd::Handler, by default compatible with the C<stat()>
builtin function.
=cut
sub uid {
Wyrd/DBL.pm view on Meta::CPAN
=pod
=item (scalar) C<gid> (void)
the numeric group ID of file's owner of the file currently being served.
Derived from Apache::Wyrd::Handler, by default compatible with the C<stat()>
builtin function.
=cut
sub gid {
Wyrd/DBL.pm view on Meta::CPAN
=item (scalar) C<rdev> (void)
the the device identifier (special files only) of the file currently being
served. Derived from Apache::Wyrd::Handler, by default compatible with the
C<stat()> builtin function.
=cut
sub rdev {
my ($self) = @_;
Wyrd/DBL.pm view on Meta::CPAN
=item (scalar) C<atime> (void)
the last access time in seconds since the epoch of the file currently being
served. Derived from Apache::Wyrd::Handler, by default compatible with the
C<stat()> builtin function.
=cut
sub atime {
my ($self) = @_;
Wyrd/DBL.pm view on Meta::CPAN
=item (scalar) C<ctime> (void)
the inode change time in seconds since the epoch of the file currently being
served. Derived from Apache::Wyrd::Handler, by default compatible with the
C<stat()> builtin function. See the perl documentation for details.
=cut
sub ctime {
my ($self) = @_;
Wyrd/DBL.pm view on Meta::CPAN
=item (scalar) C<blksize> (void)
the preferred block size for file system I/O of the file currently being
served. Derived from Apache::Wyrd::Handler, by default compatible with the
C<stat()> builtin function.
=cut
sub blksize {
my ($self) = @_;
Wyrd/DBL.pm view on Meta::CPAN
=pod
=item (scalar) C<blocks> (void)
the actual number of blocks allocated of the file currently being served.
Derived from Apache::Wyrd::Handler, by default compatible with the C<stat()>
builtin function.
=cut
sub blocks {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/XBEL.pm view on Meta::CPAN
return ($cache,0);
}
#
my $cache_mtime = (stat($cache))[9];
if ((stat(__FILE__))[9] > $cache_mtime ) {
$apache->log->debug("Cache is out of sync with handler.");
return ($cache,0);
}
if ((stat($file))[9] > $cache_mtime ) {
$apache->log->debug("Cache is out of sync with XBEL file.");
return ($cache,0);
}
my $xsl_file = $apache->dir_config("XslPath");
if ((stat($xsl_file))[9] > $cache_mtime) {
$apache->log->debug("Cache is out of sync with stylesheet.");
$xsl_stylesheet = $xml_parser->parse_file($xsl_file);
$xsl_transformer = $xsl_parser->parse_stylesheet($xsl_stylesheet);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache/XPP.pm view on Meta::CPAN
my $mtime = undef;
unless (-f $filename) {
return undef;
}
my $st = stat($filename); # using File::stat
if (ref($st) && $st->can('mtime')) {
return $st->mtime;
} else {
warn "xpp:\tcannot stat file ($filename): $!" . ($debuglines ? '' : "\n") if ($debug);
return undef;
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
examples/delete_session_data.pl view on Meta::CPAN
foreach my $file (@files)
{
if ($file =~ /^[a-z0-9]{32}$/ )
{
if ($now - (stat($dir.'/'.$file))[8] >= $time)
{
clean($dir.'/'.$file);
clean($dir.'/Apache-Session-'.$file.'.lock');
$cnt++;
$lnt++;
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Apache2/AuthenNTLM/Cookie.pm view on Meta::CPAN
PerlSetVar cookie_name my_cookie_name # default is NTLM_AUTHEN
PerlSetVar domain my_cookie_domain # default is none
PerlSetVar expires my_cookie_expires # default is none
PerlSetVar path my_cookie_path # default is none
PerlSetVar refresh some_seconds # default is 14400 (4 hours)
PerlSetVar secret my_secret_string # default from stat(config file)
See L<Apache2::Cookie> for explanation of variables
C<cookie_name>, C<domain>, C<expires>, and C<path>.
The only variables specific to the present module are
view all matches for this distribution