blib/lib/Class/Property/WO/CustomSet.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 11 | 16 | 68.7 |
branch | n/a | ||
condition | n/a | ||
subroutine | 4 | 5 | 80.0 |
pod | n/a | ||
total | 15 | 21 | 71.4 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Class::Property::WO::CustomSet; | ||||||
2 | 1 | 1 | 4 | use strict; use warnings FATAL => 'all'; | |||
1 | 1 | 1 | |||||
1 | 41 | ||||||
1 | 4 | ||||||
1 | 1 | ||||||
1 | 34 | ||||||
3 | 1 | 1 | 4 | use parent 'Class::Property::WO'; | |||
1 | 1 | ||||||
1 | 4 | ||||||
4 | |||||||
5 | sub TIESCALAR | ||||||
6 | { | ||||||
7 | 1 | 1 | 2 | my( $class, $field, $setter ) = @_; | |||
8 | 1 | 5 | return bless \{ | ||||
9 | 'field' => $field | ||||||
10 | , 'setter' => $setter | ||||||
11 | }, $class; | ||||||
12 | } | ||||||
13 | |||||||
14 | sub STORE | ||||||
15 | { | ||||||
16 | 0 | 0 | my( $self, $value ) = @_; | ||||
17 | 0 | ${$self}->{'setter'}->(${$self}->{'object'}, $value); | |||||
0 | |||||||
0 | |||||||
18 | 0 | return; | |||||
19 | } | ||||||
20 | |||||||
21 | 1; |