Perl newbie here. I have a line of code:
my $api_data = decode_json( $ua->get($url)->res->body );
where $ua = Mojo::UserAgent->new
. On occasion, the request may hang (indefinitely) and I'd like to specify a connection timeout.
The documentation provides an example, but I'm not exactly sure how to incorporate it correctly into my statement.
How should I use connect_timeout
in this case? I understand that Mojo specifies a default connection timeout value (10), but I'd rather specify it explicitly in the code.