Apache-Wyrd
view release on metacpan or search on metacpan
Wyrd/DBL.pm view on Meta::CPAN
sub globals {
my ($self) = @_;
return $self->{'globals'};
}
=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 {
my ($self) = @_;
return $self->{'mtime'};
}
=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 {
my ($self) = @_;
return $self->{'size'};
}
=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 {
my ($self) = @_;
return $self->{'dev'};
}
=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 {
my ($self) = @_;
return $self->{'ino'};
}
=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 {
my ($self) = @_;
return $self->{'mode'};
}
=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 {
my ($self) = @_;
return $self->{'nlink'};
}
=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 {
my ($self) = @_;
return $self->{'uid'};
}
=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 {
my ($self) = @_;
return $self->{'gid'};
}
=pod
=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) = @_;
return $self->{'rdev'};
}
=pod
=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) = @_;
return $self->{'atime'};
}
=pod
=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) = @_;
return $self->{'ctime'};
}
=pod
=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) = @_;
return $self->{'blksize'};
}
=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 {
my ($self) = @_;
return $self->{'blocks'};
}
Wyrd/FileSize.pm view on Meta::CPAN
Reserves the _format_output method.
=cut
sub _format_output {
my ($self) = @_;
my $file = $self->{'file'};
$file = $self->dbl->req->document_root . "$file";
if (-f $file) {
my @stat = stat(_);
my $size = $stat[7];
my $unit = 'K';
if ($size < 1048576) {
$size /= 1024;
} else {
$size /= 1048576;
$unit = 'M';
}
$size = int($size * 100);
$size =~ s/(\d\d)$/.$1/;
Wyrd/Services/FileCache.pm view on Meta::CPAN
if ($self->can('dbl')) {#we're in a Wyrd, so we can check the dir_config;
if ($self->dbl->req->dir_config('NoFileCache')) {
$force_load = 1;
}
$new_timeout = $self->dbl->req->dir_config('FileCacheTimeout')
}
#NB use or flip-flop for $new_timeout so that the dir-config value does not persist
#across different directory boundaries.
if ($force_load or ($_previous_checktime_register < ($time - ($new_timeout || $timeout)))) {
#$self->_info("checking $file against file cache");
@stats = stat($file);
delete($_file_cache_register{$file}) if ($stats[9] > $_file_timestamp_register{$file});
$_previous_checktime_register = $time;
}
return $_file_cache_register{$file} if (exists($_file_cache_register{$file}));
unless (-r $file and -f _) {
$self->_raise_exception("File $file cannot be read or is not a proper file.")
unless ($self->_flags->allow_nonexistent_files);
}
$self->_info("reading $file for file cache") if ($self->can('_info'));
$_file_cache_register{$file} = ${slurp_file($file)};
Wyrd/Site/Index.pm view on Meta::CPAN
my $out = $self->purge_missing($req);
my $ua = $self->ua;
$ua->timeout(60);
local $| = 1;
open (FILES, '-|', "/usr/bin/find $root -name \*.html");
my $counter = 0;
$lastindex = ${slurp_file($root. "/var/lastindex.db")};
my $newest = $lastindex;
while (<FILES>) {
chomp;
my @stats = stat($_);
#warn "Document status/lastindex/current newest:" . join('/', $stats[9], $lastindex, $newest);
$newest = $stats[9] if ($stats[9] > $newest);
$counter++;
next if ($fastindex and ($stats[9] < $lastindex));
s/$root//;
next if $self->skip_file($_);
my $url = "http://$hostname$_";
my $response = $ua->request(GET $url);
my $status = $response->status_line;
$out .= "<br>$_: OK" if ($status =~ /200|OK/);
Wyrd/Site/IndexBot.pm view on Meta::CPAN
while (<FILES>) {
chomp;
push @files, $_;
}
print "<P>" . scalar(@files) . " files to index.</p>";
#For each file, try to navigate to it with the User-agent. Use the auth
#cookie of the viewer of this Wyrd.
my $counter = 0;
while ($_ = shift @files) {
my @stats = stat($_);
#warn "Document status/lastindex/current newest:" . join('/', $stats[9], $lastindex, $newest);
$newest = $stats[9] if ($stats[9] > $newest);
$counter++;
s/$root//;
unless ($no_skip{$_}) {
next if ($self->{'fastindex'} and ($stats[9] <= $lastindex));
next if $index->skip_file($_);
}
my $url = "http://$hostname$_";
my $response = '';
( run in 1.341 second using v1.01-cache-2.11-cpan-49f99fa48dc )