my $xml_response_object = $xs->XMLin($response->content, forcearray => 1);
####
my $xs = XML::Simple->new;
my $xml_response_object = $xs->XMLin($response->content, forcearray => 1);
##
##
print Dumper($response);
Response Dump: $VAR1 = {
'Preroll' => [
{
'Length' => [ '4' ],
'TrackingId' => [ 'null:414' ],
'CompanionId' => [ 'N/A' ],
'Creative' => [ 'Preroll_30sec' ],
'Impression' => [ 'TBD' ],
'Completion' => [ 'http://192.168.0.1:80/foo/bar' ]
}
],
'Midroll' => [
{
'Length' => [ '5' ],
'TrackingId' => [ 'null:416' ],
'CompanionId' => [ 'N/A' ],
'Creative' => [ 'Midroll_45sec_2' ],
'Impression' => [ 'TBD' ],
'Completion' => [ 'http://192.168.0.1:80/foo/bar' ]
},
{
'Length' => [ '5' ],
'TrackingId' => [ 'null:415' ],
'CompanionId' => [ 'N/A' ],
'Creative' => [ 'Midroll_45sec_1' ],
'Impression' => [ 'TBD' ],
'Completion' => [ 'http://192.168.0.1:80/foo/bar' ]
},
{
'Length' => [ '5' ],
'TrackingId' => [ 'null:417' ],
'CompanionId' => [ 'N/A' ],
'Creative' => [ 'Midroll_45sec_3' ],
'Impression' => [ 'TBD' ],
'Completion' => [ 'http://192.168.0.1:80/foo/bar' ]
}
],
'Postroll' => [
{
'Length' => [ '6' ],
'TrackingId' => [ 'null:418' ],
'CompanionId' => [ 'N/A' ],
'Creative' => [ 'Postroll_60sec' ],
'Impression' => [ 'TBD' ],
'Completion' => [ 'http://192.168.0.1:80/foo/bar' ]
}
]
};
##
##
foreach my $asset_type ( keys %{$response} ) {
$logger->debug("Starting asset_type $asset_type");
my $i = 0;
while ($response->{$asset_type}->[$i]) {
$logger->debug("\t$asset_type $i:");
foreach my $param ( keys %{($response->{$asset_type}->[$i])}) { # each $i is a hash ref
$logger->debug("\t\t$param = $response->{$asset_type}->[$i]->{$param}->[0]");
}
$i++;
}
}