blib/lib/SOAP/WSDL/Generator/Template.pm untested

filter: Statementstmt 0.0% 0 / 40 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 58 CC 2 SCAR 10.6
CC
2
Cov
0%
_process
6.0
START
2.0
BEGIN
2.0
CRAP 2.9
1 package SOAP::WSDL::Generator::Template;
2 use strict; use warnings;
3 use Template 2.18;
4 use Class::Std::Fast::Storable;
5 use Carp;
6 use SOAP::WSDL::Generator::PrefixResolver;
7  
8 our $VERSION = 3.004;
9  
10 my %tt_of :ATTR(:get<tt>);
11 my %definitions_of :ATTR(:name<definitions> :default<()>);
12 my %server_prefix_of :ATTR(:name<server_prefix> :default<MyServer>);
13 my %interface_prefix_of :ATTR(:name<interface_prefix> :default<MyInterfaces>);
14 my %typemap_prefix_of :ATTR(:name<typemap_prefix> :default<MyTypemaps>);
15 my %type_prefix_of :ATTR(:name<type_prefix> :default<MyTypes>);
16 my %element_prefix_of :ATTR(:name<element_prefix> :default<MyElements>);
17 my %attribute_prefix_of :ATTR(:name<attribute_prefix> :default<MyAttributes>);
18 my %INCLUDE_PATH_of :ATTR(:name<INCLUDE_PATH> :default<()>);
19 my %EVAL_PERL_of :ATTR(:name<EVAL_PERL> :default<0>);
20 my %RECURSION_of :ATTR(:name<RECURSION> :default<0>);
21 my %OUTPUT_PATH_of :ATTR(:name<OUTPUT_PATH> :default<.>);
22  
23 my %prefix_resolver_class_of :ATTR(:name<prefix_resolver_class> :default<SOAP::WSDL::Generator::PrefixResolver>);
24  
25 sub START {
26 my ($self, $ident, $arg_ref) = @_;
27 }
28  
29 sub _process :PROTECTED {
30 my ($self, $template, $arg_ref, $output) = @_;
31 my $ident = ident $self;
32  
33 # always create a new Template object to
34 # force re-loading of plugins.
35 my $tt = Template->new(
36 DEBUG => 1,
37 EVAL_PERL => $EVAL_PERL_of{ $ident },
38 RECURSION => $RECURSION_of{ $ident },
39 INCLUDE_PATH => $INCLUDE_PATH_of{ $ident },
40 OUTPUT_PATH => $OUTPUT_PATH_of{ $ident },
41 PLUGIN_BASE => 'SOAP::WSDL::Generator::Template::Plugin',
42 )
43 or die Template->error();
44  
45 $tt->process( $template,
46 {
47 context => {
48 prefix_resolver => $prefix_resolver_class_of{ $$self }->new({
49 namespace_prefix_map => {
50 'http://www.w3.org/2001/XMLSchema' => 'SOAP::WSDL::XSD::Typelib::Builtin',
51 },
52 namespace_map => {
53 },
54 prefix => {
55 interface => $self->get_interface_prefix,
56 element => $self->get_element_prefix,
57 attribute => $self->get_attribute_prefix,
58 server => $self->get_server_prefix,
59 type => $self->get_type_prefix,
60 typemap => $self->get_typemap_prefix,
61 }
62 }),
63 },
64 definitions => $self->get_definitions,
65 NO_POD => delete $arg_ref->{ NO_POD } ? 1 : 0 ,
66 %{ $arg_ref }
67 },
68 $output)
69 or croak $INCLUDE_PATH_of{ $ident }, '\\', $template, ' ', $tt->error();
70 }
71  
72 1;
73  
74 =pod
75  
76 =head1 NAME
77  
78 SOAP::WSDL::Generator::Template - Template-based code generator
79  
80 =head1 DESCRIPTION
81  
82 SOAP::WSDL's template based code generator
83  
84 Base class for writing template based generators
85  
86 =head1 AUTHOR
87  
88 Replace the whitespace by @ for E-Mail Address.
89  
90 Martin Kutter E<lt>martin.kutter fen-net.deE<gt>
91  
92 =head1 LICENSE AND COPYRIGHT
93  
94 Copyright 2008, 2009 Martin Kutter.
95  
96 This file is part of SOAP-WSDL. You may distribute/modify it under
97 the same terms as perl itself
98  
99 =head1 Repository information
100  
101 $Id: WSDLParser.pm 770 2009-01-24 22:55:54Z kutterma $
102  
103 $LastChangedDate: 2009-01-24 23:55:54 +0100 (Sa, 24 Jan 2009) $
104 $LastChangedRevision: 770 $
105 $LastChangedBy: kutterma $
106  
107 $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Expat/WSDLParser.pm $
108