| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package UR::Object::Type::AccessorWriter::Sum; |
|
3
|
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
42
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
23
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
81
|
|
|
6
|
|
|
|
|
|
|
require UR; |
|
7
|
|
|
|
|
|
|
our $VERSION = "0.46"; # UR $VERSION; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub calculate { |
|
10
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
|
11
|
1
|
|
|
|
|
1
|
my $object = shift; |
|
12
|
1
|
|
|
|
|
1
|
my $properties = shift; |
|
13
|
1
|
|
|
|
|
2
|
my $sum = 0; |
|
14
|
1
|
|
|
|
|
1
|
for my $property (@$properties) { |
|
15
|
2
|
|
|
|
|
6
|
$sum += $object->$property |
|
16
|
|
|
|
|
|
|
} |
|
17
|
1
|
|
|
|
|
5
|
return $sum; |
|
18
|
|
|
|
|
|
|
}; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=pod |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 NAME |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
UR::Object::Type::AccessorWriter::Sum - Implements a calculation accessor which sums the values of its properties |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=cut |