File Coverage

lib/SOAP/WSDL/SOAP/Typelib/Fault11.pm
Criterion Covered Total %
statement 41 46 89.1
branch 0 2 0.0
condition 0 3 0.0
subroutine 15 17 88.2
pod 1 2 50.0
total 57 70 81.4


line stmt bran cond sub pod time code
1             package SOAP::WSDL::SOAP::Typelib::Fault11;
2             {
3 7     7   13783 use strict;
  7         29  
  7         177  
4 7     7   40 use warnings;
  7         6  
  7         147  
5 7     7   1208 use Class::Std::Fast::Storable constructor => 'none';
  7         46990  
  7         36  
6              
7             our $VERSION = 3.003;
8              
9 7     7   723 use Scalar::Util qw(blessed);
  7         9  
  7         384  
10              
11 7     7   2620 use SOAP::WSDL::XSD::Typelib::ComplexType;
  7         16  
  7         177  
12 7     7   2249 use SOAP::WSDL::XSD::Typelib::Element;
  7         11  
  7         179  
13              
14 7         2130 use base qw(
15             SOAP::WSDL::SOAP::Typelib::Fault
16             SOAP::WSDL::XSD::Typelib::Element
17             SOAP::WSDL::XSD::Typelib::ComplexType
18 7     7   27 );
  7         6  
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 5     5 0 10 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 3     3 1 188 return;
51 7     7   27 }
  7         13  
  7         27  
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 7     7   1034 no warnings qw(redefine);
  7         14  
  7         866  
60             my $set_detail_sub = \&set_detail;
61             *set_detail = sub {
62 0     0     my ( $self, $detail ) = @_;
63              
64             # create SOAP::WSDL::SOAP::Typelib::Fault11Detail wrapper if there
65             # is none
66 0 0 0       if ( not blessed $detail
67             or
68             not $detail->isa('SOAP::WSDL::SOAP::Typelib::Fault11Detail') )
69             {
70 0           $detail = SOAP::WSDL::SOAP::Typelib::Fault11Detail->new(
71             {value => $detail} );
72             }
73              
74             # call original method
75 0           $set_detail_sub->( $self, $detail );
76             };
77             }
78             Class::Std::initialize();
79             }
80              
81             package SOAP::WSDL::SOAP::Typelib::Fault11Detail;
82             {
83 7     7   26 use strict;
  7         13  
  7         190  
84 7     7   25 use warnings;
  7         7  
  7         128  
85 7     7   20 use Class::Std::Fast::Storable constructor => 'none';
  7         8  
  7         22  
86 7         860 use base qw(
87             SOAP::WSDL::XSD::Typelib::Element
88             SOAP::WSDL::XSD::Typelib::Builtin::anySimpleType
89 7     7   624 );
  7         9  
90              
91 0     0     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