File Coverage

blib/lib/Geo/Leaflet/circle.pm
Criterion Covered Total %
statement 24 24 100.0
branch 6 12 50.0
condition n/a
subroutine 7 7 100.0
pod 4 4 100.0
total 41 47 87.2


line stmt bran cond sub pod time code
1             package Geo::Leaflet::circle;
2 2     2   36 use strict;
  2         5  
  2         114  
3 2     2   10 use warnings;
  2         4  
  2         119  
4 2     2   29 use base qw{Geo::Leaflet::Objects};
  2         18  
  2         889  
5              
6             our $VERSION = '0.03';
7             our $PACKAGE = __PACKAGE__;
8              
9             =head1 NAME
10              
11             Geo::Leaflet::circle - Leaflet circle object
12              
13             =head1 SYNOPSIS
14              
15             use Geo::Leaflet;
16             my $map = Geo::Leaflet->new;
17             my $circle = $map->circle(
18             lat => $lat,
19             lon => $lon,
20             radius => $radius,
21             options => {},
22             );
23              
24             =head1 DESCRIPTION
25              
26             This package constructs a Leaflet circle object for use on a L map.
27              
28             =head1 PROPERTIES
29              
30             =head2 lat
31              
32             =cut
33              
34             sub lat {
35 1     1 1 2 my $self = shift;
36 1 50       3 $self->{'lat'} = shift if @_;
37 1 50       4 die("Error: lat required") unless defined $self->{'lat'};
38 1         5 return $self->{'lat'};
39             }
40              
41             =head2 lon
42              
43             =cut
44              
45             sub lon {
46 1     1 1 2 my $self = shift;
47 1 50       3 $self->{'lon'} = shift if @_;
48 1 50       4 die("Error: lon required") unless defined $self->{'lon'};
49 1         8 return $self->{'lon'};
50             }
51              
52             =head2 radius
53              
54             =cut
55              
56             sub radius {
57 2     2 1 4 my $self = shift;
58 2 50       7 $self->{'radius'} = shift if @_;
59 2         24 return $self->{'radius'};
60             }
61              
62             =head2 options
63              
64             =head1 METHODS
65              
66             =head2 stringify
67              
68             =cut
69              
70             sub stringify {
71 1     1 1 2 my $self = shift;
72 1         9 my $options = $self->options;
73 1 50       4 $options->{'radius'} = $self->radius if defined $self->radius; #radius is set in options
74 1         5 return $self->stringify_base([$self->lat, $self->lon]);
75             }
76              
77             =head1 SEE ALSO
78              
79             =head1 AUTHOR
80              
81             Michael R. Davis
82              
83             =head1 COPYRIGHT AND LICENSE
84              
85             Copyright (C) 2024 by Michael R. Davis
86              
87             MIT LICENSE
88              
89             =cut
90              
91             1;