kml.pl: take parameters, write to stdout

pull/2/head
Daniel Asher Resnick 4 years ago
parent 37de41f7b3
commit 42e533b53c
  1. 9
      kml.pl

@ -7,18 +7,17 @@ use warnings;
use XML::LibXML; use XML::LibXML;
use Data::Dumper; use Data::Dumper;
my ($name, $coordinates, $article) = @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");
append_placemark("Fo'o", '-122,47', 'Fo%27o'); append_placemark($name, $coordinates, $article);
append_placemark("Bar", '-122.5,47.5');
# say $dom->toString(1); # say $dom->toString(1);
open TEST_KML, ">test.kml"; print $dom->toString(1);
print TEST_KML $dom->toString(1);
close TEST_KML;
sub add_empty_child sub add_empty_child
{ {

Loading…
Cancel
Save