Bot::B...::Store(3pm)
π Bot::B...::Store β bestie edition π
okay so this is the manpage for Bot::BasicBot::Pluggable::Store, from the User Contributed Perl Documentation section (3pm). it's the base class for the back-end pluggable store, and honestly? it's giving foundation of everything. it's the blueprint other store classes inherit from. no cap.
β¨ VERSION β¨
version 1.30 β that's the one, bestie π
πΈ SYNOPSIS πΈ
here's the vibe, copy-paste ready:
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." );
}
and the whole point of this class, the mission statement: Store classes should subclass this and provide some persistent way of storing things. that's it. that's the assignment. if you want your stuff to actually stick around, you subclass this. periodt. π«Ά
π METHODS π
π« new()
the standard new method, iconic behaviour only: it blesses a hash into the right class and drops any key/value pairs you passed into the blessed hash.
- if you call it with a hash argument as its first argument,
new_from_hashrefgets run with that hash as its only argument. the possible keys and values live in"new_from_hashref"(scroll down, bestie). - you can also pass a string and it will try to call
new_from_hashrefwith a hash reference{ type => $string }. cute, right? - then it calls
load()to load any internal variables, then"init"β which, yes, you can override in your own module. main character energy, go off. π
π« new_from_hashref( $hashref )
this one is intended to be called as a class method, so you can dynamically create a store object. it expects a hash reference as its only argument.
- the only required hash element is a string specified by
type. - that
typeshould be either a fully qualified classname, or a colonless string that gets appended toBot::BasicBot::Pluggable::Store. - every other argument gets passed down to the real object constructor. π¦
π« init()
called as part of new class construction, before load(). π±
π« load()
called as part of new class construction, after init(). πΏ
π« save()
subclass me. but, only if you want to. π
see ...Store::Storable.pm as an example. that's the inspo, bestie.
π« keys($namespace,[$regex])
returns a list of all store keys for the passed $namespace.
if you pass $regex then it will only pass the keys matching $regex. filtering queen behaviour π
π« get($namespace, $variable)
returns the stored value of the $variable from $namespace. that's it, that's the whole thing.
π« set($namespace, $variable, $value)
sets stored value for $variable to $value in $namespace. returns store object. π₯
π« unset($namespace, $variable)
removes the $variable from the store. returns store object. bye bestie π
π« namespaces()
returns a list of all namespaces in the store. all of them. every single one. π
π« dump()
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 );
and here's the slay part: "dump" is written generally, so you don't have to re-implement it in subclasses. we love a reusable method. β¨
π« restore($data)
restores the store from a dump(). the glow-up reversal arc π
π AUTHOR π
Mario Domgoergen <mdom@cpan.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. (yes bestie, same terms as Perl itself, we love a permissive license π«Ά)
π SEE ALSO π
Bot::BasicBot::PluggableBot::BasicBot::Pluggable::Module
and that's the whole page, fr fr π this was Bot::B...::Store(3pm) from perl v5.40.0, dated 2024-08-24. go forth and subclass, bestie β you're gonna eat. π
ππ¦
π¦ where this page comes from
- ubuntu resolute: libbot-basicbot-pluggable-perl 1.30+ds1-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libbot-basicbot-pluggable-perl 1.30+ds1-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms