blib/lib/auto/share/dist/Beekeeper/scraper/lib/MyApp/Service/Scraper.pm untested

filter: Statementstmt 0.0% 0 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 24 CC 1 SCAR 6.9
CC
1
Cov
0%
get_title
2.0
get_title_async
2.0
BEGIN
2.0
CRAP 2.0
1 package MyApp::Service::Scraper;
2  
3 use strict;
4 use warnings;
5  
6 use Beekeeper::Client;
7  
8  
9 # These two implementations call exactly the same remote method
10  
11 sub get_title {
12 my ($self, $url) = @_;
13  
14 # This will block until a response is received
15  
16 my $client = Beekeeper::Client->instance;
17  
18 my $response = $client->call_remote(
19 method => 'myapp.scraper.get_title',
20 params => { url => $url },
21 raise_error => 0,
22 );
23  
24 return $response;
25 }
26  
27 sub get_title_async {
28 my ($self, $url, $on_complete) = @_;
29  
30 # This will return immediately. The response will be received asynchronously
31  
32 my $client = Beekeeper::Client->instance;
33  
34 my $request = $client->call_remote_async(
35 method => 'myapp.scraper.get_title',
36 params => { url => $url },
37 on_success => $on_complete,
38 on_error => $on_complete,
39 );
40  
41 return $request;
42 }
43  
44 1;