Skip to content

Commit

Permalink
Exporter may respond with a structure now
Browse files Browse the repository at this point in the history
  • Loading branch information
lkundrak committed Jul 21, 2011
1 parent 8e05d5c commit 937cf96
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/WWW/GoodData.pm
Expand Up @@ -369,12 +369,18 @@ sub export_report
report => $self->compute_report ($report) }}
);

# This is for new release, where location is finally set correctly;
$result = $result->{uri} if ref $result eq 'HASH';

# Trigger the export
my $exported = $self->poll (
sub { $self->{agent}->get ($result) },
sub { shift->{raw} ne 'null' }
sub { $_[0] and exists $_[0]->{raw} and $_[0]->{raw} ne 'null' }
) or die 'Timed out waiting for report to export';

# Follow the link
$exported = $self->{agent}->get ($exported->{uri}) if exists $exported->{uri};

# Gotten the correctly coded result?
return $exported->{raw} if $exported->{type} eq {
png => 'image/png',
Expand Down

0 comments on commit 937cf96

Please sign in to comment.