line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Ranger::List; |
2
|
4
|
|
|
4
|
|
3564
|
use parent Test::Ranger; |
|
4
|
|
|
|
|
1265
|
|
|
4
|
|
|
|
|
23
|
|
3
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
216
|
use strict; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
100
|
|
5
|
4
|
|
|
4
|
|
21
|
use warnings; |
|
4
|
|
|
|
|
6
|
|
|
4
|
|
|
|
|
117
|
|
6
|
4
|
|
|
4
|
|
21
|
use Carp; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
273
|
|
7
|
|
|
|
|
|
|
|
8
|
4
|
|
|
4
|
|
20
|
use version 0.77; our $VERSION = qv('0.0.4'); |
|
4
|
|
|
|
|
116
|
|
|
4
|
|
|
|
|
31
|
|
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
|
|
|
|
|
|
|
sub new { |
35
|
2
|
|
|
2
|
1
|
491
|
my $class = shift; |
36
|
2
|
|
|
|
|
3
|
my @list = @{ shift() }; |
|
2
|
|
|
|
|
6
|
|
37
|
2
|
|
|
|
|
5
|
my $self = {}; |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
|
|
6
|
bless ($self => $class); |
40
|
2
|
|
|
|
|
8
|
$self->init(@list); |
41
|
|
|
|
|
|
|
|
42
|
2
|
|
|
|
|
5
|
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
|
|
|
|
|
|
|
sub init { |
60
|
2
|
|
|
2
|
0
|
4
|
my $self = shift; |
61
|
2
|
|
|
|
|
4
|
my @list_in = @_; |
62
|
2
|
|
|
|
|
4
|
my @list_out ; |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
6
|
foreach my $single (@list_in) { |
65
|
2
|
|
|
|
|
10
|
push @list_out, Test::Ranger->new($single); |
66
|
|
|
|
|
|
|
}; |
67
|
|
|
|
|
|
|
|
68
|
2
|
|
|
|
|
21
|
$self->{-list} = \@list_out; |
69
|
2
|
|
|
|
|
15
|
$self->SUPER::init(); |
70
|
|
|
|
|
|
|
|
71
|
2
|
|
|
|
|
4
|
return $self; |
72
|
|
|
|
|
|
|
}; ## init |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
## END MODULE |
77
|
|
|
|
|
|
|
1; |
78
|
|
|
|
|
|
|
#============================================================================# |
79
|
|
|
|
|
|
|
__END__ |