NAME

Bot::IRC::Store - Bot::IRC persistent data storage with YAML

VERSION

version 1.35

SYNOPSIS

    use Bot::IRC;

    Bot::IRC->new(
        connect => { server => 'irc.perl.org' },
        plugins => ['Store'],
        vars    => { store => 'bot.yaml' },
    )->run;

DESCRIPTION

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.

EXAMPLE USE

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.

set

    $bot->store->set( user => { nick => 'gryphon', score => 42 } );

get

    my $score = $bot->store->get('user')->{score};

PSEUDO SUB-CLASSES

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.

    $bot->register('Bot::IRC::Store');

SEE ALSO

Bot::IRC

AUTHOR

Gryphon Shafer <gryphon@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2016-2021 by Gryphon Shafer.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)