GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
SOAP::WSDL::XSD::Typelib::ComplexType(3) User Contributed Perl Documentation SOAP::WSDL::XSD::Typelib::ComplexType(3)

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

To subclass, write a package like this:

 package MyComplexType;
 use Class::Std::Fast::Storable constructor => 'none';
 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.

The special key xmlattr may be used to pass XML attributes. This key is chosen, because "xmlattr" cannot legally be used as XML name (it starts with "xml"). Passing a hash ref structure as value to "xmlattr" has the same effect as passing the same structure to a call to "$obj-"attr()>

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 ],
 });

my $obj = MyClass->new({ xmlattr => { name => 'foo' }, MyName => { DeepName => $value, }, MySecondName => $value, });

In case your building on Class::Std, please note the following limitations:

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.

Note that you cannot delete a property by setting it to undef - this sets the property to an empty property object (with value undef).

To delete a property, say:

 $obj->set_FOO();

Returns / sets the attribute object associated with the object. XML 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).

Note that attribute support is still experimental.

Returns the boolean value of the complexType (always true).

Returns a hash ref representation of the complexType object

Attributes are included under the special key "xmlattr" (if any).

The inclusion of attributes can be suppressed by calling

 $obj->as_has_ref(1);

or even globally by setting

 $SOAP::WSDL::XSD::Typelib::ComplexType::AS_HASH_REF_WITHOUT_ATTRIBUTES = 1;

Note that using the $AS_HASH_REF_WITHOUT_ATTRIBUTES global variable is strongly discouraged. Use of this variable is deprecated and will be removed as of version 2.1

as_hash_ref can be used for deep cloning. The following statement creates a deep clone of a SOAP::WSDL::ComplexType-based object

 my $clone = ref($obj)->new($obj->as_hash_ref());

Serialize a complexType's attributes

Serialize a ComplexType object to XML. Exported via symbol table into derived classes.

  • 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::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.

  • XML Schema facets

    No facets are implemented yet.

Copyright 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: 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 $
2020-01-20 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.