| 1 | #!/usr/bin/perl | ||||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 4 | ▶ | use Geo::Postcodes::NO; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | |||||||||||||
| 6 | 4 | ▶ | unless (@ARGV) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 7 | { | ||||||||||||
| 8 | 1 | print "Usage: basic.pl <one or more postcodes>\n"; | |||||||||||
| 9 | 1 | exit; | |||||||||||
| 10 | } | ||||||||||||
| 11 | |||||||||||||
| 12 | 3 | foreach my $postcode (@ARGV) | |||||||||||
| 13 | { | ||||||||||||
| 14 | 3 | ▶ | if (my $P = Geo::Postcodes::NO->new($postcode)) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 15 | { | ||||||||||||
| 16 | 1 | foreach my $field (Geo::Postcodes::NO::get_fields()) | |||||||||||
| 17 | { | ||||||||||||
| 18 | 7 | ▶ | printf("%-10s\t%s\n", ucfirst($field), $P->$field() || ""); | ||||||||||
|
Condition50%1/2
$P->$field || ''
MC/DC0%0/1
$P->$field || ''
$P->$field
Truth table50%1/2
A
A= $P->$field
| |||||||||||||
| 19 | } | ||||||||||||
| 20 | 1 | printf("%-10s\t%s\n\n", "Type_en", | |||||||||||
| 21 | Geo::Postcodes::NO::type2verbose_english($P->type())); | ||||||||||||
| 22 | } | ||||||||||||
| 23 | else | ||||||||||||
| 24 | { | ||||||||||||
| 25 | 2 | ▶ | if (Geo::Postcodes::NO::legal($postcode)) | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 26 | { | ||||||||||||
| 27 | 1 | print "Postcode '$postcode' not in use.\n\n"; | |||||||||||
| 28 | } | ||||||||||||
| 29 | else | ||||||||||||
| 30 | { | ||||||||||||
| 31 | 1 | print "Illegal postcode '$postcode'.\n\n"; | |||||||||||
| 32 | } | ||||||||||||
| 33 | } | ||||||||||||
| 34 | } | ||||||||||||