AnyEvent
view release on metacpan or search on metacpan
Makefile.PL view on Meta::CPAN
*** and performant, even without any of the optional modules.
***
EOF
do "./constants.pl.PL"
or die "cannot execute constants.pl.PL: $@";
WriteMakefile(
dist => {
PREOP => 'pod2text lib/AnyEvent.pm | tee README >$(DISTVNAME)/README; chmod -R u=rwX,go=rX . ;',
COMPRESS => 'gzip -9v',
SUFFIX => '.gz',
},
test => { TESTS => "t/*.t t/handle/*.t" },
NAME => "AnyEvent",
VERSION_FROM => "lib/AnyEvent.pm",
PMLIBDIRS => ["lib"],
# PREREQ_PM => {
# Task::Weaken => 0,
# },
lib/AnyEvent/IO.pm view on Meta::CPAN
=cut
package AnyEvent::IO;
use AnyEvent (); BEGIN { AnyEvent::common_sense }
use base "Exporter";
our @AIO_REQ = qw(
aio_load aio_open aio_close aio_seek aio_read aio_write aio_truncate
aio_utime aio_chown aio_chmod aio_stat aio_lstat
aio_link aio_symlink aio_readlink aio_rename aio_unlink
aio_mkdir aio_rmdir aio_readdir
);
*EXPORT = \@AIO_REQ;
our @FLAGS = qw(O_RDONLY O_WRONLY O_RDWR O_CREAT O_EXCL O_TRUNC O_APPEND);
*EXPORT_OK = \@FLAGS;
our %EXPORT_TAGS = (flags => \@FLAGS, aio => \@AIO_REQ);
our $MODEL;
lib/AnyEvent/IO.pm view on Meta::CPAN
uid or gid of the file is not changed. This differs from Perl's C<chown>
built-in, which wants C<-1> for this.
Example: update the group of F<file> to 0 (root), but leave the owner alone.
aio_chown "file", undef, 0, sub {
@_
or return AE::log error => "chown 'file': $!";
};
=item aio_chmod $fh_or_path, $perms, $cb->($success)
Calls C<chmod> on the path or perl file handle and passes a true value to
the callback on success.
Example: change F<file> to be user/group/world-readable, but leave the other flags
alone.
aio_stat "file", sub {
@_
or return AE::log error => "file: $!";
aio_chmod "file", (stat _)[2] & 07777 | 00444, sub { };
};
=item aio_stat $fh_or_path, $cb->($success)
=item aio_lstat $path, $cb->($success)
Calls C<stat> or C<lstat> on the path or perl file handle and passes a
true value to the callback on success.
The stat data will be available by C<stat>'ing the C<_> file handle
lib/AnyEvent/IO/IOAIO.pm view on Meta::CPAN
sub aio_utime($$$$) {
my $cb = $_[3];
IO::AIO::aio_utime $_[0], $_[1], $_[2], sub { $cb->($_[0] ? () : 1) };
}
sub aio_chown($$$$) {
my $cb = $_[3];
IO::AIO::aio_chown $_[0], $_[1], $_[2], sub { $cb->($_[0] ? () : 1) };
}
sub aio_chmod($$$) {
my $cb = $_[2];
IO::AIO::aio_chmod $_[0], $_[1], sub { $cb->($_[0] ? () : 1) };
}
sub aio_stat($$) {
my $cb = $_[1];
IO::AIO::aio_stat $_[0], sub { $cb->($_[0] ? () : 1) };
}
sub aio_lstat($$) {
my $cb = $_[1];
IO::AIO::aio_lstat $_[0], sub { $cb->($_[0] ? () : 1) }
lib/AnyEvent/IO/Perl.pm view on Meta::CPAN
}
sub aio_utime($$$$) {
$_[3](utime $_[1], $_[2], $_[0] or ());
}
sub aio_chown($$$$) {
$_[3](chown defined $_[1] ? $_[1] : -1, defined $_[2] ? $_[2] : -1, $_[0] or ());
}
sub aio_chmod($$$) {
$_[2](chmod $_[1], $_[0] or ());
}
sub aio_stat($$) {
$_[1](stat $_[0]);
}
sub aio_lstat($$) {
$_[1](lstat $_[0]);
}
t/io_common view on Meta::CPAN
#! perl
$| = 1;
# not tested: symlink, readlink, link, utime, chown, chmod
BEGIN {
print "1..37\n";
print "ok 1 # MODEL=$AnyEvent::IO::MODEL\n";
}
use AnyEvent;
use AnyEvent::IO qw(:DEFAULT :flags);
BEGIN {
print "ok 2 # MODEL=$AnyEvent::IO::MODEL\n";
}
( run in 0.554 second using v1.01-cache-2.11-cpan-496ff517765 )