Acme-Sort-Sleep
view release on metacpan or search on metacpan
local/lib/perl5/IO/Async/Notifier.pm view on Meta::CPAN
=head2 remove_from_parent
$notifier->remove_from_parent
Removes this notifier object from its parent (either another notifier object
or the containing loop) if it has one. If the notifier is not a child of
another notifier nor a member of a loop, this method does nothing.
=cut
sub remove_from_parent
{
my $self = shift;
if( my $parent = $self->parent ) {
$parent->remove_child( $self );
}
elsif( my $loop = $self->loop ) {
$loop->remove( $self );
}
}
=head1 SUBCLASS METHODS
C<IO::Async::Notifier> is a base class provided so that specific subclasses of
it provide more specific behaviour. The base class provides a number of
methods that subclasses may wish to override.
If a subclass implements any of these, be sure to invoke the superclass method
at some point within the code.
=cut
=head2 _init
$notifier->_init( $paramsref )
This method is called by the constructor just before calling C<configure>.
It is passed a reference to the HASH storing the constructor arguments.
This method may initialise internal details of the Notifier as required,
possibly by using parameters from the HASH. If any parameters are
construction-only they should be C<delete>d from the hash.
=cut
sub _init
{
# empty default
}
=head2 configure
$notifier->configure( %params )
This method is called by the constructor to set the initial values of named
parameters, and by users of the object to adjust the values once constructed.
This method should C<delete> from the C<%params> hash any keys it has dealt
with, then pass the remaining ones to the C<SUPER::configure>. The base
class implementation will throw an exception if there are any unrecognised
keys remaining.
=cut
=head2 configure_unknown
$notifier->configure_unknown( %params )
This method is called by the base class C<configure> method, for any remaining
parameters that are not recognised. The default implementation throws an
exception using C<Carp> that lists the unrecognised keys. This method is
provided to allow subclasses to override the behaviour, perhaps to store
unrecognised keys, or to otherwise inspect the left-over arguments for some
other purpose.
=cut
=head2 _add_to_loop
$notifier->_add_to_loop( $loop )
This method is called when the Notifier has been added to a Loop; either
directly, or indirectly through being a child of a Notifer already in a loop.
This method may be used to perform any initial startup activity required for
the Notifier to be fully functional but which requires a Loop to do so.
=cut
sub _add_to_loop
{
# empty default
}
=head2 _remove_from_loop
$notifier->_remove_from_loop( $loop )
This method is called when the Notifier has been removed from a Loop; either
directly, or indirectly through being a child of a Notifier removed from the
loop.
This method may be used to undo the effects of any setup that the
C<_add_to_loop> method had originally done.
=cut
sub _remove_from_loop
{
# empty default
}
=head1 UTILITY METHODS
=cut
=head2 _capture_weakself
$mref = $notifier->_capture_weakself( $code )
( run in 0.573 second using v1.01-cache-2.11-cpan-99c4e6809bf )