Ranger/List.pm

filter: Statementstmt 100% 32 / 32 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 50.0% 1 / 2 totaltotal 97.5% 40 / 41 CC 2 SCAR 2.2
CC
2
Cov
100%
init
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Ranger.pm ↑ Summary
1 package Test::Ranger::List;
2 4 ▶use parent Test::Ranger;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use version 0.77; our $VERSION = qv('0.0.4');
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 ## use
11  
12 #============================================================================#
13  
14 #=========# CLASS METHOD
15 #
16 # my $list = $class->new( \@list );
17 # my $list = $class->new([
18 # { -a => 'x' },
19 # { -b => 'y' },
20 # ]);
21 #
22 # Purpose : Object constructor
23 # Parms : $class : Any subclass of this class
24 # : \@list : Arrayref only; required
25 # Returns : $self
26 # Invokes : init()
27 #
28 # An object of this $class is a hashref, *not* an arrayref!
29 # But it is constructed by passing in an arrayref.
30 # An empty hashref is blessed into $class.
31 # Each element of @list is blessed into Test::Ranger in init().
32 # Housekeeping info for the whole object is stored in other keys.
33 #
34 2 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
35 2 my $class = shift;
36 2 my @list = @{ shift() };
37 2 my $self = {};
38
39 2 bless ($self => $class);
40 2 $self->init(@list);
41
42 2 return $self;
43 }; ## new
44  
45 #=========# OBJECT METHOD
46 #
47 # $self->init( @list );
48 #
49 # Purpose : Object initializer
50 # Parms : $class
51 # : @list : Array; required
52 # Returns : $self
53 # Invokes : Test::Ranger::new()
54 #
55 # Blesses each element of @list into Test::Ranger and
56 # assigns \@list to $self->{-list}.
57 # Adds housekeeping info for the whole object to other keys.
58 #
59 2 ▶sub init {
Subroutine init: called CC=2 SCAR=6.9
Pod undocumented
60 2 my $self = shift;
61 2 my @list_in = @_;
62 2 my @list_out ;
63
64 2 foreach my $single (@list_in) {
65 2 push @list_out, Test::Ranger->new($single);
66 };
67
68 2 $self->{-list} = \@list_out;
69 2 $self->SUPER::init();
70
71 2 return $self;
72 }; ## init
73  
74  
75  
76 ## END MODULE
77 4 1;
78 #============================================================================#
79 __END__
« Ranger.pm ↑ Summary