poe component
Sponsored Links
Sponsored Links
Secleted [ 0 ] software to compare
Results 1 - 15 of about 1090
POE::Component::IRC 4.93
POE::Component::IRC is a fully event-driven IRC client module. more>>
POE::Component::IRC is a fully event-driven IRC client module.
SYNOPSIS
# A simple Rot13 encryption bot
use strict;
use warnings;
use POE qw(Component::IRC);
my $nickname = Flibble . $$;
my $ircname = Flibble the Sailor Bot;
my $ircserver = irc.blahblahblah.irc;
my $port = 6667;
my @channels = ( #Blah, #Foo, #Bar );
# We create a new PoCo-IRC object and component.
my $irc = POE::Component::IRC->spawn(
nick => $nickname,
server => $ircserver,
port => $port,
ircname => $ircname,
) or die "Oh noooo! $!";
POE::Session->create(
package_states => [
main => [ qw(_default _start irc_001 irc_public) ],
],
heap => { irc => $irc },
);
$poe_kernel->run();
exit 0;
sub _start {
my ($kernel,$heap) = @_[KERNEL,HEAP];
# We get the session ID of the component from the object
# and register and connect to the specified server.
my $irc_session = $heap->{irc}->session_id();
$kernel->post( $irc_session => register => all );
$kernel->post( $irc_session => connect => { } );
undef;
}
sub irc_001 {
my ($kernel,$sender) = @_[KERNEL,SENDER];
# Get the components object at any time by accessing the heap of
# the SENDER
my $poco_object = $sender->get_heap();
print "Connected to ", $poco_object->server_name(), "n";
# In any irc_* events SENDER will be the PoCo-IRC session
$kernel->post( $sender => join => $_ ) for @channels;
undef;
}
sub irc_public {
my ($kernel,$sender,$who,$where,$what) = @_[KERNEL,SENDER,ARG0,ARG1,ARG2];
my $nick = ( split /!/, $who )[0];
my $channel = $where->[0];
if ( my ($rot13) = $what =~ /^rot13 (.+)/ ) {
$rot13 =~ tr[a-zA-Z][n-za-mN-ZA-M];
$kernel->post( $sender => privmsg => $channel => "$nick: $rot13" );
}
undef;
}
# We registered for all events, this will produce some debug info.
sub _default {
my ($event, $args) = @_[ARG0 .. $#_];
my @output = ( "$event: " );
foreach my $arg ( @$args ) {
if ( ref($arg) eq ARRAY ) {
push( @output, "[" . join(" ,", @$arg ) . "]" );
} else {
push ( @output, "$arg" );
}
}
print STDOUT join , @output, "n";
return 0;
}
POE::Component::IRC is a POE component (whod have guessed?) which acts as an easily controllable IRC client for your other POE components and sessions. You create an IRC component and tell it what events your session cares about and where to connect to, and it sends back interesting IRC events when they happen. You make the client do things by sending it events. Thats all there is to it. Cool, no?
[Note that using this module requires some familiarity with the details of the IRC protocol. Id advise you to read up on the gory details of RFC 1459 before you get started. Keep the list of server numeric codes handy while you program. Needless to say, youll also need a good working knowledge of POE, or this document will be of very little use to you.]
The POE::Component::IRC distribution has a docs/ folder with a collection of salient documentation including the pertinent RFCs.
POE::Component::IRC consists of a POE::Session that manages the IRC connection and dispatches irc_ prefixed events to interested sessions and an object that can be used to access additional information using methods.
Sessions register their interest in receiving irc_ events by sending register to the component. One would usually do this in your _start handler. Your session will continue to receive events until you unregister. The component will continue to stay around until you tell it not to with shutdown.
The SYNOPSIS demonstrates a fairly basic bot.
<<lessSYNOPSIS
# A simple Rot13 encryption bot
use strict;
use warnings;
use POE qw(Component::IRC);
my $nickname = Flibble . $$;
my $ircname = Flibble the Sailor Bot;
my $ircserver = irc.blahblahblah.irc;
my $port = 6667;
my @channels = ( #Blah, #Foo, #Bar );
# We create a new PoCo-IRC object and component.
my $irc = POE::Component::IRC->spawn(
nick => $nickname,
server => $ircserver,
port => $port,
ircname => $ircname,
) or die "Oh noooo! $!";
POE::Session->create(
package_states => [
main => [ qw(_default _start irc_001 irc_public) ],
],
heap => { irc => $irc },
);
$poe_kernel->run();
exit 0;
sub _start {
my ($kernel,$heap) = @_[KERNEL,HEAP];
# We get the session ID of the component from the object
# and register and connect to the specified server.
my $irc_session = $heap->{irc}->session_id();
$kernel->post( $irc_session => register => all );
$kernel->post( $irc_session => connect => { } );
undef;
}
sub irc_001 {
my ($kernel,$sender) = @_[KERNEL,SENDER];
# Get the components object at any time by accessing the heap of
# the SENDER
my $poco_object = $sender->get_heap();
print "Connected to ", $poco_object->server_name(), "n";
# In any irc_* events SENDER will be the PoCo-IRC session
$kernel->post( $sender => join => $_ ) for @channels;
undef;
}
sub irc_public {
my ($kernel,$sender,$who,$where,$what) = @_[KERNEL,SENDER,ARG0,ARG1,ARG2];
my $nick = ( split /!/, $who )[0];
my $channel = $where->[0];
if ( my ($rot13) = $what =~ /^rot13 (.+)/ ) {
$rot13 =~ tr[a-zA-Z][n-za-mN-ZA-M];
$kernel->post( $sender => privmsg => $channel => "$nick: $rot13" );
}
undef;
}
# We registered for all events, this will produce some debug info.
sub _default {
my ($event, $args) = @_[ARG0 .. $#_];
my @output = ( "$event: " );
foreach my $arg ( @$args ) {
if ( ref($arg) eq ARRAY ) {
push( @output, "[" . join(" ,", @$arg ) . "]" );
} else {
push ( @output, "$arg" );
}
}
print STDOUT join , @output, "n";
return 0;
}
POE::Component::IRC is a POE component (whod have guessed?) which acts as an easily controllable IRC client for your other POE components and sessions. You create an IRC component and tell it what events your session cares about and where to connect to, and it sends back interesting IRC events when they happen. You make the client do things by sending it events. Thats all there is to it. Cool, no?
[Note that using this module requires some familiarity with the details of the IRC protocol. Id advise you to read up on the gory details of RFC 1459 before you get started. Keep the list of server numeric codes handy while you program. Needless to say, youll also need a good working knowledge of POE, or this document will be of very little use to you.]
The POE::Component::IRC distribution has a docs/ folder with a collection of salient documentation including the pertinent RFCs.
POE::Component::IRC consists of a POE::Session that manages the IRC connection and dispatches irc_ prefixed events to interested sessions and an object that can be used to access additional information using methods.
Sessions register their interest in receiving irc_ events by sending register to the component. One would usually do this in your _start handler. Your session will continue to receive events until you unregister. The component will continue to stay around until you tell it not to with shutdown.
The SYNOPSIS demonstrates a fairly basic bot.
Download (0.23MB)
Added: 2006-06-15 License: Perl Artistic License Price:
1227 downloads
POE::Component::OSCAR 0.05
POE::Component::OSCAR is a POE component for the Net::OSCAR module. more>>
POE::Component::OSCAR is a POE component for the Net::OSCAR module.
SYNOPSIS
use POE qw(Component::OSCAR);
[ ... POE set up ... ]
sub _start { # start an OSCAR session $oscar = POE::Component::OSCAR->new();
# start an OSCAR session with automatic throttling of new connections
# to prevent being banned by the server
$oscar = POE::Component::OSCAR->new( throttle => 4 );
# set up the "im_in" callback to call your state, "im_in_state"
$oscar->set_callback( im_in => im_in_state);
# its good to detect errors if you dont want to get banned
$oscar->set_callback( error => error_state );
$oscar->set_callback( admin_error => admin_erro_stater );
$oscar->set_callback( rate_alert => rate_alert_state );
# sign on
$oscar->signon( screenname => $MY_SCREENNAME, password => $MY_PASSWORD );
}
sub im_in_state { my ($nothing, $args) = @_[ARG0..$#_]; my ($object, $who, $what, $away) = @$args;
print "Got $what from $whon";
}
<<lessSYNOPSIS
use POE qw(Component::OSCAR);
[ ... POE set up ... ]
sub _start { # start an OSCAR session $oscar = POE::Component::OSCAR->new();
# start an OSCAR session with automatic throttling of new connections
# to prevent being banned by the server
$oscar = POE::Component::OSCAR->new( throttle => 4 );
# set up the "im_in" callback to call your state, "im_in_state"
$oscar->set_callback( im_in => im_in_state);
# its good to detect errors if you dont want to get banned
$oscar->set_callback( error => error_state );
$oscar->set_callback( admin_error => admin_erro_stater );
$oscar->set_callback( rate_alert => rate_alert_state );
# sign on
$oscar->signon( screenname => $MY_SCREENNAME, password => $MY_PASSWORD );
}
sub im_in_state { my ($nothing, $args) = @_[ARG0..$#_]; my ($object, $who, $what, $away) = @$args;
print "Got $what from $whon";
}
Download (0.006MB)
Added: 2007-04-18 License: Perl Artistic License Price:
919 downloads
POE::Component::Growl 1.00
POE::Component::Growl provides a Growl notification dispatcher for POE. more>>
POE::Component::Growl provides a Growl notification dispatcher for POE.
POE::Component::Growl provides a facility for notifying events through Growl using the Mac::Growl module as back-end. Integration with POEs architecture allows easy, non-blocking notifications.
Multiple notifiers can be spawned within the same POE application with multiple default options..
A program must spawn at least one POE::Component::Growl instance before it can perform Growl notifications. Each instance registers itself with Growl itself by passing a few parameters to it, and a reference to the object is returned for optional manual handling (see notify method below).
The following parameters can be passed to the spawn constructor (AppName and Notifications are required).
AppName
This must contain the name of the application. It may be a free string as it isnt required to match any existing file name; its purpose is only to let Growl define user preferences for each application.
Notifications
This must be an arrayref containing the list of possible notifications from our application. These names will be displayed in Growl preference pane to let users customize options for each notification.
DefaultNotificatons
(Optional) This parameter can contain an arrayref with the list of notifications to enable by default. If DefaultNotifications isnt provided, POE::Component::Growl will enable all available notifications, otherwise the user will have to manually enable those which arent included here.
Alias
(Optional) This parameter will be used to set POEs internal session alias. This is useful to post events and is also very important if you instantiate multiple notifiers. If left empty, the alias will be set to "Growl".
IconOfApp
(Optional) This parameter can contain the name of an application whose icon is to use by default.
<<lessPOE::Component::Growl provides a facility for notifying events through Growl using the Mac::Growl module as back-end. Integration with POEs architecture allows easy, non-blocking notifications.
Multiple notifiers can be spawned within the same POE application with multiple default options..
A program must spawn at least one POE::Component::Growl instance before it can perform Growl notifications. Each instance registers itself with Growl itself by passing a few parameters to it, and a reference to the object is returned for optional manual handling (see notify method below).
The following parameters can be passed to the spawn constructor (AppName and Notifications are required).
AppName
This must contain the name of the application. It may be a free string as it isnt required to match any existing file name; its purpose is only to let Growl define user preferences for each application.
Notifications
This must be an arrayref containing the list of possible notifications from our application. These names will be displayed in Growl preference pane to let users customize options for each notification.
DefaultNotificatons
(Optional) This parameter can contain an arrayref with the list of notifications to enable by default. If DefaultNotifications isnt provided, POE::Component::Growl will enable all available notifications, otherwise the user will have to manually enable those which arent included here.
Alias
(Optional) This parameter will be used to set POEs internal session alias. This is useful to post events and is also very important if you instantiate multiple notifiers. If left empty, the alias will be set to "Growl".
IconOfApp
(Optional) This parameter can contain the name of an application whose icon is to use by default.
Download (0.004MB)
Added: 2007-03-29 License: Perl Artistic License Price:
939 downloads
POE::Component::Enc::Mp3 1.2
POE::Component::Enc::Mp3 is a mp3 encoder wrapper. more>>
POE::Component::Enc::Mp3 is a mp3 encoder wrapper.
SYNOPSIS
use POE qw(Component::Enc::Mp3);
$mp3 = POE::Component::Enc::Mp3->new($bitrate => 160);
$mp3->enc("/tmp/tst.wav");
POE::Kernel->run();
This POE component encodes raw audio files into mp3 format. It is merely a wrapper for the notlame program.
METHODS
The module provides an object oriented interface as follows:
new
Used to initialise the system and create a module instance. The following parameters are available:
alias
Indicates the name of a session to which module callbacks are posted. Default: main.
bitrate
Should be self-evident. If left unspecified, defaults to 160.
enc < file-name > [del-orig]
Encodes the given file, naming it with a .mp3 extension. An optional true value for the second parameter indicates that the original file should be deleted.
e.g. $mp3->enc("/tmp/tst.wav");
<<lessSYNOPSIS
use POE qw(Component::Enc::Mp3);
$mp3 = POE::Component::Enc::Mp3->new($bitrate => 160);
$mp3->enc("/tmp/tst.wav");
POE::Kernel->run();
This POE component encodes raw audio files into mp3 format. It is merely a wrapper for the notlame program.
METHODS
The module provides an object oriented interface as follows:
new
Used to initialise the system and create a module instance. The following parameters are available:
alias
Indicates the name of a session to which module callbacks are posted. Default: main.
bitrate
Should be self-evident. If left unspecified, defaults to 160.
enc < file-name > [del-orig]
Encodes the given file, naming it with a .mp3 extension. An optional true value for the second parameter indicates that the original file should be deleted.
e.g. $mp3->enc("/tmp/tst.wav");
Download (0.003MB)
Added: 2006-11-07 License: Perl Artistic License Price:
1081 downloads
POE::Component::Basement 0.01
POE::Component::Basement provides Class::Std and base POE component functionality. more>>
POE::Component::Basement provides Class::Std and base POE component functionality.
SYNOPSIS
package POE::MyComponent;
# use as base
use base qw/ POE::Component::Basement /;
# where the initializations happen (see Class::Std)
sub BUILD { ... }
# see also Class::Std and Class::Data::Inheritable also
# for accessor creation etc.
# define states
sub state_one : State( :inline< _start > ) { ... }
sub state_two : State( :object< foo > ) { ... }
sub state_three : State( :package< bar > ) { ... }
# combined
sub state_multi : State( :inline< foobar > :package< snafoo > ) { ... }
...
# chained events
sub first : State( :object< foo > :chained< bar > ) { ... }
sub second : State( :object< bar > ) { ... }
...
# calling in a row
sub first : State( :object< foo > :next< bar > ) { ... }
sub second : State( :object< bar > ) { ... }
...
# usage
my $comp = POE::MyComponent->new ({
# single alias or array reference for multiple
aliases => [qw/ mycomp shub_niggurath /],
... # your specific init_args.
});
Provides Class::Std and base POE component functionality. This module is still kinda experimental.
<<lessSYNOPSIS
package POE::MyComponent;
# use as base
use base qw/ POE::Component::Basement /;
# where the initializations happen (see Class::Std)
sub BUILD { ... }
# see also Class::Std and Class::Data::Inheritable also
# for accessor creation etc.
# define states
sub state_one : State( :inline< _start > ) { ... }
sub state_two : State( :object< foo > ) { ... }
sub state_three : State( :package< bar > ) { ... }
# combined
sub state_multi : State( :inline< foobar > :package< snafoo > ) { ... }
...
# chained events
sub first : State( :object< foo > :chained< bar > ) { ... }
sub second : State( :object< bar > ) { ... }
...
# calling in a row
sub first : State( :object< foo > :next< bar > ) { ... }
sub second : State( :object< bar > ) { ... }
...
# usage
my $comp = POE::MyComponent->new ({
# single alias or array reference for multiple
aliases => [qw/ mycomp shub_niggurath /],
... # your specific init_args.
});
Provides Class::Std and base POE component functionality. This module is still kinda experimental.
Download (0.017MB)
Added: 2006-10-23 License: Perl Artistic License Price:
1096 downloads
PoJoe Component Libraries 1.1
PoJoe Component Libraries project is a set of Java POJO components, originally developed for OSMQ. more>>
PoJoe Component Libraries project is a set of Java POJO components, originally developed for OSMQ. Developers have found these components useful in building robust enterprise applications.
Of note are: a FIFO queue that utilizes memory until a size threshold is reached, paging overflow elements to a disk cache; a dynamic discovery mechanism for locating remote processes by name over an IP network, eliminating the need to identify a remote service with a specific host computer; and a set of peer-to-peer async message components that support n concurrent message publishers for each named subscriber.
Enhancements:
- Minor enhancements and bugfixes, and changing the license from GNU Lesser to Apache 2.0.
<<lessOf note are: a FIFO queue that utilizes memory until a size threshold is reached, paging overflow elements to a disk cache; a dynamic discovery mechanism for locating remote processes by name over an IP network, eliminating the need to identify a remote service with a specific host computer; and a set of peer-to-peer async message components that support n concurrent message publishers for each named subscriber.
Enhancements:
- Minor enhancements and bugfixes, and changing the license from GNU Lesser to Apache 2.0.
Download (0.87MB)
Added: 2007-06-12 License: The Apache License 2.0 Price:
521 downloads
POE::Component::Enc::Flac 1.01
POE::Component::Enc::Flac is a POE component to wrap FLAC encoder flac. more>>
POE::Component::Enc::Flac is a POE component to wrap FLAC encoder flac.
SYNOPSIS
use POE qw(Component::Enc::Flac);
$encoder1 = POE::Component::Enc::Flac->new();
$encoder1->enc(input => "/tmp/track03.wav");
$encoder2 = POE::Component::Enc::Flac->new(
parent => mainSession,
priority => 10,
compression => best,
status => flacStatus,
error => flacEerror,
warning => flacWarning,
done => flacDone,
);
$encoder2->enc(
input => "/tmp/track02.wav",
output => "/tmp/02.flac",
tracknumber => Track 2,
comment => [
title=Birdhouse in your Soul,
artist=They Might be Giants,
date=1990,
origin=CD,
]
);
POE::Kernel->run();
ABSTRACT
POE is a multitasking framework for Perl. FLAC stands for Free Lossless Audio Codec and flac is an encoder for this standard. This module wraps flac into the POE framework, simplifying its use in, for example, a CD music ripper and encoder application. It provides an object oriented interface.
<<lessSYNOPSIS
use POE qw(Component::Enc::Flac);
$encoder1 = POE::Component::Enc::Flac->new();
$encoder1->enc(input => "/tmp/track03.wav");
$encoder2 = POE::Component::Enc::Flac->new(
parent => mainSession,
priority => 10,
compression => best,
status => flacStatus,
error => flacEerror,
warning => flacWarning,
done => flacDone,
);
$encoder2->enc(
input => "/tmp/track02.wav",
output => "/tmp/02.flac",
tracknumber => Track 2,
comment => [
title=Birdhouse in your Soul,
artist=They Might be Giants,
date=1990,
origin=CD,
]
);
POE::Kernel->run();
ABSTRACT
POE is a multitasking framework for Perl. FLAC stands for Free Lossless Audio Codec and flac is an encoder for this standard. This module wraps flac into the POE framework, simplifying its use in, for example, a CD music ripper and encoder application. It provides an object oriented interface.
Download (0.72MB)
Added: 2006-06-22 License: Perl Artistic License Price:
1219 downloads
POE::Component::Proxy::TCP 1.2
POE::Component::Proxy::TCP is a simplified TCP proxy. more>>
POE::Component::Proxy::TCP is a simplified TCP proxy.
SYNOPSIS
use POE qw(Component::Proxy::TCP);
POE::Component::Proxy::TCP->new
(Alias => "ProxyServerSessionAlias",
Port => $local_server_port,
OrigPort => $remote_server_port,
OrigAddress => $remote_server_host,
DataFromClient => &data_from_client_handler,
DataFromServer => &data_from_server_handler,
);
# gets called with data passed from server.
# called inside the per client connected session created by PoCo::Server::TCP
sub data_from_server_handler {
my $server_data = shift;
# show obtaining other session info esp per proxy session info
};
# gets called with data passed from remote client
#
sub data_from_client_handler {
my $server_data = shift;
};
# show obtaining other session info esp per proxy session info
# Reserved HEAP variables:
$heap->{self} = Proxy object / instance var hash
$heap->{self}->losta stuff add documentation
[do the per connection ones]
EXAMPLE ^
use warnings;
use strict;
use diagnostics;
use POE;
use POE::Filter::Stream;
use POE::Filter::Line;
use POE::Component::Proxy::TCP;
$|++;
POE::Component::Proxy::TCP->new
(Alias => "ProxyServerSessionAlias",
Port => 4000,
OrigPort => 5000,
OrigAddress => "localhost",
DataFromClient => sub {print "From client:", shift(), "n";},
DataFromServer => sub {print "From server:", shift(), "n";},
RemoteClientFilter => "POE::Filter::Stream",
RemoteServerOutputFilter => "POE::Filter::Stream",
RemoteServerInputFilter => "POE::Filter::Stream"
);
$poe_kernel->run();
exit 0;
<<lessSYNOPSIS
use POE qw(Component::Proxy::TCP);
POE::Component::Proxy::TCP->new
(Alias => "ProxyServerSessionAlias",
Port => $local_server_port,
OrigPort => $remote_server_port,
OrigAddress => $remote_server_host,
DataFromClient => &data_from_client_handler,
DataFromServer => &data_from_server_handler,
);
# gets called with data passed from server.
# called inside the per client connected session created by PoCo::Server::TCP
sub data_from_server_handler {
my $server_data = shift;
# show obtaining other session info esp per proxy session info
};
# gets called with data passed from remote client
#
sub data_from_client_handler {
my $server_data = shift;
};
# show obtaining other session info esp per proxy session info
# Reserved HEAP variables:
$heap->{self} = Proxy object / instance var hash
$heap->{self}->losta stuff add documentation
[do the per connection ones]
EXAMPLE ^
use warnings;
use strict;
use diagnostics;
use POE;
use POE::Filter::Stream;
use POE::Filter::Line;
use POE::Component::Proxy::TCP;
$|++;
POE::Component::Proxy::TCP->new
(Alias => "ProxyServerSessionAlias",
Port => 4000,
OrigPort => 5000,
OrigAddress => "localhost",
DataFromClient => sub {print "From client:", shift(), "n";},
DataFromServer => sub {print "From server:", shift(), "n";},
RemoteClientFilter => "POE::Filter::Stream",
RemoteServerOutputFilter => "POE::Filter::Stream",
RemoteServerInputFilter => "POE::Filter::Stream"
);
$poe_kernel->run();
exit 0;
Download (0.017MB)
Added: 2007-04-10 License: Perl Artistic License Price:
930 downloads
POE::Component::Generic 0.0904
POE::Component::Generic is a POE component that provides non-blocking access to a blocking object. more>>
POE::Component::Generic is a POE component that provides non-blocking access to a blocking object.
SYNOPSIS
use POE::Component::Generic;
my $telnet = POE::Component::Generic->spawn(
# required; main object is of this class
package => Net::Telnet,
# optional; Options passed to Net::Telnet->new()
object_options => [ ],
# optional; You can use $poco->session_id() instead
alias => telnet,
# optional; 1 to turn on debugging
debug => 1,
# optional; 1 to see the childs STDERR
verbose => 1,
# optional; Options passed to the internal session
options => { trace => 1 },
# optional; describe package signatures
packages => {
Net::Telnet => {
# Methods that require coderefs, and keep them after they
# return.
# The first arg is converted to a coderef
postbacks => { option_callback=>0 }
},
Other::Package => {
# only these methods are exposed
methods => [ qw( one two ) ],
# Methods that require coderefs, but dont keep them
# after they return
callbacks => [ qw( two ) ]
}
}
);
# Start your POE session, then...
$telnet->open( { event => result }, "rainmaker.wunderground.com");
# result state
sub result {
my ($kernel, $ref, $result) = @_[KERNEL, ARG0, ARG1];
if( $ref->{error} ) {
die join( , @{ $ref->{error} ) . "n";
}
print "connected: $resultn";
}
# Setup a postback
$telnet->option_callback( {}, "option_back" );
# option_back state
sub option_back {
my( $obj, $option, $is_remote,
$is_enabled, $was_enabled, $buf_position) = @_[ARG0..$#_];
# See L for a discussion of the above.
# NOTE: Callbacks and postbacks cant currently receive objects.
}
# Use a callback
# Pretend that $other was created as a proxy to an Other::Package object
$other->two( {}, sub { warn "I was called..." } );
my $code = $session->postback( "my_state" );
$other->two( {}, $code );
POE::Component::Generic is a POE component that provides a non-blocking wrapper around any object. It works by forking a child process with POE::Wheel::Run and creating the object in the child process. Method calls are then serialised and sent via STDIN to the child to be handled. Return values are posted back to your session via STDOUT. This means that all method arguments and return values must survive serialisation. If you need to pass coderefs, use "callbacks", "postbacks" or "factories".
Method calls are wrapped in eval in the child process so that errors may be propagated back to your session. See "OUTPUT".
Output to STDERR in the child, that is from your object, is shown only if debug or verbose is set.
STDOUT in the child, that is from your object, is redirected to STDERR and will be shown in the same circomstances.
<<lessSYNOPSIS
use POE::Component::Generic;
my $telnet = POE::Component::Generic->spawn(
# required; main object is of this class
package => Net::Telnet,
# optional; Options passed to Net::Telnet->new()
object_options => [ ],
# optional; You can use $poco->session_id() instead
alias => telnet,
# optional; 1 to turn on debugging
debug => 1,
# optional; 1 to see the childs STDERR
verbose => 1,
# optional; Options passed to the internal session
options => { trace => 1 },
# optional; describe package signatures
packages => {
Net::Telnet => {
# Methods that require coderefs, and keep them after they
# return.
# The first arg is converted to a coderef
postbacks => { option_callback=>0 }
},
Other::Package => {
# only these methods are exposed
methods => [ qw( one two ) ],
# Methods that require coderefs, but dont keep them
# after they return
callbacks => [ qw( two ) ]
}
}
);
# Start your POE session, then...
$telnet->open( { event => result }, "rainmaker.wunderground.com");
# result state
sub result {
my ($kernel, $ref, $result) = @_[KERNEL, ARG0, ARG1];
if( $ref->{error} ) {
die join( , @{ $ref->{error} ) . "n";
}
print "connected: $resultn";
}
# Setup a postback
$telnet->option_callback( {}, "option_back" );
# option_back state
sub option_back {
my( $obj, $option, $is_remote,
$is_enabled, $was_enabled, $buf_position) = @_[ARG0..$#_];
# See L for a discussion of the above.
# NOTE: Callbacks and postbacks cant currently receive objects.
}
# Use a callback
# Pretend that $other was created as a proxy to an Other::Package object
$other->two( {}, sub { warn "I was called..." } );
my $code = $session->postback( "my_state" );
$other->two( {}, $code );
POE::Component::Generic is a POE component that provides a non-blocking wrapper around any object. It works by forking a child process with POE::Wheel::Run and creating the object in the child process. Method calls are then serialised and sent via STDIN to the child to be handled. Return values are posted back to your session via STDOUT. This means that all method arguments and return values must survive serialisation. If you need to pass coderefs, use "callbacks", "postbacks" or "factories".
Method calls are wrapped in eval in the child process so that errors may be propagated back to your session. See "OUTPUT".
Output to STDERR in the child, that is from your object, is shown only if debug or verbose is set.
STDOUT in the child, that is from your object, is redirected to STDERR and will be shown in the same circomstances.
Download (0.030MB)
Added: 2006-06-12 License: Perl Artistic License Price:
1229 downloads
POE::Component::Proxy::MSN 0.02
POE::Component::Proxy::MSN is a POE Component that is an MSN Messenger proxy. more>>
POE::Component::Proxy::MSN is a POE Component that is an MSN Messenger proxy.
SYNOPSIS
use POE qw(Component::Proxy::MSN);
# spawn MSN session
POE::Component::Proxy::MSN->spawn(
alias => msnproxy, # Optional, default
ip => any, # Optional, ip to bind to or any (default)
port => 1863, # Optional, default
msn_server => 207.46.106.79, # Server to connect to, not optional
msn_port => 1863, # Just leave this at 1863, not optional
);
# register your session as MSN proxy observer in _start of a new session
POE::Session->create(
inline_states => {
_start => sub {
$_[KERNEL]->post(msnproxy => register);
}
msn_logged_in => sub {
my ($kernel, $cmd) = @_[KERNEL, ARG0];
# tell them they are on the proxy, this is called when they log in
if ($cmd->{data} =~ m/(S+@S+)/) {
$kernel->post(msnproxy => toast => {
text => "MSN Proxy Active",
site_url => http://teknikill.net/?MSNProxy,
action_url => /,
options_url => /,
# not speciying email will toast all users
email => $1, # email targets a specific user that is logged in
});
}
},
}
);
$poe_kernel->run;
POE::Component::Proxy::MSN is a POE component that proxys the MSN Messenger service and allows you to send your own notifications (toasts).
<<lessSYNOPSIS
use POE qw(Component::Proxy::MSN);
# spawn MSN session
POE::Component::Proxy::MSN->spawn(
alias => msnproxy, # Optional, default
ip => any, # Optional, ip to bind to or any (default)
port => 1863, # Optional, default
msn_server => 207.46.106.79, # Server to connect to, not optional
msn_port => 1863, # Just leave this at 1863, not optional
);
# register your session as MSN proxy observer in _start of a new session
POE::Session->create(
inline_states => {
_start => sub {
$_[KERNEL]->post(msnproxy => register);
}
msn_logged_in => sub {
my ($kernel, $cmd) = @_[KERNEL, ARG0];
# tell them they are on the proxy, this is called when they log in
if ($cmd->{data} =~ m/(S+@S+)/) {
$kernel->post(msnproxy => toast => {
text => "MSN Proxy Active",
site_url => http://teknikill.net/?MSNProxy,
action_url => /,
options_url => /,
# not speciying email will toast all users
email => $1, # email targets a specific user that is logged in
});
}
},
}
);
$poe_kernel->run;
POE::Component::Proxy::MSN is a POE component that proxys the MSN Messenger service and allows you to send your own notifications (toasts).
Download (0.010MB)
Added: 2007-03-07 License: Perl Artistic License Price:
967 downloads
POE::Component::ControlPort 0.01
POE::Component::ControlPort is a Perl module with network control port for POE applications. more>>
POE::Component::ControlPort is a Perl module with network control port for POE applications.
SYNOPSIS
use POE;
use Getopt::Long;
use POE::Component::ControlPort;
use POE::Component::ControlPort::Command;
my @commands = (
{
help_text => My command,
usage => my_command [ arg1, arg2 ],
topic => custom,
name => my_command,
command => sub {
my %input = @_;
local @ARGV = @{ $input{args} };
GetOptions( ... );
},
}
);
POE::Component::ControlPort->create(
local_address => 127.0.0.1,
local_port => 31337,
# optional...
hostname => pie.pants.org,
appname => my perl app,
commands => @commands,
poe_debug => 1,
);
# other poe sessions or whatever ...
POE::Kernel->run();
When building network applications, it is often helpful to have a network accessible control and diagnostic interface. This module provides such an interface for POE applications. By default, it provides a fairly limited set of commands but is easily extended to provide whatever command set you require. In addition, if POE::Component::DebugShell version 1.018 or above is installed, a set of POE debug commands will be loaded.
<<lessSYNOPSIS
use POE;
use Getopt::Long;
use POE::Component::ControlPort;
use POE::Component::ControlPort::Command;
my @commands = (
{
help_text => My command,
usage => my_command [ arg1, arg2 ],
topic => custom,
name => my_command,
command => sub {
my %input = @_;
local @ARGV = @{ $input{args} };
GetOptions( ... );
},
}
);
POE::Component::ControlPort->create(
local_address => 127.0.0.1,
local_port => 31337,
# optional...
hostname => pie.pants.org,
appname => my perl app,
commands => @commands,
poe_debug => 1,
);
# other poe sessions or whatever ...
POE::Kernel->run();
When building network applications, it is often helpful to have a network accessible control and diagnostic interface. This module provides such an interface for POE applications. By default, it provides a fairly limited set of commands but is easily extended to provide whatever command set you require. In addition, if POE::Component::DebugShell version 1.018 or above is installed, a set of POE debug commands will be loaded.
Download (0.012MB)
Added: 2007-02-13 License: Perl Artistic License Price:
983 downloads
POE::Component::SubWrapper 0.08
POE::Component::SubWrapper is an event based wrapper for subs. more>>
POE::Component::SubWrapper is an event based wrapper for subs.
SYNOPSIS
use POE::Component::SubWrapper;
POE::Component::SubWrapper->spawn(main);
$kernel->post(main, my_sub, [ $arg1, $arg2, $arg3 ], callback_state);
This is a module which provides an event based wrapper for subroutines.
SubWrapper components are not normal objects, but are instead spawned as separate sessions. This is done with with PoCo::SubWrappers spawn method, which takes one required and one optional argument. The first argument is the package name to wrap. This is required. The second argument is optional and contains an alias to give to the session created. If no alias is supplied, the package name is used as an alias.
Another way to create SubWrapper components is to use the poeize method, which is included in the default export list of the package. You can simply do:
poeize Data::Dumper;
and Data::Dumper will be wrapped into a session with the alias Data::Dumper.
When a SubWrapper component is created, it scans the package named for subroutines, and creates one state in the session created with the same name of the subroutine.
The states each accept 3 arguments:
- An arrayref to a list of arguments to give the subroutine.
- A state to callback with the results.
- A string, either SCALAR, or ARRAY, allowing you to decide which context the function handled by this state will be called in.
The states all call the function with the name matching the state, and give it the supplied arguments. They then postback the results to the named callback state. The results are contained in ARG0 and are either a scalar if the function was called in scalar context, or an arrayref of results if the function was called in list context.
<<lessSYNOPSIS
use POE::Component::SubWrapper;
POE::Component::SubWrapper->spawn(main);
$kernel->post(main, my_sub, [ $arg1, $arg2, $arg3 ], callback_state);
This is a module which provides an event based wrapper for subroutines.
SubWrapper components are not normal objects, but are instead spawned as separate sessions. This is done with with PoCo::SubWrappers spawn method, which takes one required and one optional argument. The first argument is the package name to wrap. This is required. The second argument is optional and contains an alias to give to the session created. If no alias is supplied, the package name is used as an alias.
Another way to create SubWrapper components is to use the poeize method, which is included in the default export list of the package. You can simply do:
poeize Data::Dumper;
and Data::Dumper will be wrapped into a session with the alias Data::Dumper.
When a SubWrapper component is created, it scans the package named for subroutines, and creates one state in the session created with the same name of the subroutine.
The states each accept 3 arguments:
- An arrayref to a list of arguments to give the subroutine.
- A state to callback with the results.
- A string, either SCALAR, or ARRAY, allowing you to decide which context the function handled by this state will be called in.
The states all call the function with the name matching the state, and give it the supplied arguments. They then postback the results to the named callback state. The results are contained in ARG0 and are either a scalar if the function was called in scalar context, or an arrayref of results if the function was called in list context.
Download (0.005MB)
Added: 2007-08-16 License: Perl Artistic License Price:
799 downloads
POE::Component::Client::FTP 0.07
POE::Component::Client::FTP is a Perl module that implements an FTP client POE Component. more>>
POE::Component::Client::FTP is a Perl module that implements an FTP client POE Component.
SYNOPSIS
use POE::Component::Client::FTP;
POE::Component::Client::FTP->spawn ( Alias => ftp, Username => test, Password => test, RemoteAddr => localhost, Events => [ qw( authenticated put_connected put_error put_closed get_connected get_data get_done size ) ] );
# we are authenticated sub authenticated { $poe_kernel->post(ftp, command, args); }
# data connection is ready for data sub put_connected { my ($status, $line, $param) = @_[ARG0..ARG3];
open FILE, "/etc/passwd" or die $!;
$poe_kernel->post(ftp, put_data, $_) while ( );
close FILE;
$poe_kernel->post(ftp, put_close);
}
# something bad happened sub put_error { my ($error, $param) = @_[ARG0,ARG1];
warn "ERROR: $error occured while trying to STOR $param";
}
# data connection closed sub put_closed { my ($param) = @_[ARG0]; }
# file on the way... sub get_connected { my ($filename) = @_[ARG0]; }
# getting data from the file... sub get_data { my ($data, $filename) = @_[ARG0,ARG1];
}
# and its done sub get_done { my ($filename) = @_[ARG0]; }
# response to a size command sub size { my ($code, $size, $filename) = @_[ARG0,ARG1,ARG2];
print "$filename was $size";
}
$poe_kernel->run();
<<lessSYNOPSIS
use POE::Component::Client::FTP;
POE::Component::Client::FTP->spawn ( Alias => ftp, Username => test, Password => test, RemoteAddr => localhost, Events => [ qw( authenticated put_connected put_error put_closed get_connected get_data get_done size ) ] );
# we are authenticated sub authenticated { $poe_kernel->post(ftp, command, args); }
# data connection is ready for data sub put_connected { my ($status, $line, $param) = @_[ARG0..ARG3];
open FILE, "/etc/passwd" or die $!;
$poe_kernel->post(ftp, put_data, $_) while ( );
close FILE;
$poe_kernel->post(ftp, put_close);
}
# something bad happened sub put_error { my ($error, $param) = @_[ARG0,ARG1];
warn "ERROR: $error occured while trying to STOR $param";
}
# data connection closed sub put_closed { my ($param) = @_[ARG0]; }
# file on the way... sub get_connected { my ($filename) = @_[ARG0]; }
# getting data from the file... sub get_data { my ($data, $filename) = @_[ARG0,ARG1];
}
# and its done sub get_done { my ($filename) = @_[ARG0]; }
# response to a size command sub size { my ($code, $size, $filename) = @_[ARG0,ARG1,ARG2];
print "$filename was $size";
}
$poe_kernel->run();
Download (0.013MB)
Added: 2007-04-17 License: Perl Artistic License Price:
920 downloads
POE::Component::Client::Halo 0.2
POE::Component::Client::Halo is an implementation of the Halo query protocol. more>>
POE::Component::Client::Halo is an implementation of the Halo query protocol.
SYNOPSIS
use Data::Dumper; # for the sample below
use POE qw(Component::Client::Halo);
my $halo = new POE::Component::Client::Halo(
Alias => halo,
Timeout => 15,
Retry => 2,
);
$kernel->post(halo, info, 127.0.0.1, 2302, pbhandler, ident);
$kernel->post(halo, detail, 127.0.0.1, 2302, pbhandler, ident);
sub postback_handler {
my ($ip, $port, $command, $identifier, $response) = @_;
print "Halo query $command_executed on ";
print " at $ip:$port";
print " had a identifier of $identifier" if defined $identifier;
print " returned from the server with:";
print Dumper($response), "nn";
}
POE::Component::Client::Halo is an implementation of the Halo query protocol. It was reverse engineered with a sniffer and two cups of coffee. This is a preliminary release, based version 1.00.01.0580 of the dedicated server (the first public release). It is capable of handling multiple requests of different types in parallel.
<<lessSYNOPSIS
use Data::Dumper; # for the sample below
use POE qw(Component::Client::Halo);
my $halo = new POE::Component::Client::Halo(
Alias => halo,
Timeout => 15,
Retry => 2,
);
$kernel->post(halo, info, 127.0.0.1, 2302, pbhandler, ident);
$kernel->post(halo, detail, 127.0.0.1, 2302, pbhandler, ident);
sub postback_handler {
my ($ip, $port, $command, $identifier, $response) = @_;
print "Halo query $command_executed on ";
print " at $ip:$port";
print " had a identifier of $identifier" if defined $identifier;
print " returned from the server with:";
print Dumper($response), "nn";
}
POE::Component::Client::Halo is an implementation of the Halo query protocol. It was reverse engineered with a sniffer and two cups of coffee. This is a preliminary release, based version 1.00.01.0580 of the dedicated server (the first public release). It is capable of handling multiple requests of different types in parallel.
Download (0.007MB)
Added: 2007-01-03 License: Perl Artistic License Price:
1032 downloads
POE::Component::Amazon::S3 0.01
POE::Component::Amazon::S3 is a Perl module to work with Amazon S3 using POE. more>>
POE::Component::Amazon::S3 is a Perl module to work with Amazon S3 using POE.
SYNOPSIS
use POE qw(Component::Amazon::S3);
POE::Component::Amazon::S3->spawn(
alias => s3,
aws_access_key_id => your S3 id,
aws_secret_access_key => your S3 key,
);
### Methods for working with buckets
# List buckets, posts back to buckets_done with the result
$kernel->post(
s3 => buckets, buckets_done,
);
# Add a bucket
$kernel->post(
s3 => add_bucket, add_bucket_done,
{
bucket => my-bucket,
}
);
# Delete a bucket, must be empty of all keys
$kernel->post(
s3 => delete_bucket, delete_bucket_done,
{
bucket => my-bucket,
}
);
# Set access control on a bucket, see below for more info about ACL
$kernel->post(
s3 => set_acl, set_acl_done,
{
bucket => my-bucket,
acl_short => public-read,
}
);
# Get the access control list for a bucket
$kernel->post(
s3 => get_acl, get_acl_done,
{
bucket => my-bucket,
}
);
### Methods for working with keys
# Add a key with inline data
$kernel->post(
s3 => add_key, add_key_done,
{
bucket => my-bucket,
key => my-inline-key,
data => testing 123,
}
);
# Add a key with data from a file
$kernel->post(
s3 => add_key, add_key_done,
{
bucket => my-bucket,
key => my-file-key,
file => /path/to/large_file,
}
);
# List some keys, used for pagination
$kernel->post(
s3 => list_bucket, list_bucket_done,
{
bucket => my-bucket,
max-keys => 10,
},
);
# List all keys, may make multiple calls internally to list_bucket
$kernel->post(
s3 => list_bucket_all, list_bucket_all_done,
{
bucket => my-bucket,
},
);
# Get a key, saving the contents in memory
$kernel->post(
s3 => get_key, get_key_done,
{
bucket => my-bucket
key => my-inline-key,
},
);
# Get a key, saving directly to a file
$kernel->post(
s3 => get_key, get_key_done,
{
bucket => my-bucket
key => my-file-key,
file => /tmp/my-file-key,
},
);
# Get only the headers for a key
$kernel->post(
s3 => head_key, head_key_done,
{
bucket => my-bucket,
key => my-inline-key,
},
);
# Delete a key
$kernel->post(
s3 => delete_key, delete_key_done,
{
bucket => my-bucket,
key => my-inline-key,
},
);
# Set access control on a key, see below for more info about ACL
$kernel->post(
s3 => set_acl, set_acl_done,
{
bucket => my-bucket,
key => my-inline-key,
acl_short => public-read,
}
);
# Get the access control list for a key
$kernel->post(
s3 => get_acl, get_acl_done,
{
bucket => my-bucket,
key => my-inline-key,
}
);
### Return values
# All methods post back to the given state with the same parameters,
# return and response. Example:
sub add_bucket_done {
my ( $kernel, $return, $response ) = @_[ KERNEL, ARG0, ARG1 ];
# $return contains only the results of the call
# $response contains the full HTTP::Response object from the call
# See individual method documentation below for details on $return
}
<<lessSYNOPSIS
use POE qw(Component::Amazon::S3);
POE::Component::Amazon::S3->spawn(
alias => s3,
aws_access_key_id => your S3 id,
aws_secret_access_key => your S3 key,
);
### Methods for working with buckets
# List buckets, posts back to buckets_done with the result
$kernel->post(
s3 => buckets, buckets_done,
);
# Add a bucket
$kernel->post(
s3 => add_bucket, add_bucket_done,
{
bucket => my-bucket,
}
);
# Delete a bucket, must be empty of all keys
$kernel->post(
s3 => delete_bucket, delete_bucket_done,
{
bucket => my-bucket,
}
);
# Set access control on a bucket, see below for more info about ACL
$kernel->post(
s3 => set_acl, set_acl_done,
{
bucket => my-bucket,
acl_short => public-read,
}
);
# Get the access control list for a bucket
$kernel->post(
s3 => get_acl, get_acl_done,
{
bucket => my-bucket,
}
);
### Methods for working with keys
# Add a key with inline data
$kernel->post(
s3 => add_key, add_key_done,
{
bucket => my-bucket,
key => my-inline-key,
data => testing 123,
}
);
# Add a key with data from a file
$kernel->post(
s3 => add_key, add_key_done,
{
bucket => my-bucket,
key => my-file-key,
file => /path/to/large_file,
}
);
# List some keys, used for pagination
$kernel->post(
s3 => list_bucket, list_bucket_done,
{
bucket => my-bucket,
max-keys => 10,
},
);
# List all keys, may make multiple calls internally to list_bucket
$kernel->post(
s3 => list_bucket_all, list_bucket_all_done,
{
bucket => my-bucket,
},
);
# Get a key, saving the contents in memory
$kernel->post(
s3 => get_key, get_key_done,
{
bucket => my-bucket
key => my-inline-key,
},
);
# Get a key, saving directly to a file
$kernel->post(
s3 => get_key, get_key_done,
{
bucket => my-bucket
key => my-file-key,
file => /tmp/my-file-key,
},
);
# Get only the headers for a key
$kernel->post(
s3 => head_key, head_key_done,
{
bucket => my-bucket,
key => my-inline-key,
},
);
# Delete a key
$kernel->post(
s3 => delete_key, delete_key_done,
{
bucket => my-bucket,
key => my-inline-key,
},
);
# Set access control on a key, see below for more info about ACL
$kernel->post(
s3 => set_acl, set_acl_done,
{
bucket => my-bucket,
key => my-inline-key,
acl_short => public-read,
}
);
# Get the access control list for a key
$kernel->post(
s3 => get_acl, get_acl_done,
{
bucket => my-bucket,
key => my-inline-key,
}
);
### Return values
# All methods post back to the given state with the same parameters,
# return and response. Example:
sub add_bucket_done {
my ( $kernel, $return, $response ) = @_[ KERNEL, ARG0, ARG1 ];
# $return contains only the results of the call
# $response contains the full HTTP::Response object from the call
# See individual method documentation below for details on $return
}
Download (0.020MB)
Added: 2007-02-23 License: Perl Artistic License Price:
973 downloads
Secleted [ 0 ] software to compare
Copyright Notice:
Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future software development. The above poe component search only lists software in full, demo and trial versions for free download. Download links are directly from our mirror sites or publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed