.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "SOAP::WSDL::XSD::Typelib::ComplexType 3pm" .TH SOAP::WSDL::XSD::Typelib::ComplexType 3pm "2020-01-20" "perl v5.30.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SOAP::WSDL::XSD::Typelib::ComplexType \- Base class for complexType node classes .SH "Subclassing" .IX Header "Subclassing" To subclass, write a package like this: .PP .Vb 3 \& package MyComplexType; \& use Class::Std::Fast::Storable constructor => \*(Aqnone\*(Aq; \& use base qw(SOAP::WSDL::XSD::Typelib::ComplexType); \& \& # we only need the :get attribute qualifier. \& # set and init_arg are automatically created by \& # SOAP::WSDL::XSD::Typelib::ComplexType \& my %first_attr_of :ATTR(:get :default<()>); \& my %second_attr_of :ATTR(:get :default<()>); \& my %third_attr_of :ATTR(:get :default<()>); \& \& # the order of elements in a complexType \& my @elements_from = qw(first_attr second_attr third_attr); \& \& # references to the private hashes \& my %attribute_of = ( \& first_attr => \e%first_attr_of, \& second_attr => \e%second_attr_of, \& third_attr => \e%third_attr_of, \& ); \& \& # classes_of: Classes the child elements should be of \& my %classes_of = ( \& first_attr => \*(AqMy::FirstElement\*(Aq, \& second_attr => \*(AqMy::SecondElement\*(Aq, \& third_attr => \*(AqMy::ThirdElement\*(Aq, \& ); \& \& # call _factory \& _\|_PACKAGE_\|_\->_factory( \& \e@elements_from, \& \e%attributes_of, \& \e%classes_of, \& ); \& \& 1; .Ve .PP When subclassing, the following methods are created in the subclass: .SS "new" .IX Subsection "new" Constructor. For your convenience, new will accept data for the object's properties in the following forms: .PP .Vb 6 \& hash refs \& 1) of scalars \& 2) of list refs \& 3) of hash refs \& 4) of objects \& 5) mixed stuff of all of the above .Ve .PP \&\fBnew()\fR will set the data via the set_FOO methods to the object's element properties. .PP Data passed to new must comply to the object's structure or \fBnew()\fR will complain. Objects passed must be of the expected type, or \fBnew()\fR will complain, too. .PP The special key \fBxmlattr\fR may be used to pass \s-1XML\s0 attributes. This key is chosen, because \*(L"xmlattr\*(R" cannot legally be used as \s-1XML\s0 name (it starts with \&\*(L"xml\*(R"). Passing a hash ref structure as value to \*(L"xmlattr\*(R" has the same effect as passing the same structure to a call to \f(CW\*(C`$obj\-\*(C'\fR\fBattr()\fR> .PP Examples: .PP .Vb 1 \& my $obj = MyClass\->new({ MyName => $value }); \& \& my $obj = MyClass\->new({ \& MyName => { \& DeepName => $value, \& }, \& MySecondName => $value, \& }); \& \& my $obj = MyClass\->new({ \& MyName => [ \& { DeepName => $value }, \& { DeepName => $other_value }, \& ], \& MySecondName => $object, \& MyThirdName => [ $object1, $object2 ], \& }); .Ve .PP my \f(CW$obj\fR = MyClass\->new({ xmlattr => { name => 'foo' }, MyName => { DeepName => \f(CW$value\fR, }, MySecondName => \f(CW$value\fR, }); .PP In case your building on Class::Std, please note the following limitations: .PP The \fBnew()\fR method from Class::Std will be overridden, so you should not rely on it's behaviour. .PP Your \s-1START\s0 and \s-1BUILD\s0 methods are called, but the class' inheritance tree is not traversed. .SS "set_FOO" .IX Subsection "set_FOO" A mutator method for every element property. .PP For your convenience, the set_FOO methods will accept all kind of data you can think of (and all combinations of them) as input \- with the exception of \s-1GLOBS\s0 and filehandles. .PP This means you may set element properties by passing .PP .Vb 5 \& a) objects \& b) scalars \& c) list refs \& d) hash refs \& e) mixed stuff of all of the above .Ve .PP Examples are similar to the examples provided for \fBnew()\fR above. .PP Note that you cannot delete a property by setting it to undef \- this sets the property to an empty property object (with value undef). .PP To delete a property, say: .PP .Vb 1 \& $obj\->set_FOO(); .Ve .SS "attr" .IX Subsection "attr" Returns / sets the attribute object associated with the object. \s-1XML\s0 Attributes are modeled as attribute objects \- their classes are usually private (i.e. part of the associated class' file, not in a separate file named after the attribute class). .PP Note that attribute support is still experimental. .SS "as_bool" .IX Subsection "as_bool" Returns the boolean value of the complexType (always true). .SS "as_hash_ref" .IX Subsection "as_hash_ref" Returns a hash ref representation of the complexType object .PP Attributes are included under the special key \*(L"xmlattr\*(R" (if any). .PP The inclusion of attributes can be suppressed by calling .PP .Vb 1 \& $obj\->as_has_ref(1); .Ve .PP or even globally by setting .PP .Vb 1 \& $SOAP::WSDL::XSD::Typelib::ComplexType::AS_HASH_REF_WITHOUT_ATTRIBUTES = 1; .Ve .PP Note that using the \f(CW$AS_HASH_REF_WITHOUT_ATTRIBUTES\fR global variable is strongly discouraged. Use of this variable is deprecated and will be removed as of version 2.1 .PP as_hash_ref can be used for deep cloning. The following statement creates a deep clone of a SOAP::WSDL::ComplexType\-based object .PP .Vb 1 \& my $clone = ref($obj)\->new($obj\->as_hash_ref()); .Ve .SS "serialize_attr" .IX Subsection "serialize_attr" Serialize a complexType's attributes .SS "serialize" .IX Subsection "serialize" Serialize a ComplexType object to \s-1XML.\s0 Exported via symbol table into derived classes. .SH "Bugs and limitations" .IX Header "Bugs and limitations" .IP "\(bu" 4 Incomplete \s-1API\s0 .Sp Not all variants of \s-1XML\s0 Schema ComplexType definitions are supported yet. .Sp Variants known to work are: .Sp .Vb 3 \& sequence \& all \& complexContent containing sequence/all definitions .Ve .IP "\(bu" 4 Thread safety .Sp SOAP::WSDL::XSD::Typelib::Builtin::ComplexType uses Class::Std::Fast::Storable which uses Class::Std. Class::Std is not thread safe, so SOAP::WSDL::XSD::Typelib::Builtin::ComplexType is neither. .IP "\(bu" 4 \&\s-1XML\s0 Schema facets .Sp No facets are implemented yet. .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright 2007 Martin Kutter. .PP This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself .SH "AUTHOR" .IX Header "AUTHOR" Martin Kutter .SH "REPOSITORY INFORMATION" .IX Header "REPOSITORY INFORMATION" .Vb 4 \& $Rev: 851 $ \& $LastChangedBy: kutterma $ \& $Id: ComplexType.pm 851 2009\-05\-15 22:45:18Z kutterma $ \& $HeadURL: https://soap\-wsdl.svn.sourceforge.net/svnroot/soap\-wsdl/SOAP\-WSDL/trunk/lib/SOAP/WSDL/XSD/Typelib/ComplexType.pm $ .Ve