summaryrefslogtreecommitdiff
path: root/lib/HomePanel/AsyncUA.pm
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2013-11-07 15:47:30 +0000
committerGianni Ceccarelli <gianni.ceccarelli@net-a-porter.com>2013-11-07 15:47:30 +0000
commitbca9739f92c1da13eb709763af7e6c866c8b72f5 (patch)
treed76efd7fc0ee096c45c3a2fcb29cf965b7afdef4 /lib/HomePanel/AsyncUA.pm
parentAbsFile for existing files (diff)
downloadHomePanel-bca9739f92c1da13eb709763af7e6c866c8b72f5.tar.gz
HomePanel-bca9739f92c1da13eb709763af7e6c866c8b72f5.tar.bz2
HomePanel-bca9739f92c1da13eb709763af7e6c866c8b72f5.zip
full async driver
Diffstat (limited to 'lib/HomePanel/AsyncUA.pm')
-rw-r--r--lib/HomePanel/AsyncUA.pm31
1 files changed, 31 insertions, 0 deletions
diff --git a/lib/HomePanel/AsyncUA.pm b/lib/HomePanel/AsyncUA.pm
new file mode 100644
index 0000000..b12e8d9
--- /dev/null
+++ b/lib/HomePanel/AsyncUA.pm
@@ -0,0 +1,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;