File Coverage

blib/lib/SOAP/WSDL/Types.pm
Criterion Covered Total %
statement 36 45 80.0
branch 6 12 50.0
condition n/a
subroutine 9 10 90.0
pod 0 4 0.0
total 51 71 71.8


line stmt bran cond sub pod time code
1             package SOAP::WSDL::Types;
2 1     1   71617 use strict;
  1         2  
  1         58  
3 1     1   7 use warnings;
  1         2  
  1         41  
4 1     1   91636 use SOAP::WSDL::XSD::Schema::Builtin;
  1         3  
  1         32  
5 1     1   6 use Class::Std::Fast::Storable;
  1         2  
  1         5  
6 1     1   134 use base qw(SOAP::WSDL::Base);
  1         2  
  1         75  
7              
8 1     1   6 use version; our $VERSION = qv('3.001');
  1         2  
  1         4  
9              
10             my %schema_of :ATTR(:name :default<[]>);
11              
12             sub START {
13 1     1 0 8 my ($self, $ident, $args_of) = @_;
14 1         13 $self->push_schema( SOAP::WSDL::XSD::Schema::Builtin->new() );
15 1         10 return $self;
16             }
17              
18             sub find_type {
19 0     0 0 0 my ($self, $ns, $name) = @_;
20 0 0       0 ($ns, $name) = @{ $ns } if ref $ns; # allow passing list refs
  0         0  
21 0         0 foreach my $schema (@{ $schema_of{ ident $self } }) {
  0         0  
22 0         0 my $type = $schema->find_type($ns, $name);
23 0 0       0 return $type if $type;
24             }
25 0         0 return;
26             }
27              
28             sub find_attribute {
29 3     3 0 15 my ($self, $ns, $name) = @_;
30 3 100       8 ($ns, $name) = @{ $ns } if ref $ns; # allow passing list refs
  1         2  
31 3         5 foreach my $schema (@{ $schema_of{ ident $self } }) {
  3         11  
32 6         44 my $type = $schema->find_attribute($ns, $name);
33 6 100       114 return $type if $type;
34             }
35 1         5 return;
36             }
37              
38             sub find_element {
39 1     1 0 2 my ($self, $ns, $name) = @_;
40 1 50       4 ($ns, $name) = @{ $ns } if ref $ns; # allow passing list refs
  0         0  
41 1         2 foreach my $schema (@{ $schema_of{ ident $self } }) {
  1         4  
42 2         14 my $type = $schema->find_element($ns, $name);
43 2 50       8 return $type if $type;
44             }
45 1         5 return;
46             }
47              
48             1;