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