File Coverage

blib/lib/Geo/GoogleEarth/Pluggable/Base.pm
Criterion Covered Total %
statement 24 25 96.0
branch 10 14 71.4
condition n/a
subroutine 7 7 100.0
pod 4 4 100.0
total 45 50 90.0


line stmt bran cond sub pod time code
1             package Geo::GoogleEarth::Pluggable::Base;
2 7     7   51 use warnings;
  7         10  
  7         194  
3 7     7   31 use strict;
  7         12  
  7         128  
4 7     7   27 use base qw{Geo::GoogleEarth::Pluggable::Constructor};
  7         12  
  7         2609  
5              
6             our $VERSION='0.17';
7              
8             =head1 NAME
9              
10             Geo::GoogleEarth::Pluggable::Base - Geo::GoogleEarth::Pluggable Base package
11              
12             =head1 SYNOPSIS
13              
14             use base qw{Geo::GoogleEarth::Pluggable::Base};
15              
16             =head1 DESCRIPTION
17              
18             The is the base of all Geo::GoogleEarth::Pluggable packages.
19              
20             =head1 USAGE
21              
22             =head1 CONSTRUCTOR
23              
24             =head2 new
25              
26             my $document = Geo::GoogleEarth::Pluggable->new(key1=>value1,
27             key2=>[value=>{opt1=>val1}],
28             key3=>{value=>{opt2=>val2}});
29              
30             =head1 METHODS
31              
32             =head2 name
33              
34             Sets or returns the name property.
35              
36             my $name=$folder->name;
37             $placemark->name("New Name");
38             $document->name("New Name");
39              
40             =cut
41              
42             sub name {
43 19     19 1 35 my $self=shift;
44 19 50       52 $self->{'name'}=shift if @_;
45 19         84 return $self->{'name'};
46             }
47              
48             =head2 description
49              
50             Sets or returns the description property.
51              
52             my $description=$folder->description;
53             $placemark->description("New Description");
54             $document->description("New Description");
55              
56             =cut
57              
58             sub description {
59 13     13 1 24 my $self=shift;
60 13 50       38 $self->{'description'}=shift if @_;
61 13         71 return $self->{'description'};
62             }
63              
64             =head2 Snippet
65              
66             Returns the Snippet used in the Snippet XML element or a Placemark. The default Snippet from Google Earth is to use the first line of the description however this package defaults to a zero line Snippet.
67              
68             Snippet is rendered with maxLines as the length of the array ref and the content joined with new lines.
69              
70             Typical use
71              
72             $document->Point(Snippet=>"Line 1");
73             $document->Point(Snippet=>["Line 1", "Line 2"]);
74              
75             Extended used
76              
77             my $snippet=$placemark->Snippet; #[] always array reference
78             $placemark->Snippet([]); #default
79             $placemark->Snippet(["line 1", "line 2", "line 3"]);
80             $placemark->Snippet("My Snippet Text"); #folded into array reference.
81             $placemark->Snippet("line 1", "line 2", "line 3"); #folded into array reference
82              
83             =cut
84              
85             sub Snippet {
86 32     32 1 1003 my $self=shift;
87 32 100       87 if (@_ == 1) {
    50          
88 1         3 $self->{"Snippet"}=shift;
89             } elsif (@_ > 1) {
90 0         0 $self->{"Snippet"}=[@_];
91             }
92             #force undef to default empty array reference
93 32 100       80 $self->{"Snippet"}=[] unless defined $self->{"Snippet"};
94             #force to array reference
95 32 100       85 $self->{"Snippet"}=[$self->{"Snippet"}] unless ref($self->{"Snippet"}) eq "ARRAY";
96 32         127 return $self->{"Snippet"};
97             }
98            
99             =head2 lookat
100              
101             Sets or returns a L object
102              
103             =cut
104              
105             sub lookat {
106 5     5 1 10 my $self=shift;
107 5 50       12 $self->{"lookat"}=shift if @_;
108 5         22 return $self->{"lookat"};
109             }
110              
111             =head1 BUGS
112              
113             Please log on RT and send to the geo-perl email list.
114              
115             =head1 SUPPORT
116              
117             DavisNetworks.com supports all Perl applications including this package.
118              
119             =head1 AUTHOR
120              
121             Michael R. Davis (mrdvt92)
122             CPAN ID: MRDVT
123              
124             =head1 COPYRIGHT
125              
126             This program is free software licensed under the...
127              
128             The BSD License
129              
130             The full text of the license can be found in the LICENSE file included with this module.
131              
132             =head1 SEE ALSO
133              
134             L creates a GoogleEarth Document.
135              
136             =cut
137              
138             1;