line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::CompactReadonly::V0::Collection; |
2
|
|
|
|
|
|
|
our $VERSION = '0.0.5'; |
3
|
|
|
|
|
|
|
|
4
|
9
|
|
|
9
|
|
77
|
use warnings; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
298
|
|
5
|
9
|
|
|
9
|
|
49
|
use strict; |
|
9
|
|
|
|
|
21
|
|
|
9
|
|
|
|
|
187
|
|
6
|
9
|
|
|
9
|
|
44
|
use base 'Data::CompactReadonly::V0::Node'; |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
1382
|
|
7
|
|
|
|
|
|
|
|
8
|
9
|
|
|
9
|
|
68
|
use Scalar::Util qw(blessed); |
|
9
|
|
|
|
|
20
|
|
|
9
|
|
|
|
|
553
|
|
9
|
9
|
|
|
9
|
|
4332
|
use Data::CompactReadonly::V0::Scalar; |
|
9
|
|
|
|
|
28
|
|
|
9
|
|
|
|
|
3305
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub _numeric_type_for_length { |
12
|
1573
|
|
|
1573
|
|
2563
|
my $invocant = shift(); |
13
|
1573
|
100
|
|
|
|
12782
|
(my $class = blessed($invocant) ? blessed($invocant) : $invocant) =~ s/(Text|Array|Dictionary)/Scalar/; |
14
|
1573
|
|
|
|
|
6290
|
return $class; |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub count { |
18
|
345
|
|
|
345
|
0
|
3773
|
my $self = shift; |
19
|
345
|
100
|
100
|
|
|
1334
|
if($self->{cache} && exists($self->{cache}->{count})) { |
|
|
100
|
|
|
|
|
|
20
|
13
|
|
|
|
|
41
|
return $self->{cache}->{count}; |
21
|
|
|
|
|
|
|
} elsif($self->{cache}) { |
22
|
5
|
|
|
|
|
15
|
return $self->{cache}->{count} = $self->_count(); |
23
|
|
|
|
|
|
|
} else { |
24
|
327
|
|
|
|
|
783
|
return $self->_count(); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _count { |
29
|
332
|
|
|
332
|
|
542
|
my $self = shift; |
30
|
332
|
|
|
|
|
969
|
$self->_seek($self->_offset()); |
31
|
332
|
|
|
|
|
1273
|
return $self->_numeric_type_for_length()->_init(root => $self->_root()); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub id { |
35
|
6
|
|
|
6
|
0
|
15
|
my $self = shift; |
36
|
6
|
|
|
|
|
19
|
return $self->_offset(); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _scalar_type_bytes { |
40
|
684
|
|
|
684
|
|
1130
|
my $self = shift; |
41
|
684
|
|
|
|
|
1451
|
return $self->_numeric_type_for_length()->_num_bytes(); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub _encode_ptr { |
45
|
131312
|
|
|
131312
|
|
352883
|
my($class, %args) = @_; |
46
|
|
|
|
|
|
|
return Data::CompactReadonly::V0::Scalar->_encode_word_as_number_of_bytes( |
47
|
|
|
|
|
|
|
$args{pointer}, |
48
|
|
|
|
|
|
|
$args{ptr_size} |
49
|
131312
|
|
|
|
|
384376
|
); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _decode_ptr { |
53
|
684
|
|
|
684
|
|
2738
|
goto &Data::CompactReadonly::V0::Scalar::_decode_word; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |