File Coverage

lib/Geo/Coder/Many/Scheduler.pm
Criterion Covered Total %
statement 10 14 71.4
branch n/a
condition n/a
subroutine 4 8 50.0
pod 5 5 100.0
total 19 27 70.3


line stmt bran cond sub pod time code
1             package Geo::Coder::Many::Scheduler;
2              
3 2     2   9 use strict;
  2         2  
  2         46  
4 2     2   5 use warnings;
  2         2  
  2         32  
5 2     2   5 use Carp;
  2         2  
  2         244  
6              
7             our $VERSION = '0.01';
8              
9             =head1 NAME
10              
11             Scheduler - Abstract base class for schedulers.
12              
13             =head1 DESCRIPTION
14              
15             Abstract base class for schedulers. Should not be instantiated directly.
16              
17             =head1 METHODS
18              
19             =head2 new
20              
21             Should never be called; subclasses should override.
22              
23             =cut
24              
25             sub new {
26 0     0 1 0 croak "Scheduler should not be instantiated directly: use a subclass.";
27             }
28              
29             =head2 get_next_unique
30              
31             get_next_unique should return the next scheduled item, according to whatever
32             scheduling scheme the subclass implements. The same item should *not* be
33             returned more than once between calls to reset_available.
34              
35             =cut
36              
37             sub get_next_unique {
38 0     0 1 0 croak "get_next_unique must be overridden.";
39             }
40              
41             =head2 next_available
42              
43             If there are items in the scheduler that have not already been dispensed since
44             the last call to 'reset_available', next_available should return the minimum
45             amount of time (in floating seconds) until one of them might become available.
46              
47             If there will never be any such items available, it should return -1.
48              
49             In Geo::Coder::Many, next_available is used to tell the result-picker
50             whether it is worth waiting for more results.
51              
52             =cut
53              
54             sub next_available {
55 0     0 1 0 croak "next_available must be overridden.";
56             }
57              
58             =head2 reset_available
59              
60             This is called in order to indicate that all items should once more be made
61             available.
62              
63             =cut
64              
65             sub reset_available {
66 0     0 1 0 croak "reset_available must be overridden.";
67             }
68              
69             =head2 process_feedback
70              
71             This is called to provide information about the performance of a geocoder. Does
72             nothing by default.
73              
74             =cut
75              
76             sub process_feedback {
77 674     674 1 956 return;
78             }
79              
80             1;
81              
82             __END__