File Coverage

blib/lib/Pod/WSDL/AUTOLOAD.pm
Criterion Covered Total %
statement 26 28 92.8
branch 9 12 75.0
condition 15 18 83.3
subroutine 5 5 100.0
pod n/a
total 55 63 87.3


line stmt bran cond sub pod time code
1             package Pod::WSDL::AUTOLOAD;
2              
3 16     16   1222 use Carp;
  16         32  
  16         1771  
4 16     16   410 use strict;
  16         29  
  16         1151  
5 16     16   150 use warnings;
  16         33  
  16         4188  
6              
7             our $AUTOLOAD;
8             our $VERSION = "0.05";
9              
10             sub AUTOLOAD {
11 120     120   6065 my $me = shift;
12 120         155 my $param = shift;
13            
14 120         248 my $fbd = ref($me) . '::FORBIDDEN_METHODS';
15            
16 120         175 my $attr = $AUTOLOAD;
17 120         654 $attr =~ s/.*:://;
18              
19 120 50       407 if (@_) {
20 0         0 croak ref $me . " received call to '$attr' with too many params (max 1). Call was '$attr($param, " . join (", ", @_) . ")'!";
21             }
22            
23 120 50       626 if ($attr eq "DESTROY"){
    100          
24 0         0 return;
25             } elsif (exists $me->{'_' . $attr}) {
26 16     16   99 no strict 'refs';
  16         31  
  16         4384  
27 113 100       217 if (defined $param) {
28 18 50 100     2559 croak ref ($me) . " does not allow setting of '$attr', died" if (caller)[0] ne ref($me) and %$fbd and $fbd->{$attr} and !$fbd->{$attr}->{set};
      66        
      66        
29 9         28 $me->{'_' . $attr} = $param;
30 9         23 return $me;
31             } else {
32 95 100 100     2877 croak ref ($me) . " does not allow getting of '$attr', died" if (caller)[0] ne ref($me) and %$fbd and $fbd->{$attr} and !$fbd->{$attr}->{get};
      66        
      100        
33             #if (ref $me->{'_' . $attr} eq 'ARRAY') {
34             # return @{$me->{'_' . $attr}};
35             #} elsif (ref $me->{'_' . $attr} eq 'HASH') {
36             # return %{$me->{'_' . $attr}};
37             #} elsif (ref $me->{'_' . $attr} eq 'SCALAR') {
38             # return ${$me->{'_' . $attr}};
39             #} else {
40 93         668 return $me->{'_' . $attr};
41             #}
42             }
43             } else {
44 7         852 croak "I have no method called '$attr()'!";
45             }
46             }
47              
48             1;
49             __END__