Pluggable/Base.pm

filter: Statementstmt 96.3% 26 / 27 Branchbran 71.4% 10 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 4 / 4 totaltotal 90.3% 47 / 52 CC 8 SCAR 10.6
CC
8
Cov
88%
Snippet
5.1
name
2.0
description
2.0
CRAP 2.9
« Pluggable.pm ↑ Summary Pluggable/Contrib/LineString.pm »
1 package Geo::GoogleEarth::Pluggable::Base;
2 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 7 ▶use base qw{Geo::GoogleEarth::Pluggable::Constructor};
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 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 19 ▶sub name {
Subroutine name: called CC=2 SCAR=7.1
Pod documented
43 19 my $self=shift;
44 19 ▶ $self->{'name'}=shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 19 19
45 19 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 13 ▶sub description {
Subroutine description: called CC=2 SCAR=7.1
Pod documented
59 13 my $self=shift;
60 13 ▶ $self->{'description'}=shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 13 13
61 13 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 32 ▶sub Snippet {
Subroutine Snippet: called CC=5 SCAR=16.2
Pod documented
86 32 my $self=shift;
87 32 ▶ if (@_ == 1) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_ == 1) { } 1 31 32
elsif (@_ > 1) { } 0 31 31
88 1 $self->{"Snippet"}=shift;
89 } elsif (@_ > 1) {
90 0 $self->{"Snippet"}=[@_];
91 }
92 #force undef to default empty array reference
93 32 ▶ $self->{"Snippet"}=[] unless defined $self->{"Snippet"};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"Snippet"} 10 22 32
94 #force to array reference
95 32 ▶ $self->{"Snippet"}=[$self->{"Snippet"}] unless ref($self->{"Snippet"}) eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $self->{"Snippet"} eq "ARRAY" 1 31 32
96 32 return $self->{"Snippet"};
97 }
98
99 =head2 lookat
100  
101 Sets or returns a L<Geo::GoogleEarth::Pluggable::LookAt> object
102  
103 =cut
104  
105 5 ▶sub lookat {
Subroutine lookat: called CC=2 SCAR=7.1
Pod documented
106 5 my $self=shift;
107 5 ▶ $self->{"lookat"}=shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 5 5
108 5 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<Geo::GoogleEarth::Pluggable> creates a GoogleEarth Document.
135  
136 =cut
137  
138 7 1;
« Pluggable.pm ↑ Summary Pluggable/Contrib/LineString.pm »