DOKK / manpages / debian 11 / libpoe-component-irc-perl / POE::Component::IRC::Plugin::PlugMan.3pm.en
POE::Component::IRC::Plugin::PlugMan(3pm) User Contributed Perl Documentation POE::Component::IRC::Plugin::PlugMan(3pm)

POE::Component::IRC::Plugin::PlugMan - A PoCo-IRC plugin that provides plugin management services.

 use strict;
 use warnings;
 use POE qw(Component::IRC::State);
 use POE::Component::IRC::Plugin::PlugMan;
 my $botowner = 'somebody!*@somehost.com';
 my $irc = POE::Component::IRC::State->spawn();
 POE::Session->create(
     package_states => [
         main => [ qw(_start irc_plugin_add) ],
     ],
 );
 sub _start {
     $irc->yield( register => 'all' );
     $irc->plugin_add( 'PlugMan' => POE::Component::IRC::Plugin::PlugMan->new( botowner => $botowner ) );
     return;
 }
 sub irc_plugin_add {
     my ($desc, $plugin) = @_[ARG0, ARG1];
     if ($desc eq 'PlugMan') {
         $plugin->load( 'Connector', 'POE::Component::IRC::Plugin::Connector' );
     }
     return;
 }

POE::Component::IRC::Plugin::PlugMan is a POE::Component::IRC plugin management plugin. It provides support for 'on-the-fly' loading, reloading and unloading of plugin modules, via object methods that you can incorporate into your own code and a handy IRC interface.

Takes two optional arguments:

'botowner', an IRC mask to match against for people issuing commands via the IRC interface;

'auth_sub', a sub reference which will be called to determine if a user may issue commands via the IRC interface. Overrides 'botowner'. It will be called with three arguments: the IRC component object, the nick!user@host and the channel name as arguments. It should return a true value if the user is authorized, a false one otherwise.

'debug', set to a true value to see when stuff goes wrong;

Not setting 'botowner' or 'auth_sub' effectively disables the IRC interface.

If 'botowner' is specified the plugin checks that it is being loaded into a POE::Component::IRC::State or sub-class and will fail to load otherwise.

Returns a plugin object suitable for feeding to POE::Component::IRC's "plugin_add" method.

Loads a managed plugin.

Takes two mandatory arguments, a plugin descriptor and a plugin package name. Any other arguments are used as options to the loaded plugin constructor.

 $plugin->load( 'Connector', 'POE::Component::IRC::Plugin::Connector', delay, 120 );

Returns true or false depending on whether the load was successfully or not.

Unloads a managed plugin.

Takes one mandatory argument, a plugin descriptor.

 $plugin->unload( 'Connector' );

Returns true or false depending on whether the unload was successfully or not.

Unloads and loads a managed plugin, with applicable plugin options.

Takes one mandatory argument, a plugin descriptor.

 $plugin->reload( 'Connector' );

Takes no arguments.

 $plugin->loaded();

Returns a list of descriptors of managed plugins.

An IRC interface is enabled by specifying a "botowner" mask to "new". Commands may be either invoked via a PRIVMSG directly to your bot or in a channel by prefixing the command with the nickname of your bot. One caveat, the parsing of the irc command is very rudimentary (it merely splits the line on spaces).

Takes the same arguments as "load".

Takes the same arguments as "unload".

Takes the same arguments as "reload".

Returns a list of descriptors of managed plugins.

Returns a list of descriptors of *all* plugins loaded into the current PoCo-IRC component.

Chris 'BinGOs' Williams

POE::Component::IRC::State

POE::Component::IRC::Plugin

2018-01-01 perl v5.26.1