File Coverage

blib/lib/Gungho/Provider.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             # $Id: /mirror/gungho/lib/Gungho/Provider.pm 31310 2007-11-29T13:19:42.807767Z lestrrat $
2             #
3             # Copyright (c) 2007 Daisuke Maki <daisuke@endeworks.jp>
4             # All rights reserved.
5              
6             package Gungho::Provider;
7 1     1   587 use strict;
  1         2  
  1         20  
8 1     1   3 use warnings;
  1         1  
  1         20  
9 1     1   3 use base qw(Gungho::Base);
  1         1  
  1         30  
10 1     1   84 use Gungho::Request;
  0            
  0            
11              
12             __PACKAGE__->mk_accessors($_) for qw(has_requests);
13             __PACKAGE__->mk_virtual_methods($_) for qw(dispatch pushback_request);
14              
15             sub stop { }
16              
17             # XXX - Hmm, yank this method out?
18             sub dispatch_request
19             {
20             my ($self, $c, $req) = @_;
21             $c->log->debug("[PROVIDER]: Dispatch " . $req->uri);
22             $c->send_request($req);
23             }
24              
25             1;
26              
27             __END__
28              
29             =head1 NAME
30              
31             Gungho::Provider - Base Class For Gungho Prividers
32              
33             =head1 METHODS
34              
35             =head2 has_requests
36              
37             Returns true if there are still more requests to be processed.
38              
39             =head2 dispatch($c)
40              
41             Dispatch requests to be fetched to the Gungho framework
42              
43             =head2 dispatch_request($c, $req)
44              
45             Dispatch a single request
46              
47             =head2 pushback_request($c, $req)
48              
49             Push back a request which couldn't be sent to the engine, for example
50             because the request was throttled.
51              
52             =head2 stop($reason)
53              
54             Stop the Provider. Place code that needs to be executed to shutdown the
55             provider here.
56              
57             =cut