File Coverage

blib/lib/SOAP/WSDL/XSD/Builtin.pm
Criterion Covered Total %
statement 27 35 77.1
branch 2 8 25.0
condition 3 6 50.0
subroutine 6 6 100.0
pod 0 1 0.0
total 38 56 67.8


line stmt bran cond sub pod time code
1             package SOAP::WSDL::XSD::Builtin;
2 2     2   768 use strict;
  2         3  
  2         72  
3 2     2   10 use warnings;
  2         4  
  2         260  
4 2     2   803 use Class::Std::Fast::Storable;
  2         21811  
  2         24  
5 2     2   308 use base qw(SOAP::WSDL::Base);
  2         4  
  2         721  
6              
7 2     2   12 use version; our $VERSION = qv('3.001');
  2         4  
  2         13  
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 22 my ($self, $name, $value, $opt) = @_;
14 1         2 my $xml;
15 1   50     7 $opt->{ indent } ||= "";
16 1   50     7 $opt->{ attributes } ||= [];
17              
18 1 50       3 $xml .= $opt->{ indent } if ($opt->{ readable });
19 1         2 $xml .= '<' . join ' ', $name, @{ $opt->{ attributes } };
  1         4  
20 1 50       3 if ( $opt->{ autotype }) {
21 1         6 my $ns = $self->get_targetNamespace();
22 1         4 my %prefix_of = reverse %{ $opt->{ namespace } };
  1         3  
23 1   50     11 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;