Bot::BasicBot::Pluggable::Store - base class for the back-end pluggable store
my $store = Bot::BasicBot::Pluggable::Store->new( option => "value" ); my $namespace = "MyModule"; for ( $store->keys($namespace) ) { my $value = $store->get($namespace, $_); $store->set( $namespace, $_, "$value and your momma." ); }
Store classes should subclass this and provide some persistent way of storing things.
Standard new method, blesses a hash into the right class and puts any key/value pairs passed to it into the blessed hash. Calls load() to load any internal variables, then init, which you can also override in your module.
new
load()
init
Called as part of new class construction, before load().
Called as part of new class construction, after init().
init()
Subclass me. But, only if you want to. See ...Store::Storable.pm as an example.
Returns a list of all store keys for the passed $namespace.
$namespace
If you pass $regex then it will only pass the keys matching $regex
$regex
Returns the stored value of the $variable from $namespace.
$variable
Sets stored value for $variable to $value in $namespace. Returns store object.
$value
Removes the $variable from the store. Returns store object.
Returns a list of all namespaces in the store.
Dumps the complete store to a huge Storable scalar. This is mostly so you can convert from one store to another easily, i.e.:
my $from = Bot::BasicBot::Pluggable::Store::Storable->new(); my $to = Bot::BasicBot::Pluggable::Store::DBI->new( ... ); $to->restore( $from->dump );
dump is written generally so you don't have to re-implement it in subclasses.
dump
Restores the store from a dump().
Tom Insam <tom@jerakeen.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Bot::BasicBot::Pluggable
Bot::BasicBot::Pluggable::Module
To install Bot::BasicBot::Pluggable, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Bot::BasicBot::Pluggable
CPAN shell
perl -MCPAN -e shell install Bot::BasicBot::Pluggable
For more information on module installation, please visit the detailed CPAN module installation guide.