AnyEvent
view release on metacpan or search on metacpan
lib/AnyEvent/Impl/Irssi.pm view on Meta::CPAN
=head1 NAME
AnyEvent::Impl::Irssi - AnyEvent adaptor for Irssi
=head1 SYNOPSIS
use AnyEvent;
# this module gets loaded automatically when running under irssi
=head1 DESCRIPTION
This module provides transparent support for AnyEvent. You don't have to
do anything to make Irssi scripts work with AnyEvent.
Limitations of this backend and implementation details:
=over 4
=item * This backend does not support blocking waits.
That means you must set a callback on any condvars, or otherwise make sure
to never call C<recv> on a condvar that hasn't been signalled yet.
=item * Child exits will be handled by AnyEvent.
AnyEvent will take over child handling, as Irssi only polls for children
once/second and cannot handle unspecific child watchers.
This I<should> have no negative effect, as AnyEvent will emit a pidwait
signal just like irssi itself would.
=item * Artificial timer delays.
Irssi artificially enforces timers to have at least a 10ms delay (by
croaking, even).
This means that some applications will be limited to a rate of 100Hz (for
example, L<Coro::AnyEvent> thread scheduling).
=item * Irssi leaks memory like hell.
Yeah.
=back
Apart from that, documentation is notoriously wrong (e.g. file handles
are not supported by C<input_add>, contrary to documentation), hooking
into irssi has to be done in... weird... ways, but otherwise, Irssi is
surprisingly full-featured (for basically being a hack).
=cut
package AnyEvent::Impl::Irssi;
use AnyEvent (); BEGIN { AnyEvent::common_sense }
use Carp ();
use Irssi ();
our @ISA;
# irssi works only from certain namespaces, so we
# create one and use it.
sub init {
my $pkg = caller;
push @ISA, $pkg;
local $/;
eval "package $pkg; " . <DATA>;
print "AnyEvent::Impl::Irssi fatal compilation error: $@" if $@;
close DATA;
( run in 0.951 second using v1.01-cache-2.11-cpan-39bf76dae61 )