diff options
author | Struan Donald <struan@exo.org.uk> | 2011-07-22 11:35:48 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-07-22 11:35:48 +0100 |
commit | c2f72c17beab89d473e1776aa1662a68dc5e04be (patch) | |
tree | 860d97703e57d8d1b67fbb6a8261c0966d03829b | |
parent | 9de82807061b2b53f09674d2e6a6871a3217a66b (diff) |
bit more robust checking of args
-rwxr-xr-x | bin/open311-populate-service-list | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/bin/open311-populate-service-list b/bin/open311-populate-service-list index 30a55c178..7a91c2c05 100755 --- a/bin/open311-populate-service-list +++ b/bin/open311-populate-service-list @@ -11,10 +11,24 @@ use Data::Dumper; my $council = shift; my $end_point = shift; -die "require council id and end point\n" unless $council and $end_point; +die <<"EOT" +You need to provide a council id and an end point url + +Usage: + + $0 council_id end_point_url + + council_id: the mapit id of the council as used in the contacts table + end_point_url: the location of the open311 service list xml + +EOT + unless $council and $end_point; my $service_list = get( $end_point ); +die "Invalid council id: $council\n" unless $council =~ /^\d+$/; +die "No service list found at $end_point\n" unless $service_list; + my $xml = XML::Simple->new(); my $list = $xml->XMLin( $service_list ); my @found_contacts; |