File Coverage

blib/lib/SOAP/WSDL/Types.pm
Criterion Covered Total %
statement 33 42 78.5
branch 6 12 50.0
condition n/a
subroutine 8 9 88.8
pod 0 4 0.0
total 47 67 70.1


line stmt bran cond sub pod time code
1             package SOAP::WSDL::Types;
2 1     1   491 use strict;
  1         2  
  1         30  
3 1     1   5 use warnings;
  1         1  
  1         32  
4 1     1   314 use SOAP::WSDL::XSD::Schema::Builtin;
  1         1  
  1         19  
5 1     1   4 use Class::Std::Fast::Storable;
  1         1  
  1         3  
6 1     1   77 use base qw(SOAP::WSDL::Base);
  1         1  
  1         258  
7              
8             our $VERSION = 3.003;
9              
10             my %schema_of :ATTR(:name :default<[]>);
11              
12             sub START {
13 1     1 0 3 my ($self, $ident, $args_of) = @_;
14 1         7 $self->push_schema( SOAP::WSDL::XSD::Schema::Builtin->new() );
15 1         8 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 11 my ($self, $ns, $name) = @_;
30 3 100       7 ($ns, $name) = @{ $ns } if ref $ns; # allow passing list refs
  1         3  
31 3         3 foreach my $schema (@{ $schema_of{ ident $self } }) {
  3         6  
32 6         31 my $type = $schema->find_attribute($ns, $name);
33 6 100       72 return $type if $type;
34             }
35 1         3 return;
36             }
37              
38             sub find_element {
39 1     1 0 2 my ($self, $ns, $name) = @_;
40 1 50       3 ($ns, $name) = @{ $ns } if ref $ns; # allow passing list refs
  0         0  
41 1         1 foreach my $schema (@{ $schema_of{ ident $self } }) {
  1         3  
42 2         11 my $type = $schema->find_element($ns, $name);
43 2 50       5 return $type if $type;
44             }
45 1         4 return;
46             }
47              
48             1;