view release on metacpan or search on metacpan
lib/App/wordstat.pm view on Meta::CPAN
=head2 wordstat
Usage:
wordstat(%args) -> [status, msg, payload, meta]
Return word statistics of a text.
Examples:
=over
=item * Example #1:
wordstat(text => "An optimistic person sees good things everywhere, is generally confident and\nhopeful of what the future holds. From the optimist's point-of-view the world is\nfull of potential opportunities. The pessimist, on the other hand, obse...
Result:
[
200,
lib/App/wordstat.pm view on Meta::CPAN
},
]
=item * Supply text from file or stdin:
wordstat( text => "file.txt");
=back
This function is not exported.
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
return $ret;
}
sub load_zen_file
{
my $filename = shift;
my $st = stat($filename);
my $mtime = $st->mtime;
my $filesize = $st->size;
open(my $fh, '<:encoding(UTF-8)', $filename)
or die "Could not open file '$filename' $!";
# Should return the data since last fetch offset.
sub on_append_file {
my ($cgi, $path) = @_;
my $data = $cgi->param('POSTDATA');
append_to_file($path, $data);
my @stat_info = stat($path);
if (@stat_info) {
# Extract the last modification time
my $mtime = $stat_info[9];
print "HTTP/1.0 200 OK\r\n";
print "Last-Modified: $mtime\r\n";
my $n = $cgi->url_param('n') || 0;
my $last_mtime = $cgi->url_param('last_modified');
if (-f $path) {
# override require last_mtime
my $stat = stat($path);
my $mtime = $stat->mtime;
if (!$last_mtime) {
write_error(409, "Conflict", "Missing query parameter 'last_modified' l=$l");
print Dumper $cgi;
return;
write_file($path, $x.$data.$y);
} else {
print "HTTP/1.0 400 Bad request\r\n";
return;
}
my $mtime = stat($path)->mtime;
if ($mtime) {
print "HTTP/1.0 200 OK\r\n";
print "Last-Modified: $mtime\r\n";
print "Content-Length: 0\r\n\r\n";
} else {
while (<FH>) {
print $_;
}
close FH;
} elsif ($raw eq '1' && $l > 0) {
my $mtime = stat($path)->mtime;
print "HTTP/1.0 200 OK\r\n";
print "Last-Modified: $mtime\r\n";
print "Content-Type: text/plain\r\n\r\n";
open my $fh, '<', $path or die "Can not open file: $!";
while (<$fh>) {
close $fh;
} else {
my ($ext) = $path =~ /\.([^.]+)$/;
my $mime_type = $mimeTypes{lc($ext)} || 'application/octet-stream';
open my $fh, '<:raw', $path or die "Cannot open file: $!";
my $mtime = stat($path)->mtime;
my $filesize = -s $path;
print "HTTP/1.1 200 OK\r\n";
print "Content-Type: $mime_type\r\n";
print "Last-Modified: $mtime\r\n";
print "Content-Length: $filesize\r\n";
opendir(my $dh, $path) or die "Cannot open directory: $!";
while (my $file = readdir $dh) {
next if $file =~ /^\./;
next if $file =~ /~$/;
my $filepath = "$path/$file";
my $mtime = stat($filepath)->mtime;
push @contents, {
name => -d $filepath ? "$file/" : $file,
size => -s "$path/$file",
mtime => $mtime,
};
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/Arabic.pm view on Meta::CPAN
# Filter >>>
# Source >
# Escape >>>>> executable without re-escape
#----------------------------------------------------
my $mtime_filter = (stat(__FILE__ ))[9];
my $mtime_source = (stat($filename ))[9];
my $mtime_escape = (stat("$filename.e"))[9];
if (($mtime_escape < $mtime_source) or ($mtime_escape < $mtime_filter)) {
unlink "$filename.e";
}
}
}
lib/Arabic.pm view on Meta::CPAN
seek($fh, 0, 0) or die __FILE__, ": Can't seek file: $filename.e\n";
my $e_script = Arabic::escape_script($filename);
print {$fh} $e_script;
my $mode = (stat($filename))[2] & 0777;
chmod $mode, "$filename.e";
close($fh) or die "Can't close file: $filename.e: $!";
}
view all matches for this distribution
view release on metacpan or search on metacpan
perllib/Arch/Inventory.pm view on Meta::CPAN
sub annotate_fs ($;$) {
my $self = shift;
if (@_) {
$_[0]->{stat} = [ lstat("$self->{directory}/$_[0]->{path}") ];
$_[0]->{symlink} = readlink("$self->{directory}/$_[0]->{path}")
if $_[0]->{type} eq SYMLINK;
} else {
$self->foreach(sub { $self->annotate_fs($_[0]) });
}
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/Archive/Ar/Libarchive.pm view on Meta::CPAN
unless(-r $filename)
{
$self->_error("No such file: $filename");
next;
}
my @props = stat($filename);
unless(@props)
{
$self->_error("Could not stat $filename.");
next;
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Archive/Ar.pm view on Meta::CPAN
$ar->add_files(@filenames)
$ar->add_files($arrayref)
Adds files to the archive. The arguments can be paths, but only the
filenames are stored in the archive. Stores the uid, gid, mode, size,
and modification timestamp of the file as returned by C<stat()>.
Returns the number of files successfully added, or undef if failure.
=head2 add_data
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
FILE *fp = NULL;
struct stat fileStatus;
aFile->name = (char *)strdup(fileName);
if(stat(aFile->name, &fileStatus) == -1) {
return _false;
}
aFile->size = fileStatus.st_size;
fp = fopen(aFile->name, "rb");
}
strncpy(aFile->name, fileName, length);
strncpy(aFile->name + length, ".b2\0", 4);
if (stat(aFile->name, &st) == 0) {
return _false;
}
fp = fopen(aFile->name, "wb");
if(fp == NULL) {
view all matches for this distribution
view release on metacpan or search on metacpan
// Function that checks if the file/directory given as an argument exists.
//------------------------------------------------------------------------------*/
static int _dir_exists(const char *path)
{
struct stat statbuf;
if (stat(path, &statbuf) != -1)
return 1;
else
return 0;
}
view all matches for this distribution
view release on metacpan or search on metacpan
t/common_stat.t view on Meta::CPAN
archive_entry_set_rdev($entry, 0x1357);
archive_entry_set_atime($entry, 123456789, 123456789);
archive_entry_set_mtime($entry, 123456779, 123456779);
archive_entry_set_ctime($entry, 123456769, 123456769);
my($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $atime, $mtime, $ctime) = eval { archive_entry_stat($entry) };
diag $@ if $@;
is $dev, 0x1234, 'dev';
is $ino, 0x5678, 'ino';
is $mode, 0400, 'mode';
t/common_stat.t view on Meta::CPAN
subtest 'archive_entry_set_stat' => sub {
plan tests => 10;
my $entry = archive_entry_new();
eval { archive_entry_set_stat($entry,0x1234,0x5678,0400,1,500,501,0x1357,123456789,123456779,123456769) };
diag $@ if $@;
my $dev = archive_entry_dev($entry);
my $ino = archive_entry_ino($entry);
my $mode = archive_entry_mode($entry);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Archive/Libarchive/Compress.pm view on Meta::CPAN
} elsif(-f $path) {
$e->clear;
$e->set_pathname("$path");
$e->set_filetype('reg');
my $stat = FFI::C::Stat->new("$path");
$e->copy_stat($stat);
if($self->{entry}->($e)) {
my $ret = $w->write_header($e);
if($ret == ARCHIVE_WARN) {
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Archive/Libarchive/FFI.pm view on Meta::CPAN
foreach my $filename (@filenames)
{
my $entry = archive_entry_new();
archive_entry_set_pathname($entry, $filename);
archive_entry_set_size($entry, stat($filename)->size);
archive_entry_set_filetype($entry, AE_IFREG);
archive_entry_set_perm($entry, 0644);
archive_write_header($archive, $entry);
archive_write_data($archive, scalar read_file($filename));
archive_entry_free($entry);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Archive/Libarchive/XS.pm view on Meta::CPAN
foreach my $filename (@filenames)
{
my $entry = archive_entry_new();
archive_entry_set_pathname($entry, $filename);
archive_entry_set_size($entry, stat($filename)->size);
archive_entry_set_filetype($entry, AE_IFREG);
archive_entry_set_perm($entry, 0644);
archive_write_header($archive, $entry);
archive_write_data($archive, scalar read_file($filename));
archive_entry_free($entry);
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Archive/Libarchive/API.pm view on Meta::CPAN
$e->copy_sourcepath_w($wstring);
=head2 copy_stat
# archive_entry_copy_stat
$e->copy_stat($stat);
Copies the values from a L<FFI::C::Stat> instance.
Not currently implemented on Windows.
view all matches for this distribution
view release on metacpan or search on metacpan
xt/copyright.t view on Meta::CPAN
my $modified_ts;
if( $is_checkout ) {
# diag `git log -1 --pretty="format:%ct" "$file"`;
$modified_ts = `git log -1 --pretty="format:%ct" "$file"`;
} else {
$modified_ts = (stat($_))[9];
}
my $modified_year;
if( $modified_ts ) {
$modified_year = strftime('%Y', localtime($modified_ts));
view all matches for this distribution
view release on metacpan or search on metacpan
unless ( $skip ) {
for (2,4) {
mv catfile(DATA_DIR, "miffy.$_"), catfile(DATA_DIR, "miffy-moved.$_");
}
for (map "miffy.$_", 1,3..5) {
my $stat = (stat($_))[2] & 0777;
my $target = catfile(DATA_DIR, $_);
chmod 0600, $target
if -e $target; # #4 should be gone
cp $_, $target
or die sprintf "Failed to move %s -> %s: $!", $_, $target;
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
t/common.pm view on Meta::CPAN
my $testString = pack('C256', 0 .. 255);
my $testCrc = Archive::Zip::computeCRC32($testString);
$fh->write($testString, length($testString)) or return 0;
$fh->close();
(-f OUTPUTZIP) or return 0;
my @stat = stat(OUTPUTZIP);
$stat[7] == length($testString) or return 0;
fileCRC(OUTPUTZIP) == $testCrc or return 0;
unlink(OUTPUTZIP);
return 1;
}
view all matches for this distribution
view release on metacpan or search on metacpan
Version 2.0000
* Change to a versioning scheme more friendly to the mysterious
black box known as PAUSE
* Don't fail on EACCES when stat()ing file
Version 1.9
* Fix a bug in b_find() wherein some error recovery code tried to destroy
the same object twice, potentially
* Retool $builder->archive_as() to display error names for archive members,
rather than their original filenames, in appropriate circumstances
Version 1.6
* Avoid stat() calls on files excluded from archive
Version 1.5
* Correct handling of files between 4 GiB & 8 GiB, inclusive
view all matches for this distribution
view release on metacpan or search on metacpan
t/001Basic.t view on Meta::CPAN
ok(-s $f2 > 0, "Checking tarball files sizes");
is(-s $f1, -s $f2, "Comparing tarball files sizes");
my $f3 = $a2->locate("foo/bar/permtest");
my $perm = ((stat($f3))[2] & 07777);
is($perm, 0770, "permtest");
my $f4 = $a2->locate("foo/bar/string");
open FILE, "<$f4" or die "Cannot open $f4";
my $got_data = join '', <FILE>;
t/001Basic.t view on Meta::CPAN
);
$a5->read("$TARDIR/bar.tar");
$f1 = $a5->locate("bar/bar.dat");
$perm = ((stat($f1))[2] & 07777);
is($perm, 0664, "permtest");
SKIP: {
# gnu options
my $a6 = Archive::Tar::Wrapper::IPC::Cmd->new(
view all matches for this distribution
view release on metacpan or search on metacpan
t/001Basic.t view on Meta::CPAN
ok( -s $f2 > 0, 'Checking tarball files sizes' );
is( -s $f1, -s $f2, 'Comparing tarball files sizes' );
my $f3 = $a2->locate('foo/bar/permtest');
my $expected_permission = sprintf '%3o', ( ( stat($f3) )[2] & 07777 );
SKIP: {
skip 'Permissions are too different on Microsoft Windows', 1
if ( $Config{osname} eq 'MSWin32' || $Config{osname} eq 'msys' );
is( $expected_permission, '770',
t/001Basic.t view on Meta::CPAN
$a5->read( File::Spec->catfile( TARDIR, 'bar.tar' ) );
$f1 = $a5->locate('bar/bar.dat');
# TODO: add conditional note on Alpine to indicate that tar over there is broken regarding -p parameter
if ($f1) {
$expected_permission = sprintf '%3o', ( ( stat($f1) )[2] & 07777 );
}
else {
note( 'Could not locate "bar/bar.dat" inside the tarball '
. File::Spec->catfile( TARDIR, 'bar.tar' ) );
}
view all matches for this distribution
view release on metacpan or search on metacpan
lib/Archive/Tar/File.pm view on Meta::CPAN
if ($hash{uid} > 0x10000) {
$hash{uid} = $hash{uid} & 0xFFFF;
}
### The file length from stat() is the physical length of the file
### However the amount of data read in may be more for some file types.
### Fixed length files are read past the logical EOF to end of the block
### containing. Other file types get expanded on read because record
### delimiters are added.
view all matches for this distribution
view release on metacpan or search on metacpan
unzip-6.0/ToDo view on Meta::CPAN
o MSDOS/WIN32/others: detection of "reserved" names (= names of character
devices, or system extensions that look like a characters device driver)
at runtime; with the goal of emitting "meaningful" error messages and/or
rename queries.
(Currently, these reserved names are catched as "non-deletable files".
On MSDOS and WIN32, when the RTL stat() function allows to identify
character devices, the "reserved" names are automatically prefixed with
an underscore.)
o redesign "file exists -- is newer/older -- overwrite/skip/rename"
logic in extract.c and the corresponding system specific mapname()
unzip-6.0/ToDo view on Meta::CPAN
=======================================
o miscellaneous little stuff: whenever
--------------------------
- change DOS -f/-u stuff to use DOS API for getting filetimes, not stat()
- add (-N?) option to lose all user input and/or switch to "(*input)()"
function, replaceable by UzpAltMain() param
- add -@ option to read from stdin (zip) or from file (PKZIP)? (go32 built-in)
- add -oo option to overwrite OS/2 and DOS system and hidden files, too
view all matches for this distribution
view release on metacpan or search on metacpan
ZZip/ZZip.xs view on Meta::CPAN
OUTPUT:
RETVAL
HV *
stat(dir, name, flags)
Archive_ZZip dir
char *name
int flags
INIT:
int err;
ZZIP_DIRENT dirent;
HV *info;
CODE:
err = zzip_dir_stat(dir, name, &dirent, flags);
if (err == 0) {
HV_WITH_DIRENT(info, dirent);
}
else {
XSRETURN_UNDEF;
view all matches for this distribution