Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Clean version

  • Loading branch information...
commit 0e6478932d4b7147ca74d1185f6d6d01597f4d3b 1 parent 17c07a5
@Akron authored
Showing with 4 additions and 8 deletions.
  1. +4 −8 lib/Mojolicious/Plugin/Piwik.pm
View
12 lib/Mojolicious/Plugin/Piwik.pm
@@ -261,19 +261,15 @@ SCRIPTTAG
# Create delay object
my $delay = Mojo::IOLoop->delay(
sub {
- my $tx = pop;
-
- my $json = {};
-
# Return prepared response
- my $res = $tx->success;
- $json = _prepare_response($res) if $res;
+ my $res = pop->success;
- # Release callback
- $cb->($json);
+ # Release callback with json object
+ $cb->( $res ? _prepare_response($res) : {} );
}
);
+ # Get resource non-blocking
$ua->get($url => $delay->begin);
# Start IOLoop if not started already
Please sign in to comment.
Something went wrong with that request. Please try again.