| 1 | package Geo::Coder::Many::Generic; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | ▶ | use Geo::Coder::Many::Response; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 1 | our $VERSION = '0.01'; | |
| 10 | |||
| 11 | =head1 NAME | ||
| 12 | |||
| 13 | Geo::Coder::Many::Generic - Base plugin class | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | Base class for Geo::Coder::Many::* (Geo::Coder wrapper) classes | ||
| 18 | |||
| 19 | =head1 METHODS | ||
| 20 | |||
| 21 | =head2 new | ||
| 22 | |||
| 23 | Construct and return a new instance of the class. | ||
| 24 | Arguments should be provided in a hash with keys 'geocoder' and 'daily_limit'. | ||
| 25 | |||
| 26 | =cut | ||
| 27 | |||
| 28 | 0 | ▶ | sub new { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 29 | 0 | my $class = shift; | |
| 30 | 0 | my $args = shift; | |
| 31 | |||
| 32 | my $self = { | ||
| 33 | GeoCoder => $args->{geocoder}, | ||
| 34 | daily_limit => $args->{daily_limit}, | ||
| 35 | 0 | }; | |
| 36 | |||
| 37 | 0 | bless $self, $class; | |
| 38 | |||
| 39 | 0 | return $self; | |
| 40 | }; | ||
| 41 | |||
| 42 | =head2 geocode | ||
| 43 | |||
| 44 | The main geocode method, to be overridden by subclasses. Should take a location | ||
| 45 | string, geocode it using the wrapped class, and return the results (converted | ||
| 46 | to a standard format) | ||
| 47 | |||
| 48 | =cut | ||
| 49 | |||
| 50 | 0 | ▶ | sub geocode { |
|
Subroutine
geocode: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 51 | 0 | croak "This method must be over-ridden"; | |
| 52 | } | ||
| 53 | |||
| 54 | =head2 get_daily_limit | ||
| 55 | |||
| 56 | Getter for daily_limit. | ||
| 57 | |||
| 58 | =cut | ||
| 59 | |||
| 60 | 0 | ▶ | sub get_daily_limit { |
|
Subroutine
get_daily_limit: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 61 | 0 | return shift->{daily_limit}; | |
| 62 | } | ||
| 63 | |||
| 64 | =head2 get_name | ||
| 65 | |||
| 66 | Return the short name of the geocoder being wrapped (should be overriden by the | ||
| 67 | subclass) | ||
| 68 | |||
| 69 | =cut | ||
| 70 | |||
| 71 | 0 | ▶ | sub get_name { |
|
Subroutine
get_name: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 72 | 0 | croak "This method must be over-ridden"; | |
| 73 | }; | ||
| 74 | |||
| 75 | |||
| 76 | |||
| 77 | 1 | 1; | |
| 78 | |||
| 79 | __END__ | ||