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   107 use strict;
  25         31  
  25         1322  
3              
4             sub import {
5 125     125   338 my $caller = caller();
6 25     25   120 no strict qw(refs);
  25         32  
  25         1913  
7 125         281 *{ "$caller\::__mk_accessors" } = \&__mk_accessors;
  125         3393  
8             }
9              
10             sub __mk_accessors {
11 125     125   441 my ($class, @method_from) = @_;
12 25     25   119 no strict 'refs';
  25         33  
  25         4038  
13 125         277 for my $method ( @method_from ) {
14 875         1143 my $field = '_' . $method;
15 875         52469 *{ "$class\::$method" } = sub {
16 852 100   852   2820 my $self = ref $_[0] ? shift : shift->new();
17 852 100       1555 if (@_) {
18 135         334 $self->{$field} = shift;
19 135         295 return $self
20             }
21 717         7024 return $self->{$field};
22             }
23 875         2445 }
24             }
25              
26              
27             1;
28              
29             __END__