| 1 | package Travel::Status::DE::HAFAS::Stop; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | # vim:foldmethod=marker | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 5 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 5 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 5 | ▶ | use 5.014; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 5 | ▶ | use parent 'Class::Accessor'; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 5 | our $VERSION = '6.25'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 5 | Travel::Status::DE::HAFAS::Stop->mk_ro_accessors( | |||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | qw(loc | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | rt_arr sched_arr arr arr_delay arr_cancelled prod_arr | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | rt_dep sched_dep dep dep_delay dep_cancelled prod_dep | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | delay direction | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | rt_platform sched_platform platform is_changed_platform | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | is_additional tz_offset | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | load | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | ) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | # {{{ Constructor | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 85 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=29 SCAR=35.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 85 | my ( $obj, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 85 | my $stop = $opt{stop}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 85 | my $common = $opt{common}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 85 | my $prodL = $opt{prodL}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 85 | my $date = $opt{date}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 85 | my $datetime_ref = $opt{datetime_ref}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 85 | my $hafas = $opt{hafas}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 85 | my $strp_obj = $opt{hafas}{strptime_obj}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | my $prod_arr | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 85 | ▶ | = defined $stop->{aProdX} ? $prodL->[ $stop->{aProdX} ] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | my $prod_dep | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 85 | ▶ | = defined $stop->{dProdX} ? $prodL->[ $stop->{dProdX} ] : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | # dIn. / aOut. -> may passengers enter / exit the train? | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | my $sched_platform = $stop->{aPlatfS} // $stop->{dPlatfS} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 85 | ▶ | // $stop->{aPltfS}{txt} // $stop->{dPltfS}{txt}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition77%7/9
(($stop->{"aPlatfS"} // $stop->{"dPlatfS"}) // $stop->{"aPltfS"}{"txt"}) // $stop->{"dPltfS"}{"txt"}
($stop->{"aPlatfS"} // $stop->{"dPlatfS"}) // $stop->{"aPltfS"}{"txt"}
$stop->{"aPlatfS"} // $stop->{"dPlatfS"}
MC/DC50%2/4
(($stop->{"aPlatfS"} // $stop->{"dPlatfS"}) // $stop->{"aPltfS"}{"txt"}) // $stop->{"dPltfS"}{"txt"}
$stop->{"aPlatfS"}
$stop->{"dPlatfS"}
$stop->{"aPltfS"}{"txt"}
$stop->{"dPltfS"}{"txt"}
Truth table60%3/5
A // B // C // D
A= $stop->{"aPlatfS"}B= $stop->{"dPlatfS"}C= $stop->{"aPltfS"}{"txt"}D= $stop->{"dPltfS"}{"txt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | my $rt_platform = $stop->{aPlatfR} // $stop->{dPlatfR} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 85 | ▶ | // $stop->{aPltfR}{txt} // $stop->{dPltfR}{txt}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%6/9
(($stop->{"aPlatfR"} // $stop->{"dPlatfR"}) // $stop->{"aPltfR"}{"txt"}) // $stop->{"dPltfR"}{"txt"}
($stop->{"aPlatfR"} // $stop->{"dPlatfR"}) // $stop->{"aPltfR"}{"txt"}
$stop->{"aPlatfR"} // $stop->{"dPlatfR"}
MC/DC25%1/4
(($stop->{"aPlatfR"} // $stop->{"dPlatfR"}) // $stop->{"aPltfR"}{"txt"}) // $stop->{"dPltfR"}{"txt"}
$stop->{"aPlatfR"}
$stop->{"dPlatfR"}
$stop->{"aPltfR"}{"txt"}
$stop->{"dPltfR"}{"txt"}
Truth table40%2/5
A // B // C // D
A= $stop->{"aPlatfR"}B= $stop->{"dPlatfR"}C= $stop->{"aPltfR"}{"txt"}D= $stop->{"dPltfR"}{"txt"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 85 | ▶ | my $changed_platform = $stop->{aPlatfCh} // $stop->{dPlatfCh}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$stop->{"aPlatfCh"} // $stop->{"dPlatfCh"}
MC/DC50%1/2
$stop->{"aPlatfCh"} // $stop->{"dPlatfCh"}
$stop->{"aPlatfCh"}
$stop->{"dPlatfCh"}
Truth table66%2/3
A // B
A= $stop->{"aPlatfCh"}B= $stop->{"dPlatfCh"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 85 | my $arr_cancelled = $stop->{aCncl}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 85 | my $dep_cancelled = $stop->{dCncl}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 85 | my $is_additional = $stop->{isAdd}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | my $ref = { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | loc => $opt{loc}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | direction => $stop->{dDirTxt}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 85 | ▶ | sched_platform => $sched_platform, | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$rt_platform // $sched_platform
MC/DC100%2/2
$rt_platform // $sched_platform
$rt_platform
$sched_platform
Truth table100%3/3
A // B
A= $rt_platformB= $sched_platform
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | rt_platform => $rt_platform, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | is_changed_platform => $changed_platform, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | platform => $rt_platform // $sched_platform, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | arr_cancelled => $arr_cancelled, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | dep_cancelled => $dep_cancelled, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | is_additional => $is_additional, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | prod_arr => $prod_arr, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | prod_dep => $prod_dep, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | }; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 85 | bless( $ref, $obj ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | my $sched_arr = $ref->handle_day_change( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | input => $stop->{aTimeS}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | offset => $stop->{aTZOffset}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 85 | date => $date, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | strp_obj => $strp_obj, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | ref => $datetime_ref | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | my $rt_arr = $ref->handle_day_change( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | input => $stop->{aTimeR}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | offset => $stop->{aTZOffset}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 85 | date => $date, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | strp_obj => $strp_obj, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | ref => $datetime_ref | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | my $sched_dep = $ref->handle_day_change( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | input => $stop->{dTimeS}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | offset => $stop->{dTZOffset}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 85 | date => $date, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | strp_obj => $strp_obj, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | ref => $datetime_ref | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | my $rt_dep = $ref->handle_day_change( | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | input => $stop->{dTimeR}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | offset => $stop->{dTZOffset}, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 85 | date => $date, | |||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | strp_obj => $strp_obj, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | ref => $datetime_ref | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | $ref->{arr_delay} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 85 | ▶ | = ( $sched_arr and $rt_arr ) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$sched_arr and $rt_arr
MC/DC100%2/2
$sched_arr and $rt_arr
$sched_arr
$rt_arr
Truth table100%3/3
A and B
A= $sched_arrB= $rt_arr
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | ? ( $rt_arr->epoch - $sched_arr->epoch ) / 60 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | $ref->{dep_delay} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 85 | ▶ | = ( $sched_dep and $rt_dep ) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$sched_dep and $rt_dep
MC/DC100%2/2
$sched_dep and $rt_dep
$sched_dep
$rt_dep
Truth table100%3/3
A and B
A= $sched_depB= $rt_dep
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | ? ( $rt_dep->epoch - $sched_dep->epoch ) / 60 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 85 | ▶ | $ref->{delay} = $ref->{dep_delay} // $ref->{arr_delay}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$ref->{"dep_delay"} // $ref->{"arr_delay"}
MC/DC100%2/2
$ref->{"dep_delay"} // $ref->{"arr_delay"}
$ref->{"dep_delay"}
$ref->{"arr_delay"}
Truth table100%3/3
A // B
A= $ref->{"dep_delay"}B= $ref->{"arr_delay"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 85 | $ref->{sched_arr} = $sched_arr; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 85 | $ref->{sched_dep} = $sched_dep; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 85 | $ref->{rt_arr} = $rt_arr; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 85 | $ref->{rt_dep} = $rt_dep; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 85 | ▶ | $ref->{arr} = $rt_arr // $sched_arr; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$rt_arr // $sched_arr
MC/DC100%2/2
$rt_arr // $sched_arr
$rt_arr
$sched_arr
Truth table100%3/3
A // B
A= $rt_arrB= $sched_arr
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 85 | ▶ | $ref->{dep} = $rt_dep // $sched_dep; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%3/3
$rt_dep // $sched_dep
MC/DC100%2/2
$rt_dep // $sched_dep
$rt_dep
$sched_dep
Truth table100%3/3
A // B
A= $rt_depB= $sched_dep
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | 85 | my @messages; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | 85 | ▶ | for my $msg ( @{ $stop->{msgL} // [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$stop->{"msgL"} // []
MC/DC100%1/1
$stop->{"msgL"} // []
$stop->{"msgL"}
Truth table100%2/2
A
A= $stop->{"msgL"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 7 | ▶ | if ( $msg->{type} eq 'REM' and defined $msg->{remX} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$msg->{"type"} eq "REM" and defined $msg->{"remX"}
MC/DC0%0/2
$msg->{"type"} eq "REM" and defined $msg->{"remX"}
$msg->{"type"} eq "REM"
defined $msg->{"remX"}
Truth table33%1/3
A and B
A= $msg->{"type"} eq "REM"B= defined $msg->{"remX"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | push( @messages, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 7 | $hafas->add_message( $opt{common}{remL}[ $msg->{remX} ] ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | ▶ | elsif ( $msg->{type} eq 'HIM' and defined $msg->{himX} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$msg->{"type"} eq "HIM" and defined $msg->{"himX"}
MC/DC0%0/2
$msg->{"type"} eq "HIM" and defined $msg->{"himX"}
$msg->{"type"} eq "HIM"
defined $msg->{"himX"}
Truth table0%0/3
A and B
A= $msg->{"type"} eq "HIM"B= defined $msg->{"himX"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | push( @messages, | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $hafas->add_message( $opt{common}{himL}[ $msg->{himX} ], 1 ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | say "Unknown message type $msg->{type}"; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 85 | $ref->{messages} = \@messages; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | 85 | $ref->{load} = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 85 | ▶ | for my $tco_id ( @{ $stop->{dTrnCmpSX}{tcocX} // [] } ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$stop->{"dTrnCmpSX"}{"tcocX"} // []
MC/DC100%1/1
$stop->{"dTrnCmpSX"}{"tcocX"} // []
$stop->{"dTrnCmpSX"}{"tcocX"}
Truth table100%2/2
A
A= $stop->{"dTrnCmpSX"}{"tcocX"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | 60 | my $tco_kv = $common->{tcocL}[$tco_id]; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | # BVG has rRT (real-time?) and r (prognosed?); others only have r | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | 60 | ▶ | my $load = $tco_kv->{rRT} // $tco_kv->{r}; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$tco_kv->{"rRT"} // $tco_kv->{"r"}
MC/DC0%0/2
$tco_kv->{"rRT"} // $tco_kv->{"r"}
$tco_kv->{"rRT"}
$tco_kv->{"r"}
Truth table33%1/3
A // B
A= $tco_kv->{"rRT"}B= $tco_kv->{"r"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | # BVG uses 11 .. 13 rather than 1 .. 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | 60 | ▶ | if ( defined $load and $load > 10 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $load and $load > 10
MC/DC0%0/2
defined $load and $load > 10
defined $load
$load > 10
Truth table33%1/3
A and B
A= defined $loadB= $load > 10
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $load -= 10; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 60 | $ref->{load}{ $tco_kv->{c} } = $load; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | 85 | return $ref; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | # }}} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | 400 | ▶ | sub handle_day_change { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
handle_day_change: called CC=5 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 400 | my ( $self, %opt ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | 400 | my $date = $opt{date}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 400 | my $timestr = $opt{input}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | 400 | my $offset = $opt{offset}; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 400 | ▶ | if ( not defined $timestr ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | 190 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 210 | ▶ | if ( length($timestr) == 8 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | # arrival time includes a day offset | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 2 | my $offset_date = $opt{ref}->clone; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 2 | $offset_date->add( days => substr( $timestr, 0, 2, q{} ) ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | 2 | $offset_date = $offset_date->strftime('%Y%m%d'); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | 2 | $timestr = $opt{strp_obj}->parse_datetime("${offset_date}T${timestr}"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | 208 | $timestr = $opt{strp_obj}->parse_datetime("${date}T${timestr}"); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 210 | ▶ | if ( defined $offset and $offset != $timestr->offset / 60 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $offset and $offset != $timestr->offset / 60
MC/DC0%0/2
defined $offset and $offset != $timestr->offset / 60
defined $offset
$offset != $timestr->offset / 60
Truth table33%1/3
A and B
A= defined $offsetB= $offset != $timestr->offset / 60
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $self->{tz_offset} = $offset - $timestr->offset / 60; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | $timestr->subtract( minutes => $self->{tz_offset} ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 210 | return $timestr; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | sub messages { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
messages: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | ▶ | if ( $self->{messages} ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | return @{ $self->{messages} }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub TO_JSON { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
TO_JSON: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my $ret = { %{$self} }; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | for my $k ( keys %{$ret} ) { | |||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | if ( ref( $ret->{$k} ) eq 'DateTime' ) { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | $ret->{$k} = $ret->{$k}->epoch; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | 5 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||