line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::Run::Base::Struct; |
2
|
|
|
|
|
|
|
|
3
|
18
|
|
|
18
|
|
16743
|
use strict; |
|
18
|
|
|
|
|
34
|
|
|
18
|
|
|
|
|
1883
|
|
4
|
18
|
|
|
18
|
|
85
|
use warnings; |
|
18
|
|
|
|
|
35
|
|
|
18
|
|
|
|
|
518
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Test::Run::Base::Struct - base class for Test::Run's "structs", that are |
9
|
|
|
|
|
|
|
simple classes that hold several values. |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 DESCRIPTION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Inherits from L<Test::Run::Base>. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
18
|
|
|
18
|
|
85
|
use MRO::Compat; |
|
18
|
|
|
|
|
37
|
|
|
18
|
|
|
|
|
304
|
|
18
|
18
|
|
|
18
|
|
118
|
use Moose; |
|
18
|
|
|
|
|
30
|
|
|
18
|
|
|
|
|
86
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# We need to put it here before the use MooseX::StrictConstructor due |
21
|
|
|
|
|
|
|
# to a Moose mis-feature. Thanks to doy. |
22
|
|
|
|
|
|
|
BEGIN |
23
|
|
|
|
|
|
|
{ |
24
|
18
|
|
|
18
|
|
107771
|
extends('Test::Run::Base'); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
18
|
|
|
18
|
|
26592
|
use MooseX::StrictConstructor; |
|
18
|
|
|
|
|
498663
|
|
|
18
|
|
|
|
|
105
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub _pre_init |
31
|
|
|
|
286
|
|
|
{ |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
18
|
|
|
18
|
|
163427
|
use Carp; |
|
18
|
|
|
|
|
42
|
|
|
18
|
|
|
|
|
3477
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 BUILD |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
For Moose. |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub BUILD |
43
|
|
|
|
|
|
|
{ |
44
|
538
|
|
|
538
|
1
|
996587
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=begin debugging_code |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
Carp::confess '$args not a hash' if (ref($args) ne "HASH"); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=end debugging_code |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
538
|
|
|
|
|
4332
|
$self->_pre_init(); |
55
|
|
|
|
|
|
|
|
56
|
538
|
|
|
|
|
1607
|
return; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 METHODS |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 $struct->inc_field($field_name) |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Increment the slot $field_name by 1. |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=cut |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub inc_field |
68
|
|
|
|
|
|
|
{ |
69
|
519
|
|
|
519
|
1
|
1976
|
my ($self, $field) = @_; |
70
|
519
|
|
|
|
|
1680
|
return $self->add_to_field($field, 1); |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head2 $struct->add_to_field($field_name, $difference) |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
Add $difference to the slot $field_name. |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=cut |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub add_to_field |
80
|
|
|
|
|
|
|
{ |
81
|
521
|
|
|
521
|
1
|
2237
|
my ($self, $field, $diff) = @_; |
82
|
521
|
|
|
|
|
15972
|
$self->$field($self->$field()+$diff); |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
1; |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
__END__ |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SEE ALSO |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
L<Test::Run::Base>, L<Test::Run::Obj>, L<Test::Run::Core> |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 LICENSE |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This file is freely distributable under the MIT X11 license. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
L<http://www.opensource.org/licenses/mit-license.php> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 AUTHOR |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Shlomi Fish, L<http://www.shlomifish.org/>. |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
104
|
|
|
|
|
|
|
|