|
|
|
@ -61,7 +61,27 @@ elsif ($mode eq 'remove') |
|
|
|
|
|
|
|
|
|
elsif ($mode eq 'set') |
|
|
|
|
{ |
|
|
|
|
say "Set mode"; |
|
|
|
|
my ($name, $coordinates) = @ARGV; |
|
|
|
|
unless (defined($name) && defined($coordinates)) |
|
|
|
|
{ |
|
|
|
|
say "Not enough args for set operation"; |
|
|
|
|
USAGE(1); |
|
|
|
|
} |
|
|
|
|
$name = to_id($name); |
|
|
|
|
my ($placemark) = $xpc->findnodes("//k:Placemark[\@id=\"$name\"]"); |
|
|
|
|
if(defined($placemark)) |
|
|
|
|
{ |
|
|
|
|
my ($coordinates_node) = $xpc->findnodes("./k:Point/k:coordinates", $placemark); |
|
|
|
|
my ($description_node) = $xpc->findnodes("./k:description", $placemark); |
|
|
|
|
$coordinates_node->firstChild()->setData($coordinates); |
|
|
|
|
$description_node->firstChild()->setData($coordinates); |
|
|
|
|
print $dom->toString(1); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
say "$name was not found in $filename"; |
|
|
|
|
exit(1); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
else |
|
|
|
|