in reply to How to access elements that SOAP::Lite Returns

have you tried my $report = $res->result;? That should give you the unwrapped data structure, which should look roughly like:
$VAR1 = { 'ClickFraudReport' => { 'Name' => 'Click Fraud Report', 'TimeRange' => 'Thursday, November 23, 2006 - Wednesday, Novem +ber 29, 2006'. 'Campaigns' => [ { 'Name' => 'Google 140', 'Cost' => '$330.14', # etc }, { # etc }, ], }, };
That means you can loop over the campaigns by doing:
my $report = $res->result; foreach my $campaign ( @{ $report->{ClickFraudReport}{Campaigns} } ) { print $campaign->{Name}; print $campaign->{Cost}; }

See the SOAP::Lite docs for more info. Specifically read the section on the call() method.

Replies are listed 'Best First'.
Re^2: How to access elements that SOAP::Lite Returns
by Anonymous Monk on Dec 01, 2006 at 02:38 UTC
    Thanks, That was really helpful. The choices SOAP::Lite makes for the data structure seem entirely random (Hash or Array?!!) and unpredictable to me, so I just chose to get XML and parse it this way. It works for now. I'm open to more elegant solutions, but it works.
    foreach my $campaign (@{$output->{'SOAP-ENV:Body'}->{APIResponse}->{ClickFraudReport}-> +{Campaigns}->{Campaign}} ) { print "\n\n"; print " Campaign: $campaign->{Name}\n"; print " Cost: $campaign->{Cost}\n"; ...