Acme-Sort-Sleep
view release on metacpan or search on metacpan
local/lib/perl5/IO/Async/File.pm view on Meta::CPAN
=head2 on_ctime_changed $new_ctime, $old_ctime
Invoked when each of the individual C<stat()> fields have changed. All the
C<stat()> fields are supported apart from C<blocks> and C<blksize>. Each is
passed the new and old values of the field.
=head2 on_devino_changed $new_stat, $old_stat
Invoked when either of the C<dev> or C<ino> fields have changed. It is passed
two L<File::stat> instances containing the complete old and new C<stat()>
fields. This can be used to observe when a named file is renamed; it will not
be observed to happen on opened filehandles.
=head2 on_stat_changed $new_stat, $old_stat
Invoked when any of the C<stat()> fields have changed. It is passed two
L<File::stat> instances containing the old and new C<stat()> fields.
=cut
=head1 PARAMETERS
local/lib/perl5/IO/Async/File.pm view on Meta::CPAN
=head2 handle => IO
The opened filehandle to watch for C<stat()> changes if C<filename> is not
supplied.
=head2 filename => STRING
Optional. If supplied, watches the named file rather than the filehandle given
in C<handle>. The file will be opened for reading and then watched for
renames. If the file is renamed, the new filename is opened and tracked
similarly after closing the previous file.
=head2 interval => NUM
Optional. The interval in seconds to poll the filehandle using C<stat(2)>
looking for size changes. A default of 2 seconds will be applied if not
defined.
=cut
local/lib/perl5/IO/Async/FileStream.pm view on Meta::CPAN
=head1 PARAMETERS
The following named parameters may be passed to C<new> or C<configure>, in
addition to the parameters relating to reading supported by
L<IO::Async::Stream>.
=head2 filename => STRING
Optional. If supplied, watches the named file rather than the filehandle given
in C<read_handle>. The file will be opened by the constructor, and then
watched for renames. If the file is renamed, the new filename is opened and
tracked similarly after closing the previous file.
=head2 interval => NUM
Optional. The interval in seconds to poll the filehandle using C<stat(2)>
looking for size changes. A default of 2 seconds will be applied if not
defined.
=cut
local/lib/perl5/IO/Async/FileStream.pm view on Meta::CPAN
my $self = shift;
my ( $want ) = @_;
croak "Cannot _watch_write in " . ref($self) if $want;
}
sub on_devino_changed
{
my $self = shift or return;
$self->{renamed} = 1;
$self->debug_printf( "read tail of old file" );
$self->read_more;
}
sub on_size_changed
{
my $self = shift or return;
my ( $size ) = @_;
if( $size < $self->{last_size} ) {
local/lib/perl5/IO/Async/FileStream.pm view on Meta::CPAN
sysseek( $self->read_handle, $self->{last_pos}, SEEK_SET ) if defined $self->{last_pos};
$self->on_read_ready;
$self->{last_pos} = sysseek( $self->read_handle, 0, SEEK_CUR ); # == systell
if( $self->{last_pos} < $self->{last_size} ) {
$self->loop->later( sub { $self->read_more } );
}
elsif( $self->{renamed} ) {
$self->debug_printf( "reopening for rename" );
$self->{last_size} = 0;
if( $self->{last_pos} ) {
$self->maybe_invoke_event( on_truncated => );
$self->{last_pos} = 0;
$self->loop->later( sub { $self->read_more } );
}
$self->configure( read_handle => $self->{file}->handle );
undef $self->{renamed};
}
}
sub write
{
carp "Cannot ->write from a ".ref($_[0]);
}
=head2 seek
local/lib/perl5/IO/Async/OS.pm view on Meta::CPAN
use constant HAVE_FAKE_ISREG_READY => 0;
# Do we have to select() for for evec to get connect() failures
use constant HAVE_SELECT_CONNECT_EVEC => 0;
# Ditto; do we have to poll() for POLLPRI to get connect() failures
use constant HAVE_POLL_CONNECT_POLLPRI => 0;
# Does connect() yield EWOULDBLOCK for nonblocking in progress?
use constant HAVE_CONNECT_EWOULDBLOCK => 0;
# Can we rename() files that are open?
use constant HAVE_RENAME_OPEN_FILES => 1;
# Do we have IO::Socket::IP available?
use constant HAVE_IO_SOCKET_IP => defined eval { require IO::Socket::IP };
# Can we reliably watch for POSIX signals, including SIGCHLD to reliably
# inform us that a fork()ed child has exit()ed?
use constant HAVE_SIGNALS => 1;
# Do we support POSIX-style true fork()ed processes at all?
local/lib/perl5/Module/Build/Base.pm view on Meta::CPAN
open(my $FIXOUT, '>', "$file.new")
or die "Can't create new $file: $!\n";
# Print out the new #! line (or equivalent).
local $\;
undef $/; # Was localized above
print $FIXOUT $shb, <$FIXIN>;
close $FIXIN;
close $FIXOUT;
rename($file, "$file.bak")
or die "Can't rename $file to $file.bak: $!";
rename("$file.new", $file)
or die "Can't rename $file.new to $file: $!";
$self->delete_filetree("$file.bak")
or $self->log_warn("Couldn't clean up $file.bak, leaving it there");
$self->do_system($c->get('eunicefix'), $file) if $c->get('eunicefix') ne ':';
}
}
sub ACTION_testpod {
( run in 0.438 second using v1.01-cache-2.11-cpan-e9daa2b36ef )