File Coverage

lib/SOAP/WSDL/SOAP/Typelib/Fault11.pm
Criterion Covered Total %
statement 16 18 88.8
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 24 91.6


line stmt bran cond sub pod time code
1             package SOAP::WSDL::SOAP::Typelib::Fault11;
2             {
3 7     7   655580 use strict;
  7         29  
  7         277  
4 7     7   42 use warnings;
  7         13  
  7         264  
5 7     7   3435 use Class::Std::Fast::Storable constructor => 'none';
  7         113832  
  7         51  
6              
7 7     7   956 use version; our $VERSION = qv('3.001');
  7         13  
  7         43  
8              
9 7     7   567 use Scalar::Util qw(blessed);
  7         12  
  7         651  
10              
11 7     7   144684 use SOAP::WSDL::XSD::Typelib::ComplexType;
  0            
  0            
12             use SOAP::WSDL::XSD::Typelib::Element;
13              
14             use base qw(
15             SOAP::WSDL::SOAP::Typelib::Fault
16             SOAP::WSDL::XSD::Typelib::Element
17             SOAP::WSDL::XSD::Typelib::ComplexType
18             );
19              
20             my %faultcode_of : ATTR(:get);
21             my %faultstring_of : ATTR(:get);
22             my %faultactor_of : ATTR(:get);
23             my %detail_of : ATTR(:get);
24              
25             __PACKAGE__->_factory(
26             [qw(faultcode faultstring faultactor detail)],
27             {
28             faultcode => \%faultcode_of,
29             faultstring => \%faultstring_of,
30             faultactor => \%faultactor_of,
31             detail => \%detail_of,
32             },
33             {
34             faultcode => 'SOAP::WSDL::XSD::Typelib::Builtin::QName',
35             faultstring => 'SOAP::WSDL::XSD::Typelib::Builtin::string',
36             faultactor => 'SOAP::WSDL::XSD::Typelib::Builtin::anyURI',
37             detail => 'SOAP::WSDL::SOAP::Typelib::Fault11Detail',
38             } );
39              
40             sub get_xmlns { return 'http://schemas.xmlsoap.org/soap/envelope/' }
41              
42             __PACKAGE__->__set_name('Fault');
43             __PACKAGE__->__set_nillable(0);
44             __PACKAGE__->__set_minOccurs();
45             __PACKAGE__->__set_maxOccurs();
46             __PACKAGE__->__set_ref('');
47              
48             # always return false in boolean context - a fault is never true...
49             sub as_bool : BOOLIFY {
50             return;
51             }
52              
53             # override set_detail to allow "auto-vivification" of a details object
54             # must be implemented via symbol table operation - _factory adds
55             # methods via symbol table, too.
56              
57             # BLOCK to scope warnings
58             {
59             no warnings qw(redefine);
60             my $set_detail_sub = \&set_detail;
61             *set_detail = sub {
62             my ( $self, $detail ) = @_;
63              
64             # create SOAP::WSDL::SOAP::Typelib::Fault11Detail wrapper if there
65             # is none
66             if ( not blessed $detail
67             or
68             not $detail->isa('SOAP::WSDL::SOAP::Typelib::Fault11Detail') )
69             {
70             $detail = SOAP::WSDL::SOAP::Typelib::Fault11Detail->new(
71             {value => $detail} );
72             }
73              
74             # call original method
75             $set_detail_sub->( $self, $detail );
76             };
77             }
78             Class::Std::initialize();
79             }
80              
81             package SOAP::WSDL::SOAP::Typelib::Fault11Detail;
82             {
83             use strict;
84             use warnings;
85             use Class::Std::Fast::Storable constructor => 'none';
86             use base qw(
87             SOAP::WSDL::XSD::Typelib::Element
88             SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType
89             );
90              
91             sub get_xmlns { return 'http://schemas.xmlsoap.org/soap/envelope/' }
92              
93             __PACKAGE__->__set_name('Fault');
94             __PACKAGE__->__set_nillable(0);
95             __PACKAGE__->__set_minOccurs();
96             __PACKAGE__->__set_maxOccurs();
97             Class::Std::initialize();
98             }
99              
100             1;
101              
102             =pod
103              
104             =head1 NAME
105              
106             SOAP::WSDL::SOAP::Typelib::Fault11 - SOAP 1.1 Fault class
107              
108             =head1 DESCRIPTION
109              
110             Models a SOAP 1.1 Fault.
111              
112             SOAP::WSDL::SOAP::Typelib::Fault11 objects are false in boolean context
113             and serialize to XML on stringification.
114              
115             This means you can do something like:
116              
117             my $soap = SOAP::WSDL::Client->new();
118             # ...
119             my $result = $soap->call($method, $data);
120             if (not $result) {
121             die "Error calling SOAP method: ", $result->get_faultstring();
122             }
123              
124             =head1 METHODS
125              
126             =head2 get_faultcode / set_faultcode
127              
128             Getter/setter for object's faultcode property.
129              
130             =head2 get_faultstring / set_faultstring
131              
132             Getter/setter for object's faultstring property.
133              
134             =head2 get_faultactor / set_faultactor
135              
136             Getter/setter for object's faultactor property.
137              
138             =head2 get_detail / set_detail
139              
140             Getter/setter for detail object's detail property.
141              
142             The detail element is a SOAP::WSDL::SOAP::Typelib::Fault11Detail object.
143             This class is automatically loaded when using
144             SOAP::WSDL::SOAP::Typelib::Fault11, so you can't B it separately.
145              
146             Any string or object not of this class will be automatically wrapped into
147             a detail object.
148              
149             Note that passing a list of detail object is currently not supported (though
150             the SOAP1.1 note allows this).
151              
152             =head1 LICENSE AND COPYRIGHT
153              
154             Copyright 2007 Martin Kutter. All rights reserved.
155              
156             This file is part of SOAP-WSDL. You may distribute/modify it under
157             the same terms as perl itself
158              
159             =head1 AUTHOR
160              
161             Martin Kutter Emartin.kutter fen-net.deE
162              
163             =head1 REPOSITORY INFORMATION
164              
165             $Rev: 851 $
166             $LastChangedBy: kutterma $
167             $Id: Fault11.pm 851 2009-05-15 22:45:18Z kutterma $
168             $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/SOAP/Typelib/Fault11.pm $
169              
170             =cut
171