File Coverage

blib/lib/Data/Library.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package Data::Library;
2 3     3   16 use base qw(Class::Virtual);
  3         6  
  3         2441  
3              
4 3     3   24671 use vars qw($VERSION);
  3         14  
  3         217  
5             $VERSION = '0.2';
6              
7             =head1 NAME
8              
9             Data::Library - virtual class for repository support classes
10              
11             =head1 SYNOPSIS
12              
13             Data::Library provides a general repository service. Specifics are
14             implemented in subclasses.
15              
16             =head1 METHODS
17              
18             =cut
19              
20             __PACKAGE__->virtual_methods(qw(new lookup find cache toc reset));
21              
22             1;
23              
24             =item B
25              
26             my $library = new Data::Library(...configuration...);
27              
28             Configuration parameters are specific to subclasses.
29              
30             =item B
31              
32             my $boolean = $library->lookup($tag);
33              
34             Returns cached data items, by tag. If the source has changed since
35             it was cached, returns false.
36              
37             =item B
38              
39             my $data = $library->find($tag);
40              
41             Searches for data item identified by $tag.
42              
43             =item B
44              
45             $library->cache($tag, $data);
46              
47             Caches data by tag for later fetching via lookup().
48              
49             =item B
50              
51             my @array = $library->toc;
52              
53             Search through the library and return a list of all available entries.
54             Does not cache any of the items.
55              
56             =item B
57              
58             $library->reset;
59              
60             Erase all entries from the cache.
61              
62             =cut