lib/Myriad/Transport/HTTP.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Myriad/Subscription/Implementation/Redis.pm ↑ Summary lib/Myriad/Transport/Memory.pm »
1 package Myriad::Transport::HTTP;
2  
3 1 ▶use Myriad::Class extends => 'IO::Async::Notifier';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 our $VERSION = '1.001'; # VERSION
6 our $AUTHORITY = 'cpan:DERIV'; # AUTHORITY
7  
8 1 ▶use Net::Async::HTTP;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Net::Async::HTTP::Server;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 has $client;
12 has $server;
13 has $listener;
14 has $requests;
15 has $ryu;
16  
17 method configure (%args) {
18  
19 }
20  
21 method on_request ($srv, $req) {
22 $requests->emit($req);
23 }
24  
25 method listen_port () { 80 }
26  
27 method _add_to_loop ($) {
28 $self->next::method;
29  
30 $self->add_child(
31 $ryu = Ryu::Async->new
32 );
33 $requests = $ryu->source;
34  
35 $self->add_child(
36 $client = Net::Async::HTTP->new(
37 )
38 );
39 $self->add_child(
40 $server = Net::Async::HTTP::Server->new(
41 on_request => $self->curry::weak::on_request,
42 )
43 );
44 $listener = $server->listen(
45 addr => {
46 family => 'inet',
47 socktype => 'stream',
48 port => $self->listen_port,
49 }
50 );
51 }
52  
53 1;
54  
55 =head1 AUTHOR
56  
57 Deriv Group Services Ltd. C<< DERIV@cpan.org >>
58  
59 =head1 LICENSE
60  
61 Copyright Deriv Group Services Ltd 2020-2022. Licensed under the same terms as Perl itself.
62  
« lib/Myriad/Subscription/Implementation/Redis.pm ↑ Summary lib/Myriad/Transport/Memory.pm »