kml.pl: Stub remove, set and usage modes

pull/2/head
Daniel Asher Resnick 4 years ago
parent 29fd191325
commit d0e398f974
  1. 31
      kml.pl

@ -7,17 +7,42 @@ use warnings;
use XML::LibXML; use XML::LibXML;
use URI::Escape; use URI::Escape;
my ($name, $coordinates) = @ARGV;
my $filename = 'ours.kml'; my $filename = 'ours.kml';
my $dom = XML::LibXML->load_xml(location => $filename, no_blanks => 1); my $dom = XML::LibXML->load_xml(location => $filename, no_blanks => 1);
my $xpc = XML::LibXML::XPathContext->new($dom); my $xpc = XML::LibXML::XPathContext->new($dom);
$xpc->registerNs('k', "http://earth.google.com/kml/2.2"); $xpc->registerNs('k', "http://earth.google.com/kml/2.2");
my $mode = shift;
if ($mode eq 'add')
{
my ($name, $coordinates) = @ARGV;
unless (defined($name) && defined($coordinates))
{
say "Not enough args for add operation";
USAGE(1);
}
append_placemark($name, $coordinates, uri_escape($name)); append_placemark($name, $coordinates, uri_escape($name));
print $dom->toString(1); print $dom->toString(1);
}
elsif ($mode eq 'remove')
{
say "Remove mode";
}
elsif ($mode eq 'set')
{
say "Set mode";
}
else
{
USAGE(1);
}
sub USAGE
{
my $code = shift;
say "USAGE: ";
exit($code);
}
sub add_empty_child sub add_empty_child
{ {
my $node = shift; my $node = shift;

Loading…
Cancel
Save