| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Storage::Abstract; |
|
2
|
|
|
|
|
|
|
$Storage::Abstract::VERSION = '0.008'; |
|
3
|
11
|
|
|
11
|
|
2065258
|
use v5.14; |
|
|
11
|
|
|
|
|
41
|
|
|
4
|
11
|
|
|
11
|
|
77
|
use warnings; |
|
|
11
|
|
|
|
|
18
|
|
|
|
11
|
|
|
|
|
662
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
4989
|
use Mooish::Base -standard; |
|
|
11
|
|
|
|
|
827234
|
|
|
|
11
|
|
|
|
|
113
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has param 'driver' => ( |
|
9
|
|
|
|
|
|
|
coerce => (InstanceOf ['Storage::Abstract::Driver']) |
|
10
|
|
|
|
|
|
|
->plus_coercions(HashRef, q{ Storage::Abstract->load_driver($_) }), |
|
11
|
|
|
|
|
|
|
handles => [ |
|
12
|
|
|
|
|
|
|
qw( |
|
13
|
|
|
|
|
|
|
store |
|
14
|
|
|
|
|
|
|
is_stored |
|
15
|
|
|
|
|
|
|
retrieve |
|
16
|
|
|
|
|
|
|
dispose |
|
17
|
|
|
|
|
|
|
list |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
readonly |
|
20
|
|
|
|
|
|
|
set_readonly |
|
21
|
|
|
|
|
|
|
refresh |
|
22
|
|
|
|
|
|
|
) |
|
23
|
|
|
|
|
|
|
], |
|
24
|
|
|
|
|
|
|
); |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
around BUILDARGS => sub { |
|
27
|
|
|
|
|
|
|
my ($orig, $self, @raw_args) = @_; |
|
28
|
|
|
|
|
|
|
my %args; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
if (@raw_args == 1 && ref $raw_args[0] eq 'HASH') { |
|
31
|
|
|
|
|
|
|
%args = %{$raw_args[0]}; |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
else { |
|
34
|
|
|
|
|
|
|
%args = @raw_args; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my %other_args = %args; |
|
38
|
|
|
|
|
|
|
%args = (); |
|
39
|
|
|
|
|
|
|
foreach my $base_key (qw(driver)) { |
|
40
|
|
|
|
|
|
|
$args{$base_key} = delete $other_args{$base_key}; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
if (!ref $args{driver}) { |
|
44
|
|
|
|
|
|
|
$args{driver} = { |
|
45
|
|
|
|
|
|
|
driver => $args{driver}, |
|
46
|
|
|
|
|
|
|
%other_args, |
|
47
|
|
|
|
|
|
|
}; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
return $self->$orig(%args); |
|
51
|
|
|
|
|
|
|
}; |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub load_driver |
|
54
|
|
|
|
|
|
|
{ |
|
55
|
19
|
|
|
19
|
1
|
1222
|
my ($class, @raw_args) = @_; |
|
56
|
19
|
|
|
|
|
43
|
my %args; |
|
57
|
|
|
|
|
|
|
|
|
58
|
19
|
50
|
33
|
|
|
145
|
if (@raw_args == 1 && ref $raw_args[0] eq 'HASH') { |
|
59
|
19
|
|
|
|
|
37
|
%args = %{$raw_args[0]}; |
|
|
19
|
|
|
|
|
82
|
|
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
else { |
|
62
|
0
|
|
|
|
|
0
|
%args = @raw_args; |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
19
|
|
|
|
|
66
|
my $driver = delete $args{driver}; |
|
66
|
19
|
50
|
|
|
|
62
|
die 'driver is required in Storage::Abstract' unless defined $driver; |
|
67
|
|
|
|
|
|
|
|
|
68
|
19
|
|
|
|
|
94
|
my $name = ucfirst $driver; |
|
69
|
19
|
|
|
|
|
35
|
my $full_namespace; |
|
70
|
19
|
100
|
|
|
|
83
|
if ($name =~ /^\+/) { |
|
71
|
1
|
|
|
|
|
4
|
$full_namespace = substr $name, 1; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
else { |
|
74
|
18
|
|
|
|
|
50
|
$full_namespace = "Storage::Abstract::Driver::$name"; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
19
|
|
|
|
|
144
|
(my $file_path = $full_namespace) =~ s{::}{/}g; |
|
78
|
19
|
|
|
|
|
12401
|
require "$file_path.pm"; |
|
79
|
19
|
|
|
|
|
361
|
return $full_namespace->new(%args); |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |