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   577 use strict;
  2         3  
  2         59  
3 2     2   7 use warnings;
  2         2  
  2         69  
4 2     2   425 use Class::Std::Fast::Storable;
  2         15245  
  2         10  
5 2     2   172 use base qw(SOAP::WSDL::Base);
  2         3  
  2         595  
6              
7             our $VERSION = 3.003;
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 16 my ($self, $name, $value, $opt) = @_;
14 1         15 my $xml;
15 1   50     5 $opt->{ indent } ||= "";
16 1   50     5 $opt->{ attributes } ||= [];
17              
18 1 50       2 $xml .= $opt->{ indent } if ($opt->{ readable });
19 1         1 $xml .= '<' . join ' ', $name, @{ $opt->{ attributes } };
  1         5  
20 1 50       2 if ( $opt->{ autotype }) {
21 1         4 my $ns = $self->get_targetNamespace();
22 1         3 my %prefix_of = reverse %{ $opt->{ namespace } };
  1         2  
23 1   50     8 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;