eg/basic.pl

filter: Statementstmt 100% 20 / 20 Branchbran 100% 6 / 6 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 93.7% 30 / 32 CC 1 SCAR 0.0
CC
1
Cov
96%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Geo/Postcodes/NO/Tutorial.pm ↑ Summary eg/multiselection.pl »
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
BranchTrueFalseTotal
unless (@ARGV) 1 3 4
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
BranchTrueFalseTotal
if (my $P = 'Geo::Postcodes::NO'->new($postcode)) { } 1 2 3
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 || ''
l!l
70
MC/DC0%0/1
$P->$field || ''
$P->$field
Truth table50%1/2
A
A= $P->$field
Aresult
11
00
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
BranchTrueFalseTotal
if (Geo::Postcodes::NO::legal($postcode)) { } 1 1 2
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 }
« blib/lib/Geo/Postcodes/NO/Tutorial.pm ↑ Summary eg/multiselection.pl »