rivers/getstations.pl

13 lines
339 B
Perl
Raw Normal View History

2014-01-04 20:39:39 +00:00
use JSON::PP;
$DEBUG = $ENV{DEBUG};
$CatchmentId = shift @ARGV;
print "Decoding...\n" if $DEBUG;
$in = decode_json(<>) or die;
foreach $station (@{$in->{data}}) {
if ($station->{url} =~ /CatchmentId=$CatchmentId$/) {
print "$station->{id}", $DEBUG ? ": $station->{station} on $station->{river}\n" : " ";
}
}
print "\n" unless $DEBUG;