| 1 | package GPS::Poi; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Class::Std::Utils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | { | ||||||||||||||||||||||||||||
| 7 | 1 | my %file_of ; | |||||||||||||||||||||||||||
| 8 | 1 | my @ref_entry_of; | |||||||||||||||||||||||||||
| 9 | 0 | ▶ | sub new{ | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 10 | 0 | my ($class,$arg_ref) =@_; | |||||||||||||||||||||||||||
| 11 | 0 | my $new_object =bless anon_scalar(),$class; | |||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 0 | ▶ | $file_of{ident $new_object}= $arg_ref->{file}||'NULL'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'file'} || 'NULL'
MC/DC0%0/1
$arg_ref->{'file'} || 'NULL'
$arg_ref->{'file'}
Truth table0%0/2
A
A= $arg_ref->{'file'}
| |||||||||||||||||||||||||||||
| 14 | 0 | return $new_object; | |||||||||||||||||||||||||||
| 15 | } | ||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | sub DESTROY { | ||||||||||||||||||||||||||||
| 18 | my ($self)=@_; | ||||||||||||||||||||||||||||
| 19 | delete $file_of{ident $self}; | ||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 0 | ▶ | sub parse { | ||||||||||||||||||||||||||
|
Subroutine
parse: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 0 | my ($self,$arg_ref) =@_; | |||||||||||||||||||||||||||
| 25 | 0 | ▶ | $file_of{ident $self}= $arg_ref->{file} if exists $arg_ref->{file} ; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | return 0 if $file_of{ident $self} eq 'NULL' ; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | (open my $input, '<',$file_of{ident $self}) ||return 0 ; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 29 | 0 | ▶ | while ($input) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | 0 | read ($input,$a,1); | |||||||||||||||||||||||||||
| 31 | 0 | my $code = unpack "C" ,$a; | |||||||||||||||||||||||||||
| 32 | 0 | ▶ | last unless defined $code ; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | 0 | ▶ | if ($code== 0 or $code ==2) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$code == 0 or $code == 2
MC/DC0%0/2
$code == 0 or $code == 2
$code == 0
$code == 2
Truth table0%0/3
A or B
A= $code == 0B= $code == 2
| |||||||||||||||||||||||||||||
| 34 | { | ||||||||||||||||||||||||||||
| 35 | 0 | read ($input,$a,4); | |||||||||||||||||||||||||||
| 36 | 0 | my $long= unpack "V",$a; | |||||||||||||||||||||||||||
| 37 | 0 | my $total= $long-5; | |||||||||||||||||||||||||||
| 38 | 0 | read ($input,$a,$total); | |||||||||||||||||||||||||||
| 39 | 0 | my ($longitude,$latitude,$chaine_c)= unpack "VVa*",$a; | |||||||||||||||||||||||||||
| 40 | 0 | $longitude = $longitude / 100000.000000; | |||||||||||||||||||||||||||
| 41 | 0 | $longitude =sprintf ("%.6f",$longitude); | |||||||||||||||||||||||||||
| 42 | 0 | my $i =length ($longitude); | |||||||||||||||||||||||||||
| 43 | 0 | ▶ | for ($i;$i < 13 ;$i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 44 | 0 | $longitude = "0".$longitude ; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | 0 | $latitude = $latitude/ 100000.000000; | |||||||||||||||||||||||||||
| 47 | 0 | $latitude =sprintf ("%.6f",$latitude); | |||||||||||||||||||||||||||
| 48 | 0 | my $i =length ($latitude); | |||||||||||||||||||||||||||
| 49 | 0 | ▶ | for ($i;$i < 13 ;$i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 50 | 0 | $latitude = "0".$latitude ; | |||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||
| 52 | 0 | my $chaine=substr($chaine_c,0,-1); | |||||||||||||||||||||||||||
| 53 | 0 | my $entry = GPS::Poi::Entry->new ({ 'code' =>$code , | |||||||||||||||||||||||||||
| 54 | 'label' => $chaine, | ||||||||||||||||||||||||||||
| 55 | 'long' => $longitude, | ||||||||||||||||||||||||||||
| 56 | 'lat' => $latitude , | ||||||||||||||||||||||||||||
| 57 | }); | ||||||||||||||||||||||||||||
| 58 | 0 | push @ref_entry_of,$entry; | |||||||||||||||||||||||||||
| 59 | } else | ||||||||||||||||||||||||||||
| 60 | 0 | { last; | |||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | close $input; | |||||||||||||||||||||||||||
| 65 | 0 | return ($#ref_entry_of + 1) ; | |||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||
| 68 | 0 | ▶ | sub clear_list { | ||||||||||||||||||||||||||
|
Subroutine
clear_list: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 69 | 0 | my ($self)=@_; | |||||||||||||||||||||||||||
| 70 | 0 | @ref_entry_of=(); | |||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub all_as_list { | ||||||||||||||||||||||||||
|
Subroutine
all_as_list: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 75 | 0 | my ($self)=@_; | |||||||||||||||||||||||||||
| 76 | 0 | my @tmp; | |||||||||||||||||||||||||||
| 77 | 0 | for my $entry (@ref_entry_of) { | |||||||||||||||||||||||||||
| 78 | 0 | push @tmp,$entry->as_list; | |||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | 0 | return @tmp; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub dump_list { | ||||||||||||||||||||||||||
|
Subroutine
dump_list: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 86 | 0 | my ($self)=@_; | |||||||||||||||||||||||||||
| 87 | 0 | my @tmp; | |||||||||||||||||||||||||||
| 88 | 0 | for my $entry (@ref_entry_of) { | |||||||||||||||||||||||||||
| 89 | 0 | push @tmp,$entry->as_print; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||
| 93 | 0 | my $a= join "\n" ,@tmp ; | |||||||||||||||||||||||||||
| 94 | 0 | return "$a\n"; | |||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||
| 97 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 98 | 0 | my ($self)=@_; | |||||||||||||||||||||||||||
| 99 | 0 | delete $file_of{ident $self}; | |||||||||||||||||||||||||||
| 100 | 0 | undef @ref_entry_of; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 1 | package GPS::Poi::Entry; | |||||||||||||||||||||||||||
| 105 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 106 | 1 | ▶ | use Class::Std::Utils; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 107 | 1 | our $VERSION = '0.01'; | |||||||||||||||||||||||||||
| 108 | { | ||||||||||||||||||||||||||||
| 109 | 1 | my %label_of; | |||||||||||||||||||||||||||
| 110 | my %long_of; | ||||||||||||||||||||||||||||
| 111 | 1 | my %lat_of; | |||||||||||||||||||||||||||
| 112 | 1 | my %code_of; | |||||||||||||||||||||||||||
| 113 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||
| 114 | 0 | my ($class,$arg_ref) =@_; | |||||||||||||||||||||||||||
| 115 | 0 | my $new_object =bless anon_scalar(),$class; | |||||||||||||||||||||||||||
| 116 | 0 | ▶ | $label_of{ident $new_object}= $arg_ref->{label}||'NULL'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'label'} || 'NULL'
MC/DC0%0/1
$arg_ref->{'label'} || 'NULL'
$arg_ref->{'label'}
Truth table0%0/2
A
A= $arg_ref->{'label'}
| |||||||||||||||||||||||||||||
| 117 | 0 | ▶ | $long_of{ident $new_object}= $arg_ref->{long}||'NULL'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'long'} || 'NULL'
MC/DC0%0/1
$arg_ref->{'long'} || 'NULL'
$arg_ref->{'long'}
Truth table0%0/2
A
A= $arg_ref->{'long'}
| |||||||||||||||||||||||||||||
| 118 | 0 | ▶ | $lat_of{ident $new_object}= $arg_ref->{lat}||'NULL'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'lat'} || 'NULL'
MC/DC0%0/1
$arg_ref->{'lat'} || 'NULL'
$arg_ref->{'lat'}
Truth table0%0/2
A
A= $arg_ref->{'lat'}
| |||||||||||||||||||||||||||||
| 119 | 0 | ▶ | $code_of{ident $new_object}= $arg_ref->{code}||'NULL'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'code'} || 'NULL'
MC/DC0%0/1
$arg_ref->{'code'} || 'NULL'
$arg_ref->{'code'}
Truth table0%0/2
A
A= $arg_ref->{'code'}
| |||||||||||||||||||||||||||||
| 120 | 0 | return $new_object; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | 0 | ▶ | sub as_list { | ||||||||||||||||||||||||||
|
Subroutine
as_list: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 123 | 0 | my ($self)=@_; | |||||||||||||||||||||||||||
| 124 | 0 | my @tmp= ($label_of{ident $self}, $long_of{ident $self} ,$lat_of{ident $self} ,$code_of{ident $self}); | |||||||||||||||||||||||||||
| 125 | 0 | return \@tmp; | |||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||
| 127 | 0 | ▶ | sub as_print { | ||||||||||||||||||||||||||
|
Subroutine
as_print: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 128 | 0 | my ($self)=@_; | |||||||||||||||||||||||||||
| 129 | 0 | my $a = "$long_of{ident $self} Lg - $lat_of{ident $self} Lt - $label_of{ident $self} - $code_of{ident $self}"; | |||||||||||||||||||||||||||
| 130 | 0 | return $a; | |||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 134 | 0 | my ($self)=@_; | |||||||||||||||||||||||||||
| 135 | 0 | delete $label_of{ident $self}; | |||||||||||||||||||||||||||
| 136 | 0 | delete $long_of{ident $self}; | |||||||||||||||||||||||||||
| 137 | 0 | delete $lat_of{ident $self}; | |||||||||||||||||||||||||||
| 138 | 0 | delete $code_of{ident $self}; | |||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | # Preloaded methods go here. | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | 1 | 1; | |||||||||||||||||||||||||||
| 146 | __END__ | ||||||||||||||||||||||||||||