>
> my $time;
> $ua->get('/time', sub {
> my ($ua, $tx) = @_;
>
> $time = $tx->res->json->{now};
> });
>
> Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
>
> say $time;
>
For this specific case you could just use a promise.
my $time;
$ua->get_p('/time')->then(sub { $time = $tx->res->json->{now} })->wait;
say $time;
--
sebastian
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.