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   689 use Carp;
  16         22  
  16         1031  
4 16     16   68 use strict;
  16         17  
  16         380  
5 16     16   52 use warnings;
  16         23  
  16         2303  
6              
7             our $AUTOLOAD;
8             our $VERSION = "0.05";
9              
10             sub AUTOLOAD {
11 120     120   4193 my $me = shift;
12 120         118 my $param = shift;
13            
14 120         174 my $fbd = ref($me) . '::FORBIDDEN_METHODS';
15            
16 120         117 my $attr = $AUTOLOAD;
17 120         448 $attr =~ s/.*:://;
18              
19 120 50       233 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       368 if ($attr eq "DESTROY"){
    100          
24 0         0 return;
25             } elsif (exists $me->{'_' . $attr}) {
26 16     16   75 no strict 'refs';
  16         21  
  16         2881  
27 113 100       158 if (defined $param) {
28 18 50 100     1313 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         22 $me->{'_' . $attr} = $param;
30 9         17 return $me;
31             } else {
32 95 100 100     1234 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         459 return $me->{'_' . $attr};
41             #}
42             }
43             } else {
44 7         584 croak "I have no method called '$attr()'!";
45             }
46             }
47              
48             1;
49             __END__