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   130 use strict;
  25         40  
  25         1484  
3              
4             sub import {
5 125     125   382 my $caller = caller();
6 25     25   138 no strict qw(refs);
  25         35  
  25         2296  
7 125         325 *{ "$caller\::__mk_accessors" } = \&__mk_accessors;
  125         4841  
8             }
9              
10             sub __mk_accessors {
11 125     125   512 my ($class, @method_from) = @_;
12 25     25   152 no strict 'refs';
  25         55  
  25         3529  
13 125         367 for my $method ( @method_from ) {
14 875         1284 my $field = '_' . $method;
15 875         63785 *{ "$class\::$method" } = sub {
16 852 100   852   3063 my $self = ref $_[0] ? shift : shift->new();
17 852 100       5461 if (@_) {
18 135         361 $self->{$field} = shift;
19 135         324 return $self
20             }
21 717         11746 return $self->{$field};
22             }
23 875         3251 }
24             }
25              
26              
27             1;
28              
29             __END__