1POE::Component::IRC::PlUusgeirn:C:oPnlturgiMbaunt(e3d)PPeOrEl::DCoocmupmoennetnatt:i:oInRC::Plugin::PlugMan(3)
2
3
4
6 use strict;
7 use warnings;
8 use POE qw(Component::IRC::State);
9 use POE::Component::IRC::Plugin::PlugMan;
10
11 my $botowner = 'somebody!*@somehost.com';
12 my $irc = POE::Component::IRC::State->spawn();
13
14 POE::Session->create(
15 package_states => [
16 'main' => [ qw(_start irc_plugin_add) ],
17 ],
18 );
19
20 sub _start {
21 $irc->yield( register => 'all' );
22 $irc->plugin_add( 'PlugMan' => POE::Component::IRC::Plugin::PlugMan->new( botowner => $botowner ) );
23 undef;
24 }
25
26 sub irc_plugin_add {
27 my ( $desc, $plugin ) = @_[ARG0,ARG1];
28
29 if ( $desc eq 'PlugMan' ) {
30 $plugin->load( 'Connector', 'POE::Component::IRC::Plugin::Connector' );
31 }
32 undef;
33 }
34
36 POE::Component::IRC::Plugin::PlugMan is a POE::Component::IRC plugin
37 management plugin. It provides support for 'on-the-fly' loading,
38 reloading and unloading of plugin modules, via object methods that you
39 can incorporate into your own code and a handy IRC interface.
40
42 new Takes two optional arguments:
43
44 "botowner", an IRC mask to match against for people issuing commands via the IRC interface;
45 "debug", set to a true value to see when stuff goes wrong;
46
47 Not setting a "botowner" effectively disables the IRC interface.
48
49 If "botowner" is specified the plugin checks that it is being
50 loaded into a POE::Component::IRC::State or sub-class and will fail
51 to load otherwise.
52
53 Returns a plugin object suitable for feeding to POE::Compo‐
54 nent::IRC's plugin_add() method.
55
57 load
58 Loads a managed plugin.
59
60 Takes two mandatory arguments, a plugin descriptor and a plugin
61 package name. Any other arguments are used as options to the loaded
62 plugin constructor.
63
64 $plugin->load( 'Connector', 'POE::Component::IRC::Plugin::Connector', delay, 120 );
65
66 Returns true or false depending on whether the load was success‐
67 fully or not.
68
69 You may check $@ for error messages.
70
71 unload
72 Unloads a managed plugin.
73
74 Takes one mandatory argument, a plugin descriptor.
75
76 $plugin->unload( 'Connector' );
77
78 Returns true or false depending on whether the unload was success‐
79 fully or not.
80
81 reload
82 Unloads and loads a managed plugin, with applicable plugin options.
83
84 Takes one mandatory argument, a plugin descriptor.
85
86 $plugin->reload( 'Connector' );
87
88 You may check $@ for error messages.
89
90 loaded
91 Takes no arguments.
92
93 $plugin->loaded();
94
95 Returns a list of descriptors of managed plugins.
96
98 The IRC interface is enabled by specifying a "botowner" mask to new().
99 Commands may be either invoked via a PRIVMSG directly to your bot or in
100 a channel by prefixing the command with the nickname of your bot. One
101 caveat, the parsing of the irc command is very rudimentary ( it merely
102 splits the line on \s+ ).
103
104 plugin_add
105 Takes the same arguments as load().
106
107 plugin_del
108 Takes the same arguments as unload().
109
110 plugin_reload
111 Takes the same arguments as reload().
112
113 plugin_loaded
114 Returns a list of descriptors of managed plugins.
115
116 plugin_list
117 Returns a list of descriptors of *all* plugins loaded into the cur‐
118 rent PoCo-IRC component.
119
121 Chris 'BinGOs' Williams
122
124 POE::Component::IRC::State
125
126 POE::Component::IRC::Plugin
127
128
129
130perl v5.8.8 2005-1P0O-E2:5:Component::IRC::Plugin::PlugMan(3)