File Coverage

blib/lib/W3C/SOAP/Parser.pm
Criterion Covered Total %
statement 24 24 100.0
branch n/a
condition n/a
subroutine 8 8 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             package W3C::SOAP::Parser;
2              
3             # Created on: 2012-05-27 18:58:29
4             # Create by: Ivan Wills
5             # $Id$
6             # $Revision$, $HeadURL$, $Date$
7             # $Revision$, $Source$, $Date$
8              
9 1     1   2369 use Moose;
  1         1  
  1         7  
10 1     1   4770 use warnings;
  1         3  
  1         26  
11 1     1   5 use version;
  1         2  
  1         6  
12 1     1   60 use Carp;
  1         2  
  1         54  
13 1     1   5 use Scalar::Util;
  1         2  
  1         26  
14 1     1   5 use List::Util;
  1         2  
  1         39  
15             #use List::MoreUtils;
16 1     1   4 use Data::Dumper qw/Dumper/;
  1         1  
  1         35  
17 1     1   4 use English qw/ -no_match_vars /;
  1         3  
  1         7  
18              
19             our $VERSION = version->new('0.11');
20              
21             has document => (
22             is => 'rw',
23             isa => 'W3C::SOAP::Document',
24             );
25             has template => (
26             is => 'rw',
27             isa => 'Template',
28             predicate => 'has_template',
29             );
30             has lib => (
31             is => 'rw',
32             isa => 'Str',
33             predicate => 'has_lib',
34             );
35              
36             around BUILDARGS => sub {
37             my ($orig, $class, @args) = @_;
38             my $args
39             = !@args ? {}
40             : @args == 1 ? $args[0]
41             : {@args};
42              
43             my $type = $class;
44             $type =~ s/Parser/Document/;
45              
46             for my $arg ( keys %$args ) {
47             if ( $arg eq 'location' || $arg eq 'string' ) {
48             $args->{document} = $type->new($args);
49             }
50             }
51              
52             return $class->$orig($args);
53             };
54              
55             1;
56              
57             __END__
58              
59             =head1 NAME
60              
61             W3C::SOAP::Parser - Base module for creating Moose objects from XML documents
62              
63             =head1 VERSION
64              
65             This documentation refers to W3C::SOAP::Parser version 0.11.
66              
67             =head1 SYNOPSIS
68              
69             # only used as a base
70             extends 'W3C::SOAP::Parser';
71              
72             =head1 DESCRIPTION
73              
74             This module parses a WSDL file so that it can produce a client to talk to the
75             SOAP service.
76              
77             =head1 SUBROUTINES/METHODS
78              
79             =head2 EXPORTED SUBROUTINES
80              
81             =over 4
82              
83             =item C<load_wsdl ($location)>
84              
85             Helper method that takes the supplied location and creates the dynamic WSDL
86             client object.
87              
88             =back
89              
90             =head2 CLASS METHODS
91              
92             =over 4
93              
94             =item C<new (%args)>
95              
96             Create the new object C<new> accepts the following arguments:
97              
98             =over 4
99              
100             =item location
101              
102             This is the location of the WSDL file, it may be a local file or a URL
103              
104             =item module
105              
106             This is the name of the module to be generated, it is required when writing
107             the SOAP client to disk, the dynamic client generator creates a semi random
108             namespace.
109              
110             =item lib
111              
112             The library directory where modules should be stored. only required when
113             calling C<write_modules>
114              
115             =item template
116              
117             The Template Toolkit object used for the generation of on disk modules
118              
119             =item ns_module_map
120              
121             The mapping of XSD namespaces to perl Modules.
122              
123             =back
124              
125             =back
126              
127             =head2 OBJECT METHODS
128              
129             =over 4
130              
131             =item C<<$wsdl->write_modules ()>>
132              
133             Writes out a module that is a SOAP Client to interface with the contained
134             WSDL document, also writes any referenced XSDs.
135              
136             =item C<<$wsdl->dynamic_classes ()>>
137              
138             Creates a dynamic SOAP client object to talk to the WSDL this object was
139             created for
140              
141             =item C<<$wsdl->get_xsd ()>>
142              
143             Creates the L<W3C::SOAP::XSD::Parser> object that represents the XSDs that
144             are used by the specified WSDL file.
145              
146             =back
147              
148             =head1 DIAGNOSTICS
149              
150             =head1 CONFIGURATION AND ENVIRONMENT
151              
152             =head1 DEPENDENCIES
153              
154             =head1 INCOMPATIBILITIES
155              
156             =head1 BUGS AND LIMITATIONS
157              
158             There are no known bugs in this module.
159              
160             Please report problems to Ivan Wills (ivan.wills@gmail.com).
161              
162             Patches are welcome.
163              
164             =head1 AUTHOR
165              
166             Ivan Wills - (ivan.wills@gmail.com)
167              
168             =head1 LICENSE AND COPYRIGHT
169              
170             Copyright (c) 2012 Ivan Wills (14 Mullion Close, Hornsby Heights, NSW Australia 2077).
171             All rights reserved.
172              
173             This module is free software; you can redistribute it and/or modify it under
174             the same terms as Perl itself. See L<perlartistic>. This program is
175             distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
176             without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
177             PARTICULAR PURPOSE.
178              
179             =cut