Geo/Polygons.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 35 CC 3 SCAR 18.4
CC
3
Cov
0%
point_in_polygon
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 6.3
1 package Politics::AU::Geo::Polygons;
2  
3 use strict;
4 use Storable ();
5 use Params::Util qw{_INSTANCE};
6 use Math::Polygon ();
7  
8 our $VERSION = '0.01';
9  
10 sub point_in_polygon {
11 my $self = shift;
12 my $latitude = shift;
13 my $longitude = shift;
14  
15 # Inflate
16 my $polygon = Storable::thaw($self->points);
17 unless ( _INSTANCE($polygon, 'Math::Polygon') ) {
18 die("Failed to deserialize the Math::Polygon object");
19 }
20  
21 # Check
22 if ( $polygon->contains([ $longitude, $latitude ]) ) {
23 return 1;
24 } else {
25 return '';
26 }
27 }
28  
29 1;
30  
31 __END__