File Coverage

blib/lib/Data/Dimensions/SickTie.pm
Criterion Covered Total %
statement 8 9 88.8
branch 4 4 100.0
condition 2 3 66.6
subroutine 2 3 66.6
pod n/a
total 16 19 84.2


line stmt bran cond sub pod time code
1             package Data::Dimensions::SickTie;
2             # This module does horrid things with tie to allow ->set = stuff to
3             # perform type checking
4              
5             sub TIESCALAR {
6 19     19   32 my $class = shift;
7 19         113 return bless [@_], $class;
8             }
9             sub FETCH {
10 0     0   0 return $_[0]->[0];
11             }
12             sub STORE {
13 19     19   40 my ($self, $val) = @_;
14 19         51 my $obj = $self->[0];
15 19 100 66     115 if (!ref($val) || !UNIVERSAL::isa($val, 'Data::Dimensions')) {
16 11         45 $obj->natural($val);
17             }
18             else {
19 8 100       33 $obj->_moan("Storing value with incorrect units")
20             unless $obj->same_units($val);
21 6         26 $obj->base($val->base);
22             }
23             }
24             1;
25              
26             __END__