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