【发布时间】:2012-01-07 02:30:37
【问题描述】:
我正在使用 Data::Dumper 通过 SOAP 消息从服务器检索信息,并且需要一些帮助来分配返回值以进行处理。我的代码是:
my $cm = new SOAP::Lite
encodingStyle => '',
uri => "$axltoolkit",
proxy => "https://$cucmip:$axl_port/axl/";
my $res =$cm->getUser(SOAP::Data->name('userid' => "387653"));
unless ($res->fault) {
$Data::Dumper::Incident=3;
my( $reply ) = $res->paramsall();
my ($devices) = $reply->{user}{associatedDevices}{device};
print $devices->[0]."\n";
print $devices->[1]."\n";
print $devices->[2]."\n";
{device} 可以包含任意数量的元素,因此不是调用 $devices->[0],[1] 等 - 是否可以吐出所有返回的设备?我试过 $_ 和 @_ 但没有运气,因为它只返回第一个设备。
感谢任何帮助。
谢谢
【问题讨论】:
-
只需应用来自perldoc.perl.org/perlreftut.html#Using-References的“使用规则1”
标签: perl soap data-dumper