| 1 | 2 | ▶ | use 5.008; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Data::Container; | ||||||||||||||||||||||||||||
| 6 | 2 | our $VERSION = '1.100840'; | |||||||||||||||||||||||||||
| 7 | # ABSTRACT: Base class for objects containing a list of items | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # Implements a container object. | ||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | use Data::Miscellany 'set_push'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 2 | ▶ | use parent 'Class::Accessor::Complex'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | use overload | ||||||||||||||||||||||||||||
| 14 | 2 | ▶ | '""' => 'stringify', | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 15 | 0 | ▶ | cmp => sub { "$_[0]" cmp "$_[1]" }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||||||||||||||||||||
| 16 | 2 | __PACKAGE__ | |||||||||||||||||||||||||||
| 17 | ->mk_new | ||||||||||||||||||||||||||||
| 18 | ->mk_array_accessors('items'); | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 6 | ▶ | sub stringify { | ||||||||||||||||||||||||||
|
Subroutine
stringify: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 21 | 6 | join "\n\n" => map { "$_" } $_[0]->items; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 4 | ▶ | sub items_set_push { | ||||||||||||||||||||||||||
|
Subroutine
items_set_push: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 25 | 4 | my ($self, @values) = @_; | |||||||||||||||||||||||||||
| 26 | 4 | set_push @{ $self->{items} }, | |||||||||||||||||||||||||||
| 27 | 4 | ▶ | map { ref($_) && UNIVERSAL::isa($self, ref $_) ? $_->items : $_ } @values; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $_ and UNIVERSAL::isa($self, ref $_)
MC/DC50%1/2
ref $_ and UNIVERSAL::isa($self, ref $_)
ref $_
UNIVERSAL::isa($self, ref $_)
Truth table66%2/3
A and B
A= ref $_B= UNIVERSAL::isa($self, ref $_)
| |||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 0 | ▶ | sub prepare_comparable { | ||||||||||||||||||||||||||
|
Subroutine
prepare_comparable: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 31 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 32 | 0 | $self->items; # autovivify | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | ▶ | sub item_grep { | ||||||||||||||||||||||||||
|
Subroutine
item_grep: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 36 | 1 | my ($self, $spec) = @_; | |||||||||||||||||||||||||||
| 37 | 1 | grep { ref($_) eq $spec } $self->items; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | 2 | 1; | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | __END__ | ||||||||||||||||||||||||||||