SOAP::WSDL::XSD::Typelib::ComplexType - Base class for complexType node classes
To subclass, write a package like this:
package MyComplexType; use Class::Std::Storable 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<first_attr> :default<()>); my %second_attr_of :ATTR(:get<second_attr> :default<()>); my %third_attr_of :ATTR(:get<third_attr> :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 => \%first_attr_of, second_attr => \%second_attr_of, third_attr => \%third_attr_of, ); # classes_of: Classes the child elements should be of my %classes_of = ( first_attr => 'My::FirstElement', second_attr => 'My::SecondElement', third_attr => 'My::ThirdElement', ); # call _factory __PACKAGE__->_factory( \@elements_from, \%attributes_of, \%classes_of ); 1;
When subclassing, the following methods are created in the subclass:
Constructor. For your convenience, new will accept data for the object's properties in the following forms:
hash refs 1) of scalars 2) of list refs 3) of hash refs 4) of objects 5) mixed stuff of all of the above
new() will set the data via the set_FOO methods to the object's element properties.
Data passed to new must comply to the object's structure or new() will complain. Objects passed must be of the expected type, or new() will complain, too.
Examples:
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 ], });
The new() method from Class::Std will be overridden, so you should not rely on it's behaviour.
Your START and BUILD methods are called, but the class' inheritance tree is not traversed.
A mutator method for every element property.
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 GLOBS and filehandles.
This means you may set element properties by passing
a) objects b) scalars c) list refs d) hash refs e) mixed stuff of all of the above
Examples are similar to the examples provided for new() above.
Incomplete API
Not all variants of XML Schema ComplexType definitions are supported yet.
Variants known to work are:
sequence all complexContent containing sequence/all definitions
Thread safety
SOAP::WSDL::XSD::Typelib::Builtin uses Class::Std::Storable which uses Class::Std. Class::Std is not thread safe, so SOAP::WSDL::XSD::Typelib::Builtin is neither.
XML Schema facets
No facets are implemented yet.
Copyright 2004-2007 Martin Kutter.
This file is part of SOAP-WSDL. You may distribute/modify it under the same terms as perl itself
Martin Kutter <martin.kutter fen-net.de>
$Rev: 309 $ $LastChangedBy: kutterma $ $Id: ComplexType.pm 309 2007-10-05 17:48:37Z kutterma $ $HeadURL: http://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/XSD/Typelib/ComplexType.pm $
To install SOAP::WSDL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SOAP::WSDL
CPAN shell
perl -MCPAN -e shell install SOAP::WSDL
For more information on module installation, please visit the detailed CPAN module installation guide.