line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package File::DataClass::Result; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
624
|
use namespace::autoclean; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
23
|
|
4
|
|
|
|
|
|
|
|
5
|
4
|
|
|
4
|
|
219
|
use Moo; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
21
|
|
6
|
4
|
|
|
4
|
|
1135
|
use File::DataClass::Types qw( Object Str ); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
27
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'id' => is => 'rw', isa => Str, required => 1; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has '_result_source' => is => 'ro', isa => Object, |
11
|
|
|
|
|
|
|
handles => { _path => 'path', _storage => 'storage' }, |
12
|
|
|
|
|
|
|
init_arg => 'result_source', reader => 'result_source', |
13
|
|
|
|
|
|
|
required => 1, weak_ref => 1; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
around 'BUILDARGS' => sub { |
16
|
|
|
|
|
|
|
my ($orig, $self, @args) = @_; my $attr = $orig->( $self, @args ); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $name = delete $attr->{name}; $attr->{id} //= $name; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
return $attr; |
21
|
|
|
|
|
|
|
}; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub delete { |
24
|
6
|
|
|
6
|
1
|
396
|
return $_[ 0 ]->_storage->delete( $_[ 0 ]->_path, $_[ 0 ] ); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub insert { |
28
|
6
|
|
|
6
|
1
|
402
|
return $_[ 0 ]->_storage->insert( $_[ 0 ]->_path, $_[ 0 ] ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub name { # Deprecated |
32
|
2
|
100
|
|
2
|
1
|
1120
|
return defined $_[ 1 ] ? $_[ 0 ]->id( $_[ 1 ] ) : $_[ 0 ]->id; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub update { |
36
|
11
|
|
|
11
|
1
|
167
|
return $_[ 0 ]->_storage->update( $_[ 0 ]->_path, $_[ 0 ] ); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
__END__ |