add the Geo::TAF module
[spider.git] / Geo / TAF / example / cmd_metar.pl
diff --git a/Geo/TAF/example/cmd_metar.pl b/Geo/TAF/example/cmd_metar.pl
new file mode 100755 (executable)
index 0000000..9ac8418
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/perl
+#
+# This example takes METARs from the standard input and 
+# prints them out in a readable form
+#
+
+use strict;
+use Geo::TAF;
+
+while (<STDIN>) {
+       chomp;
+       next if /^\s*$/;
+       next unless Geo::TAF::is_weather($_);
+       my $t = new Geo::TAF;
+       $t->metar($_);
+       print $t->raw, "\n\n";
+       print $t->as_string, "\n\n";
+}