1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| package Soap::Lite {
use Carp;
sub encode_hash {
my($self, $hash, $name, $type, $attr) = @_;
if ($self->autotype && grep {!/$SOAP::Constants::ELMASK/o} keys %$hash) {
$^W && warn ">>> $_" for split /\r?\n/, Carp::longmess(qq!Cannot encode @{[$name ? "'$name'" : 'unnamed']} element as 'hash'. Will be encoded as 'map' instead\n!);
return $self->as_map($hash, $name || gen_name, $type, $attr);
}
$type = 'SOAPStruct'
if $self->autotype && !defined($type) && exists $self->maptype->{SOAPStruct};
return [$name || gen_name,
$self->autotype ? {'xsi:type' => $self->maptypetouri($type), %$attr} : { %$attr },
[map {$self->encode_object($hash->{$_}, $_)} keys %$hash],
$self->gen_id($hash)
];
}
}; |
Partager