Permalink
Browse files

* improvements for commandline interface of Karte.pm:

  * use trim_accuracy
  * handles multiple x,y coordinates
  • Loading branch information...
eserte committed Mar 9, 2010
1 parent 7b9e19e commit 56604f11bd6b89d1d952e629d131cadf82a3cb25
Showing with 5 additions and 5 deletions.
  1. +5 −5 Karte.pm
View
@@ -295,25 +295,25 @@ if (!Getopt::Long::GetOptions("from=s" => \$frommap,
my $conv = sub {
my $coord = shift;
- print join(",", $Karte::map{$frommap}->map2map($Karte::map{$tomap},
- split/,/, $coord)), "\n";
+ join(",", $Karte::map{$tomap}->trim_accuracy($Karte::map{$frommap}->map2map($Karte::map{$tomap},
+ split/,/, $coord)));
};
if (@ARGV) {
- $conv->(shift);
+ print join(' ', map { $conv->($_) } @ARGV), "\n";
} else {
while(<>) {
chomp;
my $c = $_;
- $conv->($c);
+ print $conv->($c), "\n";
}
}
sub usage {
Karte::preload(":all");
my $valid_maps = join("\n", map { "- $_ (" . $Karte::map{$_}->name . ")" } sort keys %Karte::map);
die <<EOF;
-Usage: $^X $0 [-from map] [-to map] -- x,y
+Usage: $^X $0 [-from map] [-to map] -- x,y [x,y ...]
Where map is any of:
$valid_maps
EOF

0 comments on commit 56604f1

Please sign in to comment.