1POE::Component::IRC::PlUusgeirn:C:oCnotnrsiobluet(e3d)PPeOrEl::DCoocmupmoennetnatt:i:oInRC::Plugin::Console(3)
2
3
4
6 POE::Component::IRC::Plugin::Console - a lightweight debugging and con‐
7 trol console for POE::Component::IRC bots.
8
10 use POE qw(Component::IRC Component::IRC::Plugin::Console);
11
12 my ($nickname) = 'Flibble' . $$;
13 my ($ircname) = 'Flibble the Sailor Bot';
14 my ($ircserver) = 'irc.blahblahblah.irc';
15 my ($port) = 6667;
16 my ($bindport) = 6969;
17
18 my (@channels) = ( '#Blah', '#Foo', '#Bar' );
19
20 my ($irc) = POE::Component::IRC->spawn(
21 nick => $nickname,
22 server => $ircserver,
23 port => $port,
24 ircname => $ircname,
25 ) or die "Oh noooo! $!";
26
27 POE::Session->create(
28 package_states => [
29 'main' => [ qw(_start irc_001 irc_console_service irc_console_connect
30 irc_console_authed irc_console_close irc_console_rw_fail) ],
31 ],
32 );
33
34 $poe_kernel->run();
35 exit 0;
36
37 sub _start {
38 $irc->plugin_add( 'Console' => POE::Component::IRC::Plugin::Console->new(
39 bindport => $bindport, password => "opensesame" );
40 $irc->yield( register => 'all' );
41 $irc->yield( connect => { } );
42 undef;
43 }
44
45 sub irc_001 {
46 $irc->yield( join => $_ ) for @channels;
47 undef;
48 }
49
50 sub irc_console_service {
51 my ($getsockname) = $_[ARG0];
52 undef;
53 }
54
55 sub irc_console_connect {
56 my ($peeradr,$peerport,$wheel_id) = @_[ARG0,ARG1,ARG2];
57 undef;
58 }
59
60 sub irc_console_authed {
61 my ($wheel_id) = $_[ARG0];
62 undef;
63 }
64
65 sub irc_console_close {
66 my ($wheel_id) = $_[ARG0];
67 undef;
68 }
69
70 sub irc_console_rw_fail {
71 my ($peeradr,$peerport) = @_[ARG0,ARG1];
72 undef;
73 }
74
76 POE::Component::IRC::Plugin::Console is a POE::Component::IRC plugin
77 that provides an interactive console running over the loopback network.
78 One connects to the listening socket using a telnet client ( or equiva‐
79 lent ), authenticate using the applicable password. Once authed one
80 will receive all events that are processed through the component. One
81 may also issue all the documented component commands.
82
84 new Takes two arguments:
85
86 'password', the password to set for *all* console connections;
87 'bindport', specify a particular port to bind to, defaults to 0, ie. randomly allocated;
88
90 getsockname
91 Gives access to the underlying listener's getsockname() method. See
92 POE::Wheel::SocketFactory for details.
93
95 The plugin generates the following additional POE::Component::IRC
96 events:
97
98 irc_console_service
99 Emitted when a listener is successfully spawned. ARG0 is the result
100 of getsockname(), see above for details.
101
102 irc_console_connect
103 Emitted when a client connects to the console. ARG0 is the peeradr,
104 ARG1 is the peer port and ARG2 is the wheel id of the connection.
105
106 irc_console_authed
107 Emitted when a client has successfully provided a valid password.
108 ARG0 is the wheel id of the connection.
109
110 irc_console_close
111 Emitted when a client terminates a connection. ARG0 is the wheel id
112 of the connection.
113
114 irc_console_rw_fail
115 Emitted when a wheel::rw could not be created on a socket. ARG0 is
116 the peeradr, ARG1 is the peer port.
117
119 Chris 'BinGOs' Williams
120
122 POE::Component::IRC, POE::Wheel::SocketFactory.
123
124
125
126perl v5.8.8 2005-1P0O-E2:5:Component::IRC::Plugin::Console(3)