File Coverage

blib/lib/Bot/BasicBot/Pluggable/Store/Memory.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Bot::BasicBot::Pluggable::Store::Memory;
2             $Bot::BasicBot::Pluggable::Store::Memory::VERSION = '1.20';
3 10     10   4818 use warnings;
  10         12  
  10         302  
4 10     10   33 use strict;
  10         13  
  10         203  
5              
6 10     10   32 use base qw( Bot::BasicBot::Pluggable::Store );
  10         13  
  10         1028  
7              
8             1;
9              
10             __END__
11              
12             =head1 NAME
13              
14             Bot::BasicBot::Pluggable::Store::Memory - use memory (RAM) to provide a storage backend
15              
16             =head1 VERSION
17              
18             version 1.20
19              
20             =head1 SYNOPSIS
21              
22             my $store = Bot::BasicBot::Pluggable::Store::Memory->new();
23             $store->set( "namespace", "key", "value" );
24            
25             =head1 DESCRIPTION
26              
27             This is a L<Bot::BasicBot::Pluggable::Store> that uses memory (RAM)
28             to store the values set by modules. To spell the obvious out, this
29             means that your data won't persist between invocations of your bot. So
30             this is mainly for testing and storing data for a short time.
31              
32             This module is just a bare bone subclass of
33             Bot::BasicBot::Pluggable::Store and does not implement any methods of
34             its own. In a perfect world Bot::BasicBot::Pluggable::Store would just
35             be a abstract base class, but it was implemented as normale in-memory
36             storage class. Due to Bot::BasicBot::Pluggable object creation you can
37             either specify a already created storage object or a string that is
38             simply appended to "Bot::BasicBot::Pluggable::Store::". So if you just
39             want to use memory storage you have to load it this way:
40              
41             my $bot => Bot::BasicBot::Pluggable->new ( store => Bot::BasicBot::Pluggable::Store->new() );
42              
43             Now you can use load it as any other storage module:
44              
45             my $bot => Bot::BasicBot::Pluggable->new ( store => 'Memory' );
46              
47             In this way we don't break any existing code.
48              
49             =head1 AUTHOR
50              
51             Mario Domgoergen <mdom@cpan.org>
52              
53             This program is free software; you can redistribute it
54             and/or modify it under the same terms as Perl itself.