File Coverage

blib/lib/App/Presto/Stash.pm
Criterion Covered Total %
statement 18 18 100.0
branch 6 6 100.0
condition n/a
subroutine 6 6 100.0
pod 0 4 0.0
total 30 34 88.2


line stmt bran cond sub pod time code
1             package App::Presto::Stash;
2             BEGIN {
3 2     2   78244 $App::Presto::Stash::AUTHORITY = 'cpan:BPHILLIPS';
4             }
5             {
6             $App::Presto::Stash::VERSION = '0.009';
7             }
8              
9             # ABSTRACT: Presto stash
10              
11 2     2   17584 use Moo;
  2         40246  
  2         16  
12              
13             {
14             my $stash = {};
15             sub get {
16 13     13 0 24 my $self = shift;
17 13         29 my $key = shift;
18 13 100       81 return exists $stash->{$key} ? $stash->{$key} : undef;
19             }
20             sub set {
21 7     7 0 17 my $self = shift;
22 7         16 my($k,$v) = @_;
23 7         33 return $stash->{$k} = $v;
24             }
25             sub unset {
26 1     1 0 2 my $self = shift;
27 1         3 my $k = shift;
28 1         5 return delete $stash->{$k};
29             }
30              
31             sub stash {
32 11     11 0 2252 my $self = shift;
33 11 100       64 if(@_ == 2){
    100          
34 1         5 return $self->set(@_);
35             } elsif(@_ == 1){
36 7         25 return $self->get(@_);
37             } else {
38 3         21 return $stash;
39             }
40             }
41             }
42              
43             1;
44              
45             __END__