|
NAMEPOE::Component::Client::Telnet - A POE component that provides non-blocking access to Net::Telnet and other subclasses of Net::Telnet. SYNOPSIS use POE::Component::Client::Telnet;
my $poco = POE::Component::Client::Telnet->new(
alias => 'telnet', # optional; You can use $poco->session_id() instead
debug => 1, # optional; 1 to turn on debugging
options => { trace => 1 }, # optional; Options passed to the internal session
package => 'Net::Telnet::Cisco', # optional; Allows use of other Net::Telnet
telnet_options => [ ], # optional; Options passed to Net::Telnet->new()
);
# Start your POE session, then...
$kernel->post('telnet' => open => { event => 'result' },"rainmaker.wunderground.com");
sub result {
my ($kernel,$ref) = @_[KERNEL,ARG0];
if ( $ref->{result} ) {
print "connected: $ref->{result}\n";
} else {
print STDERR join(' ', @{ $ref->{error} ) . "\n";
}
}
DESCRIPTIONPOE::Component::Client::Telnet is a POE component that provides a non-blocking wrapper around Net::Telnet, or any other module based on Net::Telnet. Consult the Net::Telnet documentation for more details. METHODS
INPUTThese are the events that the component will accept. Each event requires a hashref as an argument with the following keys: 'event', the name of the event handler in *your* session that you want the result of the requested operation to go to. 'event' is needed for all requests that you want a response to. It is possible to pass arbitary data in the request hashref that could be used in the resultant event handler. Simply define additional key/value pairs of your own. It is recommended that one prefixes keys with '_' to avoid future clashes. OUTPUTFor each requested operation an event handler is required. ARG0 of this event handler contains a hashref. The hashref will contain keys for 'state', and 'result'. 'state' is the operation that was requested, 'result' is what the function returned. AUTHORDavid Davis <xantus@cpan.org> SEE ALSOPOE, Net::Telnet, Net::Telnet::Cisco, Net::Telnet::Netscreen, Net::Telnet::Options RATINGPlease rate this module. <http://cpanratings.perl.org/rate/?distribution=POE-Component-Client-Telnet> BUGSProbably. Report them here: <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=POE%3A%3AComponent%3A%3AClient%3A%3ATelnet> CREDITSBinGOs for POE::Component::Win32::Service that helped me get started. COPYRIGHT AND LICENSECopyright 2005 by David Davis and Teknikill Software This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|