| Geo-GoogleEarth-Document documentation | Contained in the Geo-GoogleEarth-Document distribution. |
Geo::GoogleEarth::Document::Base - Base for Geo::GoogleEarth::Document::* packages
use base qw{Geo::GoogleEarth::Document::Base};
The is the base of all Geo::GoogleEarth::Document packages.
my $document = Geo::GoogleEarth::Document->new(key1=>value1,
key2=>[value=>{opt1=>val1}],
key3=>{value=>{opt2=>val2}});
This is an internal method that may allow hackers to add custom fields.
$placemark->function('HashKey' => {key1=>value1, key2=>value2});
Returns options hash.
Sets or returns the name property.
my $name=$folder->name;
$placemark->name("New Name");
$document->name("New Name");
Try geo-perl email list.
Michael R. Davis (mrdvt92)
CPAN ID: MRDVT
This program is free software licensed under the...
The BSD License
The full text of the license can be found in the LICENSE file included with this module.
Geo::GoogleEarth::Document creates a GoogleEarth KML Document.
| Geo-GoogleEarth-Document documentation | Contained in the Geo-GoogleEarth-Document distribution. |
package Geo::GoogleEarth::Document::Base; use strict;
sub new { my $this = shift(); my $class = ref($this) || $this; my $self = {}; bless $self, $class; $self->initialize(@_); return $self; }
sub initialize { my $self = shift(); %$self=@_; foreach my $key (keys %$self) { if (ref($self->{$key}) eq 'ARRAY') { #[text => {opt->val}] my @array=@{$self->{$key}}; $self->{'options'}->{$key}=$array[1] if defined($array[1]); $self->{$key}=$array[0]; #use Data::Dumper qw{}; #print Data::Dumper->Dump([@array]) ,"\n"; } elsif (ref($self->{$key}) eq 'HASH') { #{text => {opt->val}} my @array=%{$self->{$key}}; $self->{'options'}->{$key}=$array[1] if defined($array[1]); $self->{$key}=$array[0]; } else { #scalar and objects that overload "" #text } } }
sub function { my $self=shift(); my $function=shift(); if (@_) { $self->{$function} = shift(); if (@_) { my $hash=shift(); $self->{'options'}->{$function}=ref($hash) eq 'HASH' ? $hash : {}; } } return $self->{$function}; }
sub options { my $self=shift(); my $hash=$self->{'options'}; if (ref($hash) eq 'HASH') { return wantarray ? %$hash : $hash; } else { return wantarray ? () : undef(); } }
sub name { my $self=shift(); return $self->function('name', @_); }
1;