File Coverage

blib/lib/SOAP/WSDL/XSD/Builtin.pm
Criterion Covered Total %
statement 24 32 75.0
branch 2 8 25.0
condition 3 6 50.0
subroutine 5 5 100.0
pod 0 1 0.0
total 34 52 65.3


line stmt bran cond sub pod time code
1             package SOAP::WSDL::XSD::Builtin;
2 2     2   849 use strict;
  2         4  
  2         81  
3 2     2   12 use warnings;
  2         3  
  2         66  
4 2     2   1001 use Class::Std::Fast::Storable;
  2         28503  
  2         16  
5 2     2   278 use base qw(SOAP::WSDL::Base);
  2         4  
  2         1146  
6              
7             our $VERSION = $SOAP::WSDL::VERSION;
8              
9             # only used in SOAP::WSDL - will be obsolete once SOAP::WSDL uses the
10             # generative approach, too
11              
12             sub serialize {
13 1     1 0 54 my ($self, $name, $value, $opt) = @_;
14 1         21 my $xml;
15 1   50     8 $opt->{ indent } ||= "";
16 1   50     9 $opt->{ attributes } ||= [];
17              
18 1 50       3 $xml .= $opt->{ indent } if ($opt->{ readable });
19 1         2 $xml .= '<' . join ' ', $name, @{ $opt->{ attributes } };
  1         3  
20 1 50       7 if ( $opt->{ autotype }) {
21 1         8 my $ns = $self->get_targetNamespace();
22 1         5 my %prefix_of = reverse %{ $opt->{ namespace } };
  1         4  
23 1   50     13 my $prefix = $prefix_of{ $ns }
24             || die 'No prefix found for namespace '. $ns;
25 0           $xml .= ' type="' . $prefix . ':'
26             . $self->get_name() . '"';
27             }
28              
29 0 0         if (defined $value) {
30 0           $xml .= '>';
31 0           $xml .= "$value";
32 0           $xml .= '' ;
33             }
34             else {
35 0           $xml .= '/>';
36             }
37 0 0         $xml .= "\n" if ($opt->{ readable });
38 0           return $xml;
39             }
40              
41             1;