blib/lib/Class/Property/RW/CustomSet.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 11 | 14 | 78.5 |
branch | n/a | ||
condition | n/a | ||
subroutine | 4 | 5 | 80.0 |
pod | n/a | ||
total | 15 | 19 | 78.9 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Class::Property::RW::CustomSet; | ||||||
2 | 1 | 1 | 4 | use strict; use warnings FATAL => 'all'; | |||
1 | 1 | 2 | |||||
1 | 30 | ||||||
1 | 3 | ||||||
1 | 2 | ||||||
1 | 26 | ||||||
3 | 1 | 1 | 3 | use parent 'Class::Property::RW'; | |||
1 | 2 | ||||||
1 | 3 | ||||||
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); | |||||
18 | 0 | return; | |||||
19 | } | ||||||
20 | |||||||
21 | 1; |