File Coverage

lib/Kwiki/Cache.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package Kwiki::Cache;
2 1     1   25738 use Kwiki::Plugin -Base;
  0            
  0            
3             use Digest::MD5;
4             our $VERSION = '0.11';
5              
6             const class_id => 'cache';
7             const class_title => 'Generic Cache';
8              
9             sub process {
10             my $closure = shift;
11             my $cache_name = Digest::MD5::md5_hex(join '!@#$', @_);
12             my $path = $self->plugin_directory;
13             my $io = io->catfile($path, $cache_name)->assert;
14             unless ($io->exists) {
15             $io->lock->mode('>>')->open;
16             if ($io->empty) {
17             $io->print(&$closure);
18             }
19             $io->close;
20             }
21             $io->scalar;
22             }
23              
24             __DATA__