Bot::Cobalt::Manual::Plugins::Dist - Packaging Cobalt plugins
Packaging Bot::Cobalt plugins is just like packaging any other Perl module.
Typically, the easiest way to do so quickly is via Module::Build. (For more involved distributions you may want to look at ExtUtils::MakeMaker).
(This guide only covers packaging plugins; See Bot::Cobalt::Manual::Plugins for more on writing plugins and Bot::Cobalt::Manual::Plugins::Tutorial for a walk-through.)
Create a dist dir for your module:
$ mkdir Bot-Cobalt-Plugin-MyPlugin $ cd Bot-Cobalt-Plugin-MyPlugin # create this dist's libdir: $ mkdir -p lib/Bot/Cobalt/Plugin/ $ cd lib/Bot/Cobalt/Plugin/ # create your plugin: $ $EDITOR MyPlugin.pm
Module::Build requires a Build.PL file.
Build.PL
Here's a simple one based around one centralized plugin; your plugin will need to declare a proper $VERSION:
#!/usr/bin/perl ## Simple example Build.PL my $build = Module::Build->new( module_name => "Bot::Cobalt::Plugin::User::MyPlugin", dist_abstract => "My Bot::Cobalt plugin", dist_author => "Me <myself@example.ext>", license => 'perl', create_makefile_pl => 'small', requires => { 'Bot::Cobalt::Core' => '0.200', }, ); $build->create_build_script;
Create a dist tarball: $ ./Build dist
Users of your plugin can install the distribution (and dependencies) via cpan by unpacking your plugin dist and specifying the local directory:
cpan
$ cd Bot-Cobalt-Plugin-MyPlugin $ cpan .
...or via Module::Build directly:
$ perl Build.PL $ ./Build # may need root access (or perhaps L<local::lib>): $ ./Build install
App::cpanminus makes this even easier:
# Easy install via cpanm: $ cpanm ./Bot-Cobalt-Plugin-MyPlugin-0.001.tar.gz
When your plugin is release-ready, please consider posting it to CPAN.
Bot::Cobalt comes with the cobalt2-plugin-installcf tool, allowing for easy installation of plugin-specific configuration files to user configuration directories.
In order to provide a configuration file installable via the installcf tool, your plugin needs a Conf.pm module providing a 'conf' class method.
Here's an example demonstrating using the DATA filehandle to provide an example configuration:
## In lib/Bot/Cobalt/Plugin/MyPlugin/Conf.pm package Bot::Cobalt::Plugin::MyPlugin::Conf; sub conf { local $/; my $cf = <DATA>; return $cf } __DATA__ --- ## MyPlugin example configuration. Opts: Enable_Snacks: - pie - cake Do_Stuff: 1
Jon Portnoy <avenj@cobaltirc.org>
http://www.cobaltirc.org
To install Bot::Cobalt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::Cobalt
CPAN shell
perl -MCPAN -e shell install Bot::Cobalt
For more information on module installation, please visit the detailed CPAN module installation guide.