1SOAP::WSDL::XSD::TypeliUbs:e:rCoCmopnlterxiTbyuptee(d3S)POeArPl::DWoScDuLm:e:nXtSaDt:i:oTnypelib::ComplexType(3)
2
3
4

NAME

6       SOAP::WSDL::XSD::Typelib::ComplexType - Base class for complexType node
7       classes
8

Subclassing

10       To subclass, write a package like this:
11
12        package MyComplexType;
13        use Class::Std::Fast::Storable constructor => 'none';
14        use base qw(SOAP::WSDL::XSD::Typelib::ComplexType);
15
16        # we only need the :get attribute qualifier.
17        # set and init_arg are automatically created by
18        # SOAP::WSDL::XSD::Typelib::ComplexType
19        my %first_attr_of   :ATTR(:get<first_attr>  :default<()>);
20        my %second_attr_of  :ATTR(:get<second_attr> :default<()>);
21        my %third_attr_of   :ATTR(:get<third_attr>  :default<()>);
22
23        # the order of elements in a complexType
24        my @elements_from = qw(first_attr second_attr third_attr);
25
26        # references to the private hashes
27        my %attribute_of = (
28           first_attr  => \%first_attr_of,
29           second_attr => \%second_attr_of,
30           third_attr  => \%third_attr_of,
31        );
32
33        # classes_of: Classes the child elements should be of
34        my %classes_of = (
35           first_attr  => 'My::FirstElement',
36           second_attr => 'My::SecondElement',
37           third_attr  => 'My::ThirdElement',
38        );
39
40        # call _factory
41        __PACKAGE__->_factory(
42           \@elements_from,
43           \%attributes_of,
44           \%classes_of,
45        );
46
47        1;
48
49       When subclassing, the following methods are created in the subclass:
50
51   new
52       Constructor. For your convenience, new will accept data for the
53       object's properties in the following forms:
54
55        hash refs
56        1) of scalars
57        2) of list refs
58        3) of hash refs
59        4) of objects
60        5) mixed stuff of all of the above
61
62       new() will set the data via the set_FOO methods to the object's element
63       properties.
64
65       Data passed to new must comply to the object's structure or new() will
66       complain. Objects passed must be of the expected type, or new() will
67       complain, too.
68
69       The special key xmlattr may be used to pass XML attributes. This key is
70       chosen, because "xmlattr" cannot legally be used as XML name (it starts
71       with "xml"). Passing a hash ref structure as value to "xmlattr" has the
72       same effect as passing the same structure to a call to "$obj-"attr()>
73
74       Examples:
75
76        my $obj = MyClass->new({ MyName => $value });
77
78        my $obj = MyClass->new({
79            MyName => {
80                DeepName => $value,
81            },
82            MySecondName => $value,
83        });
84
85        my $obj = MyClass->new({
86            MyName => [
87               { DeepName => $value },
88               { DeepName => $other_value },
89            ],
90            MySecondName => $object,
91            MyThirdName => [ $object1, $object2 ],
92        });
93
94       my $obj = MyClass->new({
95            xmlattr => { name => 'foo' },
96            MyName => {
97                DeepName => $value,
98            },
99            MySecondName => $value,
100        });
101
102       In case your building on Class::Std, please note the following
103       limitations:
104
105       The new() method from Class::Std will be overridden, so you should not
106       rely on it's behaviour.
107
108       Your START and BUILD methods are called, but the class' inheritance
109       tree is not traversed.
110
111   set_FOO
112       A mutator method for every element property.
113
114       For your convenience, the set_FOO methods will accept all kind of data
115       you can think of (and all combinations of them) as input - with the
116       exception of GLOBS and filehandles.
117
118       This means you may set element properties by passing
119
120        a) objects
121        b) scalars
122        c) list refs
123        d) hash refs
124        e) mixed stuff of all of the above
125
126       Examples are similar to the examples provided for new() above.
127
128       Note that you cannot delete a property by setting it to undef - this
129       sets the property to an empty property object (with value undef).
130
131       To delete a property, say:
132
133        $obj->set_FOO();
134
135   attr
136       Returns / sets the attribute object associated with the object. XML
137       Attributes are modeled as attribute objects - their classes are usually
138       private (i.e.  part of the associated class' file, not in a separate
139       file named after the attribute class).
140
141       Note that attribute support is still experimental.
142
143   as_bool
144       Returns the boolean value of the complexType (always true).
145
146   as_hash_ref
147       Returns a hash ref representation of the complexType object
148
149       Attributes are included under the special key "xmlattr" (if any).
150
151       The inclusion of attributes can be suppressed by calling
152
153        $obj->as_has_ref(1);
154
155       or even globally by setting
156
157        $SOAP::WSDL::XSD::Typelib::ComplexType::AS_HASH_REF_WITHOUT_ATTRIBUTES = 1;
158
159       Note that using the $AS_HASH_REF_WITHOUT_ATTRIBUTES global variable is
160       strongly discouraged. Use of this variable is deprecated and will be
161       removed as of version 2.1
162
163       as_hash_ref can be used for deep cloning. The following statement
164       creates a deep clone of a SOAP::WSDL::ComplexType-based object
165
166        my $clone = ref($obj)->new($obj->as_hash_ref());
167
168   serialize_attr
169       Serialize a complexType's attributes
170
171   serialize
172       Serialize a ComplexType object to XML. Exported via symbol table into
173       derived classes.
174

Bugs and limitations

176       •   Incomplete API
177
178           Not all variants of XML Schema ComplexType definitions are
179           supported yet.
180
181           Variants known to work are:
182
183            sequence
184            all
185            complexContent containing sequence/all definitions
186
187       •   Thread safety
188
189           SOAP::WSDL::XSD::Typelib::Builtin::ComplexType uses
190           Class::Std::Fast::Storable which uses Class::Std. Class::Std is not
191           thread safe, so SOAP::WSDL::XSD::Typelib::Builtin::ComplexType is
192           neither.
193
194       •   XML Schema facets
195
196           No facets are implemented yet.
197
199       Copyright 2007 Martin Kutter.
200
201       This file is part of SOAP-WSDL. You may distribute/modify it under the
202       same terms as perl itself
203

AUTHOR

205       Martin Kutter <martin.kutter fen-net.de>
206

REPOSITORY INFORMATION

208        $Rev: 851 $
209        $LastChangedBy: kutterma $
210        $Id: ComplexType.pm 851 2009-05-15 22:45:18Z kutterma $
211        $HeadURL: https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/XSD/Typelib/ComplexType.pm $
212
213
214
215perl v5.36.0                      2023-S0O1A-P2:0:WSDL::XSD::Typelib::ComplexType(3)
Impressum