line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bot::ChatBots::Role::WebPoller; |
2
|
1
|
|
|
1
|
|
1033
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
4
|
|
|
|
|
|
|
{ our $VERSION = '0.014'; } |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
4
|
use Ouch; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
748
|
use IO::Socket::SSL (); |
|
1
|
|
|
|
|
60681
|
|
|
1
|
|
|
|
|
25
|
|
8
|
1
|
|
|
1
|
|
447
|
use Mojo::UserAgent; |
|
1
|
|
|
|
|
121435
|
|
|
1
|
|
|
|
|
12
|
|
9
|
1
|
|
|
1
|
|
38
|
use Log::Any qw< $log >; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
10
|
1
|
|
|
1
|
|
235
|
use Try::Tiny; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
47
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
4
|
use Moo::Role; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
13
|
1
|
|
|
1
|
|
778
|
use namespace::clean; |
|
1
|
|
|
|
|
7638
|
|
|
1
|
|
|
|
|
5
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Bot::ChatBots::Role::Poller'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has ua => (is => 'ro', default => sub { return Mojo::UserAgent->new }); |
18
|
|
|
|
|
|
|
has tx_args => (is => 'ro', required => 1); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub poll { |
21
|
0
|
|
|
0
|
1
|
|
my ($self, $on_data, $args) = @_; |
22
|
0
|
|
|
|
|
|
my $ua = $self->ua; |
23
|
0
|
|
|
|
|
|
my $tx = $ua->build_tx(@{$self->tx_args}); |
|
0
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
my $cb = sub { |
25
|
0
|
|
|
0
|
|
|
my ($ua, $tx) = @_; |
26
|
0
|
|
|
|
|
|
return $on_data->({tx => $tx, ua => $ua}); |
27
|
0
|
|
|
|
|
|
}; |
28
|
0
|
|
|
|
|
|
return $ua->start($tx, $cb); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |