| 1 | package Travel::Status::DE::IRIS; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 7 | ▶ | use 5.014; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | our $VERSION = '2.05'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use Carp qw(confess cluck); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use DateTime; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 7 | ▶ | use DateTime::Format::Strptime; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | ▶ | use List::Util qw(none first); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 7 | ▶ | use List::MoreUtils qw(uniq); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 7 | ▶ | use List::UtilsBy qw(uniq_by); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 7 | ▶ | use Travel::Status::DE::IRIS::Result; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 7 | ▶ | use XML::LibXML; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 47 | ▶ | sub try_load_xml { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
try_load_xml: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 47 | my ($xml) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 47 | my $tree; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 47 | eval { $tree = XML::LibXML->load_xml( string => $xml ) }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 47 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | return ( undef, $@ ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 47 | return ( $tree, undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # "station" parameter must be an EVA or DS100 ID. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | ▶ | sub new_p { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_p: not called CC=21 SCAR=61.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | my ( $class, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | my $promise = $opt{promise}->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ( not $opt{station} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | return $promise->reject('station flag must be passed'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | my $self = $class->new( %opt, async => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | $self->{promise} = $opt{promise}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | my $lookahead_steps = int( $self->{lookahead} / 60 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | if ( ( 60 - $self->{datetime}->minute ) < ( $self->{lookahead} % 60 ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | $lookahead_steps++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my $lookbehind_steps = int( $self->{lookbehind} / 60 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | if ( $self->{datetime}->minute < ( $self->{lookbehind} % 60 ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $lookbehind_steps++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 0 | my @candidates = $opt{get_station}( $opt{station} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | if ( @candidates != 1 and $opt{station} =~ m{^\d+$} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
@candidates != 1 and $opt{"station"} =~ /^\d+$/u
MC/DC0%0/2
@candidates != 1 and $opt{"station"} =~ /^\d+$/u
@candidates != 1
$opt{"station"} =~ /^\d+$/u
Truth table0%0/3
A and B
A= @candidates != 1B= $opt{"station"} =~ /^\d+$/u
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | @candidates = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | "D$opt{station}", "Betriebsstelle nicht bekannt $opt{station}", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | $opt{station} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | if ( @candidates == 0 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | return $promise->reject('station not found'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | if ( @candidates >= 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | return $promise->reject('station identifier is ambiguous'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # "uic" is deprecated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | $self->{station} = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ds100 => $candidates[0][0], | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | eva => $candidates[0][2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | name => $candidates[0][1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | uic => $candidates[0][2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | $self->{related_stations} = []; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my @queue = ( $self->{station}{eva} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | my @related_reqs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | my @related_stations; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | my %seen = ( $self->{station}{eva} => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | my $iter_depth = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | ▶ | while ( @queue and $iter_depth < 12 and $opt{with_related} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
@queue and $iter_depth < 12 and $opt{"with_related"}
@queue and $iter_depth < 12
MC/DC0%0/3
@queue and $iter_depth < 12 and $opt{"with_related"}
@queue
$iter_depth < 12
$opt{"with_related"}
Truth table0%0/4
A and B and C
A= @queueB= $iter_depth < 12C= $opt{"with_related"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 0 | my $eva = shift(@queue); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | $iter_depth++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | for my $ref ( @{ $opt{meta}{$eva} // [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$opt{"meta"}{$eva} // []
MC/DC0%0/1
$opt{"meta"}{$eva} // []
$opt{"meta"}{$eva}
Truth table0%0/2
A
A= $opt{"meta"}{$eva}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | ▶ | if ( not $seen{$ref} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | push( @related_stations, $ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | $seen{$ref} = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | push( @queue, $ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | for my $eva (@related_stations) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | @candidates = $opt{get_station}($eva); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | if ( @candidates == 1 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | # "uic" is deprecated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | push( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | @{ $self->{related_stations} }, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | ds100 => $candidates[0][0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | eva => $candidates[0][2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | name => $candidates[0][1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | uic => $candidates[0][2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my $dt_req = $self->{datetime}->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | my @timetable_reqs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | = ( $self->get_timetable_p( $self->{station}{eva}, $dt_req ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | for my $eva (@related_stations) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | push( @timetable_reqs, $self->get_timetable_p( $eva, $dt_req ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | for ( 1 .. $lookahead_steps ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $dt_req->add( hours => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | push( @timetable_reqs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $self->get_timetable_p( $self->{station}{eva}, $dt_req ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | for my $eva (@related_stations) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | push( @timetable_reqs, $self->get_timetable_p( $eva, $dt_req ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $dt_req = $self->{datetime}->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | for ( 1 .. $lookbehind_steps ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $dt_req->subtract( hours => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | push( @timetable_reqs, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $self->get_timetable_p( $self->{station}{eva}, $dt_req ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | for my $eva (@related_stations) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | push( @timetable_reqs, $self->get_timetable_p( $eva, $dt_req ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | $self->{promise}->all(@timetable_reqs)->then( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | my @realtime_reqs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | = ( $self->get_realtime_p( $self->{station}{eva} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | for my $eva (@related_stations) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | push( @realtime_reqs, $self->get_realtime_p( $eva, $dt_req ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | return $self->{promise}->all_settled(@realtime_reqs); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | )->then( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | my @realtime_results = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | for my $realtime_result (@realtime_results) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | if ( $realtime_result->{status} eq 'rejected' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 0 | ▶ | $self->{warnstr} //= q{}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"warnstr"} //= ""
MC/DC0%0/1
$self->{"warnstr"} //= ""
$self->{"warnstr"}
Truth table0%0/2
A
A= $self->{"warnstr"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | $self->{warnstr} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | .= "Realtime data request failed: $realtime_result->{reason}. "; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $self->postprocess_results; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | $promise->resolve($self); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | )->catch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my ($err) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | $promise->reject($err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | )->wait; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | return $promise; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 13 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=17 SCAR=32.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 13 | my ( $class, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | 13 | ▶ | if ( not $opt{station} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | 1 | confess('station flag must be passed'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | my $self = { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | datetime => $opt{datetime} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | // DateTime->now( time_zone => 'Europe/Berlin' ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | developer_mode => $opt{developer_mode}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | iris_base => $opt{iris_base} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | // 'https://iris.noncd.db.de/iris-tts/timetable', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | keep_transfers => $opt{keep_transfers}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | lookahead => $opt{lookahead} // ( 2 * 60 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | lookbehind => $opt{lookbehind} // ( 0 * 60 ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | main_cache => $opt{main_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | rt_cache => $opt{realtime_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | serializable => $opt{serializable}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | user_agent => $opt{user_agent}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | with_related => $opt{with_related}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | departure_by_id => {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 12 | ▶ | strptime_obj => $opt{strptime_obj} // DateTime::Format::Strptime->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%6/12
$opt{"datetime"} // "DateTime"->now("time_zone", "Europe/Berlin")
$opt{"iris_base"} // "https://iris.noncd.db.de/iris-tts/timetable"
$opt{"lookahead"} // 120
$opt{"lookbehind"} // 0
$opt{"strptime_obj"} // "DateTime::Format::Strptime"->new("pattern", "%y%m%d%H%M", "time_zone", "Europe/Berlin")
MC/DC0%0/2
$opt{"datetime"} // "DateTime"->now("time_zone", "Europe/Berlin")
$opt{"datetime"}
"DateTime"->now("time_zone", "Europe/Berlin")
MC/DC0%0/1
$opt{"iris_base"} // "https://iris.noncd.db.de/iris-tts/timetable"
$opt{"iris_base"}
MC/DC100%1/1
$opt{"lookahead"} // 120
$opt{"lookahead"}
MC/DC0%0/1
$opt{"lookbehind"} // 0
$opt{"lookbehind"}
MC/DC0%0/2
$opt{"strptime_obj"} // "DateTime::Format::Strptime"->new("pattern", "%y%m%d%H%M", "time_zone", "Europe/Berlin")
$opt{"strptime_obj"}
"DateTime::Format::Strptime"->new("pattern", "%y%m%d%H%M", "time_zone", "Europe/Berlin")
Truth table33%1/3
A // B
A= $opt{"datetime"}B= "DateTime"->now("time_zone", "Europe/Berlin")
Truth table50%1/2
A
A= $opt{"iris_base"}
Truth table100%2/2
A
A= $opt{"lookahead"}
Truth table50%1/2
A
A= $opt{"lookbehind"}
Truth table33%1/3
A // B
A= $opt{"strptime_obj"}B= "DateTime::Format::Strptime"->new("pattern", "%y%m%d%H%M", "time_zone", "Europe/Berlin")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | pattern => '%y%m%d%H%M', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | time_zone => 'Europe/Berlin', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | xp_ar => XML::LibXML::XPathExpression->new('./ar'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | xp_dp => XML::LibXML::XPathExpression->new('./dp'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | xp_tl => XML::LibXML::XPathExpression->new('./tl'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | 12 | bless( $self, $class ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 12 | my $lookahead_steps = int( $self->{lookahead} / 60 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 12 | ▶ | if ( ( 60 - $self->{datetime}->minute ) < ( $self->{lookahead} % 60 ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | $lookahead_steps++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | 12 | my $lookbehind_steps = int( $self->{lookbehind} / 60 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 12 | ▶ | if ( $self->{datetime}->minute < ( $self->{lookbehind} % 60 ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | $lookbehind_steps++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 12 | ▶ | if ( $opt{async} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | 12 | ▶ | if ( not $self->{user_agent} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 12 | ▶ | my %lwp_options = %{ $opt{lwp_options} // { timeout => 10 } }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$opt{"lwp_options"} // {"timeout", 10}
MC/DC0%0/1
$opt{"lwp_options"} // {"timeout", 10}
$opt{"lwp_options"}
Truth table50%1/2
A
A= $opt{"lwp_options"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | 12 | $self->{user_agent} = LWP::UserAgent->new(%lwp_options); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | 12 | $self->{user_agent}->env_proxy; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | my ( $station, @related_stations ) = $self->get_station( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | name => $opt{station}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | root => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | recursive => $opt{with_related}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 12 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 12 | $self->{station} = $station; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 12 | $self->{related_stations} = \@related_stations; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 12 | for my $ref (@related_stations) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | # We (the parent) perform transfer processing, so child requests must not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | # do it themselves. Otherwise, trains from child requests will be | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | # processed twice and may be lost. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | # Similarly, child requests must not perform requests to related | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | # stations -- we're already doing that right now. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | my $ref_status = Travel::Status::DE::IRIS->new( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | datetime => $self->{datetime}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | developer_mode => $self->{developer_mode}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | iris_base => $self->{iris_base}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | lookahead => $self->{lookahead}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | lookbehind => $self->{lookbehind}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | station => $ref->{eva}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | main_cache => $self->{main_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | realtime_cache => $self->{rt_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | strptime_obj => $self->{strptime_obj}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | user_agent => $self->{user_agent}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | 0 | keep_transfers => 1, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | with_related => 0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | if ( not $ref_status->errstr ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | push( @{ $self->{results} }, $ref_status->results ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | 12 | ▶ | if ( $self->{errstr} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | 2 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | 10 | my $dt_req = $self->{datetime}->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | 10 | $self->get_timetable( $self->{station}{eva}, $dt_req ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | 10 | for ( 1 .. $lookahead_steps ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | 20 | $dt_req->add( hours => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | 20 | $self->get_timetable( $self->{station}{eva}, $dt_req ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | 10 | $dt_req = $self->{datetime}->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | 10 | for ( 1 .. $lookbehind_steps ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | $dt_req->subtract( hours => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | 0 | $self->get_timetable( $self->{station}{eva}, $dt_req ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | 10 | $self->get_realtime; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | 10 | $self->postprocess_results; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | 10 | ▶ | sub postprocess_results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
postprocess_results: called CC=11 SCAR=24.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | 10 | ▶ | if ( not $self->{keep_transfers} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | # tra (transfer?) indicates a train changing its ID, so there are two | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | # results for the same train. Remove the departure-only trains from the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | # result set and merge them with their arrival-only counterpart. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | # This way, in case the arrival is available but the departure isn't, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | # nothing gets lost. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | my @merge_candidates | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | 10 | ▶ | = grep { $_->transfer and $_->departure } @{ $self->{results} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$_->transfer && $_->departure
MC/DC100%2/2
$_->transfer && $_->departure
$_->transfer
$_->departure
Truth table100%3/3
A && B
A= $_->transferB= $_->departure
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | 10 | @{ $self->{results} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | 1125 | ▶ | = grep { not( $_->transfer and $_->departure ) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$_->transfer && $_->departure
MC/DC100%2/2
$_->transfer && $_->departure
$_->transfer
$_->departure
Truth table100%3/3
A && B
A= $_->transferB= $_->departure
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | 10 | @{ $self->{results} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | 10 | for my $transfer (@merge_candidates) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | my $result | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | 742 | ▶ | = first { $_->transfer and $_->transfer eq $transfer->train_id } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | 12 | @{ $self->{results} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | 12 | ▶ | if ($result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | 10 | $result->merge_with_departure($transfer); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | 10 | @{ $self->{results} } = grep { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | 1113 | ▶ | my $d = $_->departure // $_->arrival; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$_->departure // $_->arrival
MC/DC0%0/2
$_->departure // $_->arrival
$_->departure
$_->arrival
Truth table66%2/3
A // B
A= $_->departureB= $_->arrival
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 1113 | ▶ | my $s = $_->sched_arrival // $_->sched_departure // $_->arrival // $d; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition44%4/9
(($_->sched_arrival // $_->sched_departure) // $_->arrival) // $d
($_->sched_arrival // $_->sched_departure) // $_->arrival
$_->sched_arrival // $_->sched_departure
MC/DC0%0/4
(($_->sched_arrival // $_->sched_departure) // $_->arrival) // $d
$_->sched_arrival
$_->sched_departure
$_->arrival
$d
Truth table40%2/5
A // B // C // D
A= $_->sched_arrivalB= $_->sched_departureC= $_->arrivalD= $d
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | 1113 | $d = $d->subtract_datetime( $self->{datetime} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | 1113 | $s = $s->subtract_datetime( $self->{datetime} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | not $d->is_negative and $s->in_units('minutes') < $self->{lookahead} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | 10 | ▶ | } @{ $self->{results} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
!$d->is_negative && $s->in_units('minutes') < $self->{'lookahead'}
MC/DC100%2/2
!$d->is_negative && $s->in_units('minutes') < $self->{'lookahead'}
!$d->is_negative
$s->in_units('minutes') < $self->{'lookahead'}
Truth table100%3/3
not(A) && B
A= !$d->is_negativeB= $s->in_units('minutes') < $self->{'lookahead'}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | 10 | @{ $self->{results} } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | 10 | = sort { $a->{epoch} <=> $b->{epoch} } @{ $self->{results} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | # wings (different departures which are coupled as one train) contain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | # references to each other. therefore, they must be processed last. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | 10 | $self->create_wing_refs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | # same goes for replacement refs (the <ref> tag in the fchg document) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 10 | $self->create_replacement_refs; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | 0 | ▶ | sub get_with_cache_p { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_with_cache_p: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | my ( $self, $cache, $url ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if ( $self->{developer_mode} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | say "GET $url"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | my $promise = $self->{promise}->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | ▶ | if ($cache) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | 0 | my $content = $cache->thaw($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | if ($content) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | if ( $self->{developer_mode} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | say ' cache hit'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | 0 | return $promise->resolve($content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | 0 | ▶ | if ( $self->{developer_mode} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | say ' cache miss'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | my $res = $self->{user_agent}->get_p($url)->then( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | my ($tx) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | ▶ | if ( my $err = $tx->error ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $promise->reject( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | "GET $url returned HTTP $err->{code} $err->{message}"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my $content = $tx->res->body; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | ▶ | if ($cache) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | $cache->freeze( $url, \$content ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | 0 | $promise->resolve($content); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | )->catch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my ($err) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $promise->reject($err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | 0 | )->wait; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | return $promise; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | 52 | ▶ | sub get_with_cache { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_with_cache: called CC=8 SCAR=27.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | 52 | my ( $self, $cache, $url ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | 52 | ▶ | if ( $self->{developer_mode} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | say "GET $url"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | 52 | ▶ | if ($cache) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | my $content = $cache->thaw($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | ▶ | if ($content) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 0 | ▶ | if ( $self->{developer_mode} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | 0 | say ' cache hit'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | return ( ${$content}, undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | 52 | ▶ | if ( $self->{developer_mode} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | say ' cache miss'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | 52 | my $ua = $self->{user_agent}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | 52 | my $res = $ua->get($url); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | 52 | ▶ | if ( $res->is_error ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | 5 | return ( undef, $res->status_line ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | 47 | my $content = $res->decoded_content; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | 47 | ▶ | if ($cache) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | $cache->freeze( $url, \$content ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | 47 | return ( $content, undef ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | sub get_station_p { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_station_p: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | my ( $self, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | my $promise = $self->{promise}->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | my $station = $opt{name}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | $self->get_with_cache_p( $self->{main_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | $self->{iris_base} . '/station/' . $station )->then( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | my ($raw) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | 0 | my ( $xml_st, $xml_err ) = try_load_xml($raw); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | 0 | ▶ | if ($xml_err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | $promise->reject('Failed to parse station data: Invalid XML'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | my $station_node = ( $xml_st->findnodes('//station') )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | ▶ | if ( not $station_node ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $promise->reject( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | "Station '$station' has no associated timetable"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | $promise->resolve( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | ds100 => $station_node->getAttribute('ds100'), | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | eva => $station_node->getAttribute('eva'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | name => $station_node->getAttribute('name'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | uic => $station_node->getAttribute('eva'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | )->catch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | my ($err) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $promise->reject($err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | )->wait; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 0 | return $promise; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 12 | ▶ | sub get_station { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_station: called CC=18 SCAR=37.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | 12 | my ( $self, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | 12 | my $iter_depth = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | 12 | my @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | 12 | my @queue = ( $opt{name} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | # @seen holds station IDs which were already seen during recursive | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # 'meta' descent. This avoids infinite loops of 'meta' references. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | # Additionally, we use it to skip stations shat should not be referenced. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | # This includes Norddeich / Norddeich Mole (different stations commonly used | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # by identical trains with different departure times), and Essen-Dellwig / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | # Essen-Dellwig Ost (different stations used by different trains, but with | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | # identical platform numbers). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 12 | my @seen = ( 8007768, 8004449, 8001903, 8001904 ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 12 | ▶ | while ( @queue and $iter_depth < 12 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
@queue and $iter_depth < 12
MC/DC50%1/2
@queue and $iter_depth < 12
@queue
$iter_depth < 12
Truth table66%2/3
A and B
A= @queueB= $iter_depth < 12
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | 12 | my $station = shift(@queue); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 12 | $iter_depth++; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | my ( $raw, $err ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | = $self->get_with_cache( $self->{main_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 12 | $self->{iris_base} . '/station/' . $station ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 12 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | 1 | ▶ | if ( $opt{root} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | 1 | $self->{errstr} = "Failed to fetch station data: $err"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | $self->{warnstr} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | = "Failed to fetch station data for '$station': $err\n"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 11 | my ( $xml_st, $xml_err ) = try_load_xml($raw); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 11 | ▶ | if ($xml_err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | $self->{errstr} = 'Failed to parse station data: Invalid XML'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 11 | my $station_node = ( $xml_st->findnodes('//station') )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | 11 | ▶ | if ( not $station_node ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | 1 | ▶ | if ( $self->{developer_mode} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | say ' no timetable'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | 1 | ▶ | if ( $opt{root} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | $self->{errstr} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | 1 | = "Station '$station' has no associated timetable"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | $self->{warnstr} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | = "Station '$station' has no associated timetable"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | 10 | push( @seen, $station_node->getAttribute('eva') ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | 10 | ▶ | if ( $station_node->getAttribute('name') =~ m{ ZOB} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # There are no departures from a ZOB ("Zentraler Omnibus-Bahnhof" / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | # Central Omnibus Station). Ignore it entirely. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | 10 | ▶ | if ( $station_node->getAttribute('ds100') =~ m{ ^ D \d+ $ }x ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | # This used to indicate an invalid DS100 code, at least from DB | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | # perspective. It typically referred to subway stations which do not | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | # have IRIS departures. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | # However, since Fahrplanwechsel 2022 / 2023, this does not seem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | # to be the case anymore. There are some stations whose DS100 code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | # IRIS does not know, for whatever reason. So for now, accept these | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | # stations as well. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | #next; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | push( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | 10 | @ret, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | ds100 => $station_node->getAttribute('ds100'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | eva => $station_node->getAttribute('eva'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | name => $station_node->getAttribute('name'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | uic => $station_node->getAttribute('eva'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | 10 | ▶ | if ( $self->{developer_mode} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | printf( " -> %s (%s / %s)\n", @{ $ret[-1] }{qw{name eva ds100}} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | 10 | ▶ | if ( $opt{recursive} and defined $station_node->getAttribute('meta') ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$opt{"recursive"} and defined $station_node->getAttribute("meta")
MC/DC0%0/2
$opt{"recursive"} and defined $station_node->getAttribute("meta")
$opt{"recursive"}
defined $station_node->getAttribute("meta")
Truth table33%1/3
A and B
A= $opt{"recursive"}B= defined $station_node->getAttribute("meta")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | my @refs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | = uniq( split( m{ \| }x, $station_node->getAttribute('meta') ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | for my $ref (@refs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | if ( none { $_ == $ref } @seen and none { $_ == $ref } @queue ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Subroutine
__ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
Condition0%0/3
&none(sub {
$_ == $ref;
}
, @seen) and &none(sub {
$_ == $ref;
}
, @queue)
MC/DC0%0/2
&none(sub {
$_ == $ref;
}
, @seen) and &none(sub {
$_ == $ref;
}
, @queue)
&none(sub {
$_ == $ref;
}
, @seen)
&none(sub {
$_ == $ref;
}
, @queue)
Truth table0%0/3
A and B
A= &none(sub {
$_ == $ref;
}
, @seen)B= &none(sub {
$_ == $ref;
}
, @queue)
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | push( @queue, $ref ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | $opt{root} = 0; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | 10 | ▶ | if (@queue) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | cluck( "Reached $iter_depth iterations when tracking station IDs. " | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | . "This is probably a bug" ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | 10 | ▶ | @ret = uniq_by { $_->{eva} } @ret; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | 10 | return @ret; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | 1140 | ▶ | sub add_result { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_result: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | 1140 | my ( $self, $station_name, $station_eva, $s ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | 1140 | my $id = $s->getAttribute('id'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | 1140 | my $e_tl = ( $s->findnodes( $self->{xp_tl} ) )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | 1140 | my $e_ar = ( $s->findnodes( $self->{xp_ar} ) )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | 1140 | my $e_dp = ( $s->findnodes( $self->{xp_dp} ) )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | 1140 | ▶ | if ( not $e_tl ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | my %data = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | raw_id => $id, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | classes => $e_tl->getAttribute('f'), # D N S F | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | operator => $e_tl->getAttribute('o'), # coded operator: 03/80/R2/... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | train_no => $e_tl->getAttribute('n'), # dep number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | type => $e_tl->getAttribute('c'), # S/ICE/ERB/... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | station => $station_name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | station_eva => $station_eva + 0, # EVA IDs are numbers | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | station_uic => $station_eva + 0, # deprecated | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | strptime_obj => $self->{strptime_obj}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | #unknown_t => $e_tl->getAttribute('t'), # p | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | 1140 | ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | 1140 | ▶ | if ($e_ar) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | 985 | $data{arrival_ts} = $e_ar->getAttribute('pt'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | 985 | $data{line_no} = $e_ar->getAttribute('l'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 985 | $data{platform} = $e_ar->getAttribute('pp'); # string, not number! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | 985 | $data{route_pre} = $e_ar->getAttribute('ppth'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | 985 | $data{route_start} = $e_ar->getAttribute('pde'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | 985 | $data{transfer} = $e_ar->getAttribute('tra'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | 985 | $data{arrival_hidden} = $e_ar->getAttribute('hi'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | 985 | $data{arrival_wing_ids} = $e_ar->getAttribute('wings'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 1140 | ▶ | if ($e_dp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | 939 | $data{departure_ts} = $e_dp->getAttribute('pt'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | 939 | $data{line_no} = $e_dp->getAttribute('l'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | 939 | $data{platform} = $e_dp->getAttribute('pp'); # string, not number! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | 939 | $data{route_post} = $e_dp->getAttribute('ppth'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | 939 | $data{route_end} = $e_dp->getAttribute('pde'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | 939 | $data{transfer} = $e_dp->getAttribute('tra'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | 939 | $data{departure_hidden} = $e_dp->getAttribute('hi'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | 939 | $data{departure_wing_ids} = $e_dp->getAttribute('wings'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | 1140 | ▶ | if ( $data{arrival_wing_ids} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | 20 | $data{arrival_wing_ids} = [ split( /\|/, $data{arrival_wing_ids} ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | 1140 | ▶ | if ( $data{departure_wing_ids} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | $data{departure_wing_ids} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | 13 | = [ split( /\|/, $data{departure_wing_ids} ) ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | 1140 | my $result = Travel::Status::DE::IRIS::Result->new(%data); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | # if scheduled departure and current departure are not within the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | # same hour, trains are reported twice. Don't add duplicates in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | # that case. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | 1140 | ▶ | if ( not $self->{departure_by_id}{$id} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | 1125 | push( @{ $self->{results} }, $result, ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | 1125 | $self->{departure_by_id}{$id} = $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | 1140 | return $result; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | 0 | ▶ | sub get_timetable_p { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_timetable_p: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | 0 | my ( $self, $eva, $dt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | my $promise = $self->{promise}->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | $self->get_with_cache_p( $self->{main_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | $dt->strftime( $self->{iris_base} . "/plan/${eva}/%y%m%d/%H" ) )->then( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | 0 | my ($raw) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 0 | my ( $xml, $xml_err ) = try_load_xml($raw); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | if ($xml_err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | 0 | $promise->reject( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 662 | 'Failed to parse a schedule part: Invalid XML'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 664 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | my $station | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 666 | = ( $xml->findnodes('/timetable') )[0]->getAttribute('station'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 667 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | for my $s ( $xml->findnodes('/timetable/s') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | $self->add_result( $station, $eva, $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 671 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 672 | 0 | $promise->resolve; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 675 | )->catch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | my ($err) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | $promise->reject($err); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 680 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | )->wait; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | return $promise; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 685 | 30 | ▶ | sub get_timetable { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_timetable: called CC=6 SCAR=19.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 686 | 30 | my ( $self, $eva, $dt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 688 | my ( $raw, $err ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 689 | = $self->get_with_cache( $self->{main_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 690 | 30 | $dt->strftime( $self->{iris_base} . "/plan/${eva}/%y%m%d/%H" ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 691 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 692 | 30 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 693 | 4 | $self->{warnstr} = "Failed to fetch a schedule part: $err"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 694 | 4 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 695 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 697 | 26 | my ( $xml, $xml_err ) = try_load_xml($raw); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 699 | 26 | ▶ | if ($xml_err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | $self->{warnstr} = 'Failed to parse a schedule part: Invalid XML'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 702 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 704 | 26 | my $station = ( $xml->findnodes('/timetable') )[0]->getAttribute('station'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 706 | 26 | for my $s ( $xml->findnodes('/timetable/s') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 708 | 1019 | $self->add_result( $station, $eva, $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 709 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 711 | 26 | ▶ | if ( $self->{developer_mode} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$self->{"developer_mode"} and not scalar $xml->findnodes("/timetable/s")
MC/DC0%0/2
$self->{"developer_mode"} and not scalar $xml->findnodes("/timetable/s")
$self->{"developer_mode"}
not scalar $xml->findnodes("/timetable/s")
Truth table33%1/3
A and not(B)
A= $self->{"developer_mode"}B= not scalar $xml->findnodes("/timetable/s")
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 712 | and not scalar $xml->findnodes('/timetable/s') ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 713 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | say ' no scheduled trains'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 715 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 717 | 26 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | ▶ | sub get_realtime_p { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_realtime_p: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | my ( $self, $eva ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 722 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | my $promise = $self->{promise}->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 725 | $self->get_with_cache_p( $self->{rt_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 726 | $self->{iris_base} . "/fchg/${eva}" )->then( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 728 | 0 | my ($raw) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 729 | 0 | my ( $xml, $xml_err ) = try_load_xml($raw); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | ▶ | if ($xml_err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 731 | 0 | $promise->reject( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 732 | 'Failed to parse a schedule part: Invalid XML'); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 734 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | $self->parse_realtime( $eva, $xml ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 736 | 0 | $promise->resolve; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 738 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 739 | )->catch( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | my ($err) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | $promise->reject("Failed to fetch realtime data: $err"); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 745 | 0 | )->wait; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | return $promise; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 747 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 749 | 10 | ▶ | sub get_realtime { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_realtime: called CC=3 SCAR=12.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 750 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 751 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 752 | 10 | my $eva = $self->{station}{eva}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 754 | my ( $raw, $err ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 755 | = $self->get_with_cache( $self->{rt_cache}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 756 | 10 | $self->{iris_base} . "/fchg/${eva}" ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 758 | 10 | ▶ | if ($err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | $self->{warnstr} = "Failed to fetch realtime data: $err"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 761 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 763 | 10 | my ( $xml, $xml_err ) = try_load_xml($raw); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 765 | 10 | ▶ | if ($xml_err) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | $self->{warnstr} = 'Failed to parse realtime data: Invalid XML'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 767 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 770 | 10 | $self->parse_realtime( $eva, $xml ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 771 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 773 | 10 | ▶ | sub parse_realtime { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
parse_realtime: called CC=15 SCAR=27.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 774 | 10 | my ( $self, $eva, $xml ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 775 | 10 | my $station = ( $xml->findnodes('/timetable') )[0]->getAttribute('station'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 776 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 777 | 10 | for my $s ( $xml->findnodes('/timetable/s') ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 778 | 2547 | my $id = $s->getAttribute('id'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 779 | 2547 | my $e_ar = ( $s->findnodes( $self->{xp_ar} ) )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 780 | 2547 | my $e_dp = ( $s->findnodes( $self->{xp_dp} ) )[0]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 781 | 2547 | my @e_refs = $s->findnodes('./ref/tl'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 782 | 2547 | my @e_ms = $s->findnodes('.//m'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 784 | 2547 | my %messages; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 786 | 2547 | my $result = $self->{departure_by_id}{$id}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 788 | # add_result will return nothing if no ./tl node is present. The ./tl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 789 | # check here is for optimization purposes. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 790 | 2547 | ▶ | if ( not $result and ( $s->findnodes( $self->{xp_tl} ) )[0] ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $result and ($s->findnodes($self->{"xp_tl"}))[0]
MC/DC100%2/2
not $result and ($s->findnodes($self->{"xp_tl"}))[0]
not $result
($s->findnodes($self->{"xp_tl"}))[0]
Truth table100%3/3
not(A) and B
A= not $resultB= ($s->findnodes($self->{"xp_tl"}))[0]
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 791 | 121 | $result = $self->add_result( $station, $eva, $s ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 792 | 121 | ▶ | if ($result) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 793 | 121 | $result->set_unscheduled(1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 796 | 2547 | ▶ | if ( not $result ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 797 | 1720 | next; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 798 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 800 | 827 | ▶ | if ( not $self->{serializable} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 801 | 827 | $result->set_realtime($s); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 802 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 804 | 827 | for my $e_m (@e_ms) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 805 | 3945 | my $type = $e_m->getAttribute('t'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 806 | 3945 | my $value = $e_m->getAttribute('c'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 807 | 3945 | my $cat = $e_m->getAttribute('cat'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 808 | 3945 | my $msgid = $e_m->getAttribute('id'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 809 | 3945 | my $ts = $e_m->getAttribute('ts'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 811 | # 0 and 1 (with key "f") are related to canceled trains and | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 812 | # do not appear to hold information (or at least none we can access). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 813 | # All observed cases of message ID 900 were related to bus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 814 | # connections ("Anschlussbus wartet"). We can't access which bus | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 815 | # it refers to, so we don't show that either. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 816 | # ID 1000 is a generic free text message, which (as we lack access | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 817 | # to the text itself) is not helpful either. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 818 | 3945 | ▶ | if ( defined $value and $value > 1 and $value < 100 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition83%5/6
defined $value and $value > 1 and $value < 100
defined $value and $value > 1
MC/DC66%2/3
defined $value and $value > 1 and $value < 100
defined $value
$value > 1
$value < 100
Truth table75%3/4
A and B and C
A= defined $valueB= $value > 1C= $value < 100
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 819 | 3069 | $messages{$msgid} = [ $ts, $type, $value ]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 820 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 821 | elsif ($cat) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | $messages{$msgid} = [ | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 823 | $ts, $type, $cat, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 824 | $e_m->getAttribute('from'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 825 | $e_m->getAttribute('to') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 826 | ]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 827 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 828 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 829 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 830 | 827 | $result->set_messages(%messages); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 831 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 832 | # note: A departure may also have a ./tl attribute. However, we do | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 833 | # not need to process it because it only matters for departures which | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 834 | # are not planned (or not in the plans we requested). However, in | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 835 | # those cases we already called add_result earlier, which reads ./tl | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 836 | # by itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 837 | 827 | for my $e_ref (@e_refs) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 838 | 1 | $result->add_raw_ref( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 839 | class => $e_ref->getAttribute('f'), # D N S F | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 840 | train_no => $e_ref->getAttribute('n'), # dep number | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 841 | type => $e_ref->getAttribute('c'), # S/ICE/ERB/... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 842 | line_no => $e_ref->getAttribute('l'), # 1 -> S1, ... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 844 | #unknown_t => $e_ref->getAttribute('t'), # p | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 845 | #unknown_o => $e_ref->getAttribute('o'), # owner: 03/80/R2/... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 846 | # TODO ps='a' -> rerouted and normally unscheduled train? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 847 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 848 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 849 | 827 | ▶ | if ($e_ar) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 850 | 760 | $result->set_ar( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 851 | arrival_ts => $e_ar->getAttribute('ct'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 852 | plan_arrival_ts => $e_ar->getAttribute('pt'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 853 | platform => $e_ar->getAttribute('cp'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 854 | route_pre => $e_ar->getAttribute('cpth'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 855 | sched_route_pre => $e_ar->getAttribute('ppth'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 856 | status => $e_ar->getAttribute('cs'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 857 | status_since => $e_ar->getAttribute('clt'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 858 | arrival_hidden => $e_ar->getAttribute('hi'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 860 | # TODO ps='a' -> rerouted and normally unscheduled train? | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 861 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 862 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 863 | 827 | ▶ | if ($e_dp) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 864 | 686 | $result->set_dp( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 865 | departure_ts => $e_dp->getAttribute('ct'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 866 | plan_departure_ts => $e_dp->getAttribute('pt'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 867 | platform => $e_dp->getAttribute('cp'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 868 | route_post => $e_dp->getAttribute('cpth'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 869 | sched_route_post => $e_dp->getAttribute('ppth'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 870 | status => $e_dp->getAttribute('cs'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 871 | departure_hidden => $e_dp->getAttribute('hi'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 872 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 873 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 875 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 877 | 10 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 880 | 22 | ▶ | sub get_result_by_id { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_result_by_id: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 881 | 22 | my ( $self, $id ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 883 | 22 | ▶ | my $res = first { $_->wing_id eq $id } @{ $self->{results} }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 884 | 22 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 885 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | ▶ | sub get_result_by_train { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_result_by_train: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | my ( $self, $type, $train_no ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | ▶ | my $res = first { $_->type eq $type and $_->train_no eq $train_no } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | @{ $self->{results} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | return $res; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 893 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 895 | 10 | ▶ | sub create_wing_refs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_wing_refs: called CC=8 SCAR=20.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 896 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 898 | 10 | for my $r ( $self->results ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 899 | 743 | ▶ | if ( $r->{departure_wing_ids} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 900 | 7 | for my $wing_id ( @{ $r->{departure_wing_ids} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 901 | 8 | my $wingref = $self->get_result_by_id($wing_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 902 | 8 | ▶ | if ($wingref) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 903 | 8 | $r->add_departure_wingref($wingref); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 906 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 907 | 743 | ▶ | if ( $r->{arrival_wing_ids} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 908 | 13 | for my $wing_id ( @{ $r->{arrival_wing_ids} } ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 909 | 14 | my $wingref = $self->get_result_by_id($wing_id); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 910 | 14 | ▶ | if ($wingref) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 911 | 14 | $r->add_arrival_wingref($wingref); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 912 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 915 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 919 | 10 | ▶ | sub create_replacement_refs { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_replacement_refs: called CC=5 SCAR=22.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 920 | 10 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 922 | 10 | for my $r ( $self->results ) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 923 | 743 | ▶ | for my $ref_hash ( @{ $r->{refs} // [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$r->{"refs"} // []
MC/DC0%0/1
$r->{"refs"} // []
$r->{"refs"}
Truth table50%1/2
A
A= $r->{"refs"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 924 | my $ref = $self->get_result_by_train( $ref_hash->{type}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | $ref_hash->{train_no} ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | ▶ | if ($ref) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | $r->add_reference($ref); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 931 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | sub station { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
station: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 934 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 936 | 0 | return $self->{station}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 937 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | ▶ | sub related_stations { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
related_stations: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 942 | 0 | return @{ $self->{related_stations} }; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 945 | 3 | ▶ | sub errstr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
errstr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 946 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 948 | 3 | return $self->{errstr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 949 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 951 | 28 | ▶ | sub results { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
results: called CC=2 SCAR=7.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 952 | 28 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 954 | 28 | ▶ | return @{ $self->{results} // [] }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{"results"} // []
MC/DC0%0/1
$self->{"results"} // []
$self->{"results"}
Truth table50%1/2
A
A= $self->{"results"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 955 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 956 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 957 | 1 | ▶ | sub warnstr { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warnstr: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 958 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 960 | 1 | return $self->{warnstr}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 961 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 963 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 965 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||