1POE::Component::IRC::PlUusgeirn:C:oCnotnrniebcuttoerdP(O3PE)e:r:lCoDmopcounmeenntt:a:tIiRoCn::Plugin::Connector(3)
2
3
4

NAME

6       POE::Component::IRC::Plugin::Connector - A PoCo-IRC plugin that deals
7       with the messy business of staying connected to an IRC server
8

SYNOPSIS

10        use POE qw(Component::IRC Component::IRC::Plugin::Connector);
11
12        my $irc = POE::Component::IRC->spawn();
13
14        POE::Session->create(
15            package_states => [
16                main => [ qw(_start lag_o_meter) ],
17            ],
18        );
19
20        $poe_kernel->run();
21
22        sub _start {
23            my ($kernel, $heap) = @_[KERNEL ,HEAP];
24            $irc->yield( register => 'all' );
25
26            $heap->{connector} = POE::Component::IRC::Plugin::Connector->new();
27
28            $irc->plugin_add( 'Connector' => $heap->{connector} );
29
30            $irc->yield ( connect => { Nick => 'testbot', Server => 'someserver.com' } );
31
32            $kernel->delay( 'lag_o_meter' => 60 );
33            return;
34        }
35
36        sub lag_o_meter {
37            my ($kernel,$heap) = @_[KERNEL,HEAP];
38            print 'Time: ' . time() . ' Lag: ' . $heap->{connector}->lag() . "\n";
39            $kernel->delay( 'lag_o_meter' => 60 );
40            return;
41        }
42

DESCRIPTION

44       POE::Component::IRC::Plugin::Connector is a POE::Component::IRC plugin
45       that deals with making sure that your IRC bot stays connected to the
46       IRC network of your choice. It implements the general algorithm as
47       demonstrated at
48       <http://poe.perl.org/?POE_Cookbook/IRC_Bot_Reconnecting>.
49

METHODS

51   "new"
52       Takes two optional arguments:
53
54       'delay', the frequency, in seconds, at which the plugin will ping the
55       IRC server. Defaults to 300.
56
57       'reconnect', the time in seconds, to wait before trying to reconnect to
58       the server. Defaults to 60.
59
60       'servers', an array reference of IRC servers to consider. Each element
61       should be an array reference containing a server host and (optionally)
62       a port number.  The plugin will cycle through this list of servers
63       whenever it reconnects.
64
65       Returns a plugin object suitable for use in POE::Component::IRC's
66       "plugin_add" method.
67
68   "lag"
69       Returns the current 'lag' in seconds between sending PINGs to the IRC
70       server and getting PONG responses. Probably not likely to be wholely
71       accurate.
72

AUTHOR

74       Chris "BinGOs" Williams <chris@bingosnet.co.uk>
75

SEE ALSO

77       POE::Component::IRC
78
79       POE::Component::IRC::Plugin
80
81
82
83perl v5.12.2                      2010P-O1E1:-:0C5omponent::IRC::Plugin::Connector(3)
Impressum