File Coverage

blib/lib/Pod/WSDL/Param.pm
Criterion Covered Total %
statement 18 18 100.0
branch 8 8 100.0
condition 4 7 57.1
subroutine 4 4 100.0
pod 1 1 100.0
total 35 38 92.1


line stmt bran cond sub pod time code
1             package Pod::WSDL::Param;
2 8     8   64977 use strict;
  8         17  
  8         802  
3 8     8   41 use warnings;
  8         71  
  8         4297  
4 8     8   10174 use Pod::WSDL::AUTOLOAD;
  8         18  
  8         3789  
5              
6             our $VERSION = "0.05";
7             our @ISA = qw/Pod::WSDL::AUTOLOAD/;
8              
9             our %FORBIDDEN_METHODS = (
10             name => {get => 1, set => 0},
11             type => {get => 1, set => 0},
12             paramType => {get => 1, set => 0},
13             descr => {get => 1, set => 0},
14             array => {get => 1, set => 0},
15             );
16              
17             sub new {
18 11     11 1 2174 my ($pkg, $str) = @_;
19              
20 11 100       33 defined $str or $str = ''; # avoids warnings, dies soon
21 11 100       118 $str =~ s/\s*_(INOUT|IN|OUT)\s*//i or die "Input string '$str' does not begin with '_IN', '_OUT' or '_INOUT'";
22            
23 9         26 my $paramType = $1;
24            
25 9         29 my ($name, $type, $descr) = split /\s+/, $str, 3;
26              
27 9   50     30 $type ||= ''; # avoids warnings, dies soon
28            
29 9         35 $type =~ /([\$\@])(.+)/;
30 9 100 33     61 die "Type '$type' must have structure (\$|@), e.g. '\$boolean' or '\@string', not '$type' died" unless $1 and $2;
31            
32 8 100 100     202 bless {
33             _name => $name,
34             _type => $2,
35             _paramType => $paramType,
36             _descr => $descr || '',
37             _array => $1 eq '@' ? 1 : 0,
38             }, $pkg;
39             }
40              
41             1;
42             __END__