File Coverage

blib/lib/SOAP/Lite/Utils.pm
Criterion Covered Total %
statement 22 22 100.0
branch 4 4 100.0
condition n/a
subroutine 6 6 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             package SOAP::Lite::Utils;
2 25     25   136 use strict;
  25         42  
  25         1189  
3              
4             sub import {
5 125     125   381 my $caller = caller();
6 25     25   124 no strict qw(refs);
  25         53  
  25         2142  
7 125         337 *{ "$caller\::__mk_accessors" } = \&__mk_accessors;
  125         4231  
8             }
9              
10             sub __mk_accessors {
11 125     125   610 my ($class, @method_from) = @_;
12 25     25   125 no strict 'refs';
  25         44  
  25         3320  
13 125         340 for my $method ( @method_from ) {
14 875         1695 my $field = '_' . $method;
15 875         88460 *{ "$class\::$method" } = sub {
16 852 100   852   3423 my $self = ref $_[0] ? shift : shift->new();
17 852 100       1822 if (@_) {
18 135         399 $self->{$field} = shift;
19 135         373 return $self
20             }
21 717         7301 return $self->{$field};
22             }
23 875         3687 }
24             }
25              
26              
27             1;
28              
29             __END__