Connection/Future.pm untested

filter: Statementstmt 0.0% 0 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 33 CC 1 SCAR 6.9
CC
1
Cov
0%
request
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Apache::Tika::Connection::Future;
2 use 5.020;
3 use Future::HTTP;
4 use Moo;
5 with 'Apache::Tika::Connection';
6  
7 #use Filter::signatures;
8 use feature 'signatures';
9 no warnings 'experimental::signatures';
10  
11 our $VERSION = '0.11';
12  
13 has ua => (
14 is => 'ro',
15 default => sub {
16 return Future::HTTP->new()
17 },
18 );
19  
20 sub request( $self, $method, $url, $content, @headers ) {
21 # Should initialize
22  
23 $method = uc $method;
24  
25 my $content_size = length $content;
26  
27 # 'text/plain' for the language
28 my %headers= (
29 "Content-Length" => $content_size,
30 "Accept" => 'application/json,text/plain',
31 'Content-Type' => 'application/octet-stream',
32 @headers
33 );
34  
35 $self->ua->http_request(
36 $method => $url,
37 persistent => 1,
38 headers => \%headers,
39 body => $content,
40 )->then(sub( $body, $headers ) {
41 # The headers might be invalid!
42 my ( $code, $response ) = $self->process_response(
43 undef, # request
44 delete $headers->{Status}, # code
45 delete $headers->{Reason}, # msg
46 $body, # body
47 $headers # headers
48 );
49 Future->done( $code, $response )
50 });
51 }
52  
53 1;
54  
55 =head1 REPOSITORY
56  
57 The public repository of this module is
58 L<https://github.com/Corion/Apache-Tika-Async>.
59  
60 =head1 SUPPORT
61  
62 The public support forum of this module is
63 L<https://perlmonks.org/>.
64  
65 =head1 BUG TRACKER
66  
67 Please report bugs in this module via the RT CPAN bug queue at
68 L<https://rt.cpan.org/Public/Dist/Display.html?Name=Apache-Tika-Async>
69 or via mail to L<apache-tika-async-Bugs@rt.cpan.org>.
70  
71 =head1 AUTHOR
72  
73 Max Maischein C<corion@cpan.org>
74  
75 =head1 COPYRIGHT (c)
76  
77 Copyright 2014-2019 by Max Maischein C<corion@cpan.org>.
78  
79 =head1 LICENSE
80  
81 This module is released under the same terms as Perl itself.
82  
83 =cut