blob: b12e8d9c9f7d6041c205e9bd58cf34dea5ccf3e3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package HomePanel::AsyncUA; use Moo; use namespace::autoclean; use Net::Async::HTTP; has loop => ( is => 'ro', required => 1, ); has agent => ( is => 'lazy', ); sub _build_agent { my ($self) = @_; my $agent = Net::Async::HTTP->new( max_connections_per_host => 1, stall_timeout => 10, ); $self->loop->add($agent); return $agent; } sub get { my ($self,$uri) = @_; return $self->agent->GET($uri)->get } 1;
|