line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
27513
|
use 5.008; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
37
|
|
2
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
51
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Data::Container; |
6
|
|
|
|
|
|
|
our $VERSION = '1.100840'; |
7
|
|
|
|
|
|
|
# ABSTRACT: Base class for objects containing a list of items |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# Implements a container object. |
10
|
1
|
|
|
1
|
|
9
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
82
|
|
11
|
1
|
|
|
1
|
|
889
|
use Data::Miscellany 'set_push'; |
|
1
|
|
|
|
|
1357
|
|
|
1
|
|
|
|
|
73
|
|
12
|
1
|
|
|
1
|
|
820
|
use parent 'Class::Accessor::Complex'; |
|
1
|
|
|
|
|
296
|
|
|
1
|
|
|
|
|
5
|
|
13
|
|
|
|
|
|
|
use overload |
14
|
|
|
|
|
|
|
'""' => 'stringify', |
15
|
1
|
|
|
1
|
|
23503
|
cmp => sub { "$_[0]" cmp "$_[1]" }; |
|
1
|
|
|
0
|
|
3
|
|
|
1
|
|
|
|
|
15
|
|
|
0
|
|
|
|
|
0
|
|
16
|
|
|
|
|
|
|
__PACKAGE__ |
17
|
|
|
|
|
|
|
->mk_new |
18
|
|
|
|
|
|
|
->mk_array_accessors('items'); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub stringify { |
21
|
6
|
|
|
6
|
1
|
4712
|
join "\n\n" => map { "$_" } $_[0]->items; |
|
31
|
|
|
|
|
212
|
|
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub items_set_push { |
25
|
4
|
|
|
4
|
1
|
1786
|
my ($self, @values) = @_; |
26
|
4
|
100
|
66
|
|
|
10
|
set_push @{ $self->{items} }, |
|
5
|
|
|
|
|
51
|
|
27
|
4
|
|
|
|
|
7
|
map { ref($_) && UNIVERSAL::isa($self, ref $_) ? $_->items : $_ } @values; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub prepare_comparable { |
31
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
32
|
0
|
|
|
|
|
0
|
$self->items; # autovivify |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub item_grep { |
36
|
1
|
|
|
1
|
1
|
22
|
my ($self, $spec) = @_; |
37
|
1
|
|
|
|
|
3
|
grep { ref($_) eq $spec } $self->items; |
|
5
|
|
|
|
|
19
|
|
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
1; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
__END__ |