Arne Gödeke > Net-PSYC-0.21 > Net::PSYC::Event

Download:
Net-PSYC-0.21.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.4   Source  

sub assign { my $self = shift; return if ($self->{'assign'} && $self->{'assign'}->(@_)); $self->SUPER::assign(@_); }

sub augment { my $self = shift; return if ($self->{'augment'} && $self->{'augment'}->(@_)); $self->SUPER::augment(@_); }

sub diminish { my $self = shift; return if ($self->{'diminish'} && $self->{'diminish'}->(@_)); $self->SUPER::diminish(@_); }

sub reset { my $self = shift; return if ($self->{'reset'} && $self->{'reset'}->(@_)); $self->SUPER::reset(@_); }

NAME ^

Net::PSYC::Event - Event wrapper for various event systems.

DESCRIPTION ^

Net::PSYC::Event offers an interface to easily use Net::PSYC with different Event systems. It currently offers support for Event.pm, IO::Select and Gtk2.

SYNOPSIS ^

    # load Net::PSYC::Event for Gtk2 eventing.
    use Net::PSYC qw(Event=Gtk2);
    use Net::PSYC::Event qw(register_uniform unregister_uniform start_loop);

    bind_uniform('psyc://example.org/');
    register_uniform('psyc://example.org/@chatroom');
 
    sub msg {
        my ($source, $mc, $data, $vars) = @_;
        # lets do some conferencing
    }

    start_loop() # start the event-loop

PERL API ^

register_uniform( $unl[, $object ] )

Registers $object or the calling package for all incoming messages targeted at $unl. Calls

$object->msg( $source, $mc, $data, $vars ) or

caller()::msg( $source, $mc, $data, $vars )

for every incoming PSYC packet.

unregister_uniform( $unl )

Unregister an $unl. No more packages will be delivered for that $unl thenceforward.

start_loop()

Start the Event loop.

stop_loop()

Stop the Event loop.

add( $fd, $flags, $callback[, $repeat])

Start watching for events on $fd. $fd may be a GLOB or an IO::Handle object. $flags may be r, w or e (data to be read, written or pending exceptions) or any combination.

If $repeat is set to 0 the callback will only be called once (revoke() may be used to reactivate it). If you don't want one-shot events either leave $repeat out or set it to 1.

$id = add( $time, 't', $callback[, $repeat])

Add a timer event. The event will be triggered after $time seconds. This is a one-shot event by default. However, if $repeat is set to 1, $callback will be called every $time seconds until the event is removed.

One-shot timer events are removed automatically and revoke is not possible for them.

Remember: You are not using a real-time system. The accuracy of timer events depends heavily on other events pending, io-operations and system load in general.

remove( $fd[, $flags] )

Stop watching for events on $fd. Different types can not be removed seperately if they have been add()ed together!

remove( $id )

Removed the timer event associated with the given $id.

revoke( $fd )

Revokes the eventing for $fd. ( one-shot events )

SEE ALSO ^

Net::PSYC, Net::PSYC::Client, Net::PSYC::Event::Event, Net::PSYC::Event::IO_Select, Net::PSYC::Event::Gtk2, http://psyc.pages.de/

AUTHORS ^

Arne Gödeke <el@goodavice.pages.de>

COPYRIGHT ^

Copyright (c) 1998-2005 Arne Gödeke and Carlo v. Loesch. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: