Вячеслав Тихановский > Protocol-XMLRPC-0.10 > Protocol::XMLRPC::Value::Struct

Download:
Protocol-XMLRPC-0.10.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Protocol::XMLRPC::Value::Struct - XML-RPC struct

SYNOPSIS ^

    my $struct = Protocol::XMLRPC::Value::Struct->new(foo => 'bar');
    my $struct = Protocol::XMLRPC::Value::Struct->new({foo => 'bar'});
    my $struct =
      Protocol::XMLRPC::Value::Struct->new(
        foo => Protocol::XMLRPC::Value::String->new('bar'));

DESCRIPTION ^

XML-RPC struct

METHODS ^

new

Creates new Protocol::XMLRPC::Value::Struct instance. Elements can be provided as a hash or as a hash reference.

type

Returns 'struct'.

add_member

    $struct->add_member(foo => 'bar');
    $struct->add_member({foo => 'bar'});
    $struct->add_member(foo => Protocol::XMLRPC::Value::String->new('bar'));

Adds value to the struct. Can be Perl5 scalar or any Protocol::XMLRCP::Value::* instance, including another struct.

members

    my $struct = Protocol::XMLRPC::Value::Struct->new(foo => 'bar');
    my $members = $struct->members;

Returns hash reference where values are objects.

value

    my $struct = Protocol::XMLRPC::Value::Struct->new(foo => 'bar');
    my $structref = $struct->value;
    # $structref is now {foo => 'bar'}

Returns serialized Perl5 hash reference.

to_string

    my $struct = Protocol::XMLRPC::Value::Struct->new(foo => 'bar');
    my $string = $struct->to_string;
    # <struct>
    #   <member>
    #     <name>foo</name>
    #     <value><string>bar</string></value>
    #   </member>
    # </struct>'

XML-RPC struct string representation.

syntax highlighting: