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   15610 use strict;
  8         11  
  8         240  
3 8     8   28 use warnings;
  8         49  
  8         161  
4 8     8   2489 use Pod::WSDL::AUTOLOAD;
  8         14  
  8         1829  
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 1300 my ($pkg, $str) = @_;
19              
20 11 100       24 defined $str or $str = ''; # avoids warnings, dies soon
21 11 100       89 $str =~ s/\s*_(INOUT|IN|OUT)\s*//i or die "Input string '$str' does not begin with '_IN', '_OUT' or '_INOUT'";
22            
23 9         18 my $paramType = $1;
24            
25 9         20 my ($name, $type, $descr) = split /\s+/, $str, 3;
26              
27 9   50     16 $type ||= ''; # avoids warnings, dies soon
28            
29 9         21 $type =~ /([\$\@])(.+)/;
30 9 100 33     40 die "Type '$type' must have structure (\$|@), e.g. '\$boolean' or '\@string', not '$type' died" unless $1 and $2;
31            
32 8 100 100     80 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__