line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::CompactReadonly::V0::Collection; |
2
|
|
|
|
|
|
|
our $VERSION = '0.1.0'; |
3
|
|
|
|
|
|
|
|
4
|
9
|
|
|
9
|
|
75
|
use warnings; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
339
|
|
5
|
9
|
|
|
9
|
|
48
|
use strict; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
195
|
|
6
|
9
|
|
|
9
|
|
43
|
use base 'Data::CompactReadonly::V0::Node'; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
1285
|
|
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
71
|
use Scalar::Util qw(blessed); |
|
9
|
|
|
|
|
17
|
|
|
9
|
|
|
|
|
520
|
|
9
|
9
|
|
|
9
|
|
4096
|
use Data::CompactReadonly::V0::Scalar; |
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
3351
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _numeric_type_for_length { |
12
|
1647
|
|
|
1647
|
|
2799
|
my $invocant = shift(); |
13
|
1647
|
100
|
|
|
|
14076
|
(my $class = blessed($invocant) ? blessed($invocant) : $invocant) =~ s/(Text|Array|Dictionary)/Scalar/; |
14
|
1647
|
|
|
|
|
6623
|
return $class; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub count { |
18
|
358
|
|
|
358
|
0
|
3396
|
my $self = shift; |
19
|
358
|
100
|
100
|
|
|
1358
|
if($self->{cache} && exists($self->{cache}->{count})) { |
|
|
100
|
|
|
|
|
|
20
|
13
|
|
|
|
|
41
|
return $self->{cache}->{count}; |
21
|
|
|
|
|
|
|
} elsif($self->{cache}) { |
22
|
5
|
|
|
|
|
14
|
return $self->{cache}->{count} = $self->_count(); |
23
|
|
|
|
|
|
|
} else { |
24
|
340
|
|
|
|
|
843
|
return $self->_count(); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _count { |
29
|
345
|
|
|
345
|
|
580
|
my $self = shift; |
30
|
345
|
|
|
|
|
1042
|
$self->_seek($self->_offset()); |
31
|
345
|
|
|
|
|
1443
|
return $self->_numeric_type_for_length()->_init(root => $self->_root()); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub id { |
35
|
6
|
|
|
6
|
0
|
28
|
my $self = shift; |
36
|
6
|
|
|
|
|
22
|
return $self->_offset(); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _scalar_type_bytes { |
40
|
712
|
|
|
712
|
|
1234
|
my $self = shift; |
41
|
712
|
|
|
|
|
1537
|
return $self->_numeric_type_for_length()->_num_bytes(); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _encode_ptr { |
45
|
131339
|
|
|
131339
|
|
379772
|
my($class, %args) = @_; |
46
|
|
|
|
|
|
|
return Data::CompactReadonly::V0::Scalar->_encode_word_as_number_of_bytes( |
47
|
|
|
|
|
|
|
$args{pointer}, |
48
|
|
|
|
|
|
|
$args{ptr_size} |
49
|
131339
|
|
|
|
|
398603
|
); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _decode_ptr { |
53
|
712
|
|
|
712
|
|
2905
|
goto &Data::CompactReadonly::V0::Scalar::_decode_word; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |