Bot::IRC::Store - Bot::IRC persistent data storage with YAML
version 1.25
use Bot::IRC; Bot::IRC->new( connect => { server => 'irc.perl.org' }, plugins => ['Store'], vars => { store => 'bot.yaml' }, )->run;
This Bot::IRC plugin provides a very simple persistent storage mechanism. It stores all its data in a single YAML file. This makes things easy when you're dealing with a small amount of data, but performance will get increasingly bad as data increases. Consequently, you should probably not use this module specifically in a long-running production bot. Instead, use some Storage pseudo sub-class like Bot::IRC::Store::SQLite.
This plugin adds a single sub to the bot object called store(). Calling it will return a storage object which itself provides get() and set() methods. These operate just like you would expect.
store()
get()
set()
$bot->store->set( user => { nick => 'gryphon', score => 42 } );
my $score = $bot->store->get('user')->{score};
Pseudo sub-classes of Bot::IRC::Store should implement the same interface as this plugin. Also, they should call register() to ensure plugins that require storage don't clobber the store() of whatever pseudo sub-class is used.
register()
$bot->register('Bot::IRC::Store');
Bot::IRC
Gryphon Shafer <gryphon@cpan.org>
This software is copyright (c) 2019 by Gryphon Shafer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Bot::IRC, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::IRC
CPAN shell
perl -MCPAN -e shell install Bot::IRC
For more information on module installation, please visit the detailed CPAN module installation guide.