blib/lib/Class/Property/RW/CustomGet.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 15 | 15 | 100.0 |
branch | n/a | ||
condition | n/a | ||
subroutine | 5 | 5 | 100.0 |
pod | n/a | ||
total | 20 | 20 | 100.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Class::Property::RW::CustomGet; | ||||||
2 | 1 | 1 | 4 | use strict; use warnings FATAL => 'all'; | |||
1 | 1 | 1 | |||||
1 | 33 | ||||||
1 | 5 | ||||||
1 | 1 | ||||||
1 | 28 | ||||||
3 | 1 | 1 | 4 | use parent 'Class::Property::RW'; | |||
1 | 1 | ||||||
1 | 3 | ||||||
4 | |||||||
5 | sub TIESCALAR | ||||||
6 | { | ||||||
7 | 1 | 1 | 2 | my( $class, $field, $getter ) = @_; | |||
8 | 1 | 5 | return bless \{ | ||||
9 | 'field' => $field | ||||||
10 | , 'getter' => $getter | ||||||
11 | }, $class; | ||||||
12 | } | ||||||
13 | |||||||
14 | sub FETCH | ||||||
15 | { | ||||||
16 | 2 | 2 | 36 | my( $self ) = @_; | |||
17 | 2 | 5 | return ${$self}->{'getter'}->(${$self}->{'object'}); | ||||
2 | 9 | ||||||
2 | 4 | ||||||
18 | } | ||||||
19 | |||||||
20 | 1; |