Loading lib/Travel/Status/DE/HAFAS/Journey.pm +30 −81 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use 5.014; no if $] >= 5.018, warnings => 'experimental::smartmatch'; use parent 'Class::Accessor'; use Travel::Status::DE::HAFAS::Stop; our $VERSION = '4.09'; Loading Loading @@ -139,10 +140,8 @@ sub new { push( @stops, { name => $loc->{name}, eva => $loc->{extId} + 0, lon => $loc->{crd}{x} * 1e-6, lat => $loc->{crd}{y} * 1e-6, loc => $loc, extra => { sched_arr => $sched_arr, rt_arr => $rt_arr, arr => $rt_arr // $sched_arr, Loading @@ -161,6 +160,7 @@ sub new { platform => $rt_platform // $sched_platform, load => $tco, } } ); $route_end = $loc->{name}; } Loading Loading @@ -338,6 +338,11 @@ sub route { my ($self) = @_; if ( $self->{route} ) { if ( $self->{route}[0] and $self->{route}[0]{extra} ) { $self->{route} = [ map { Travel::Status::DE::HAFAS::Stop->new( %{$_} ) } @{ $self->{route} } ]; } return @{ $self->{route} }; } return; Loading Loading @@ -413,14 +418,6 @@ sub TO_JSON { } } for my $stop ( @{ $ret->{route} } ) { for my $k ( keys %{$stop} ) { if ( ref( $stop->{$k} ) eq 'DateTime' ) { $stop->{$k} = $stop->{$k}->epoch; } } } return $ret; } Loading Loading @@ -598,58 +595,10 @@ UIC/EVA ID of the station at which this journey was requested. =item $journey->route Returns a list of hashes; each hash describes a single journey stop. In stationboard mode, it only contains arrivals prior to the requested station or departures after the requested station. In journey mode, it contains the entire route. Each hash contains the following keys: =over =item * name (name) =item * eva (EVA ID) =item * lon (longitude) =item * lat (latitude) =item * rt_arr (DateTime object for actual arrival) =item * sched_arr (DateTime object for scheduled arrival) =item * arr (DateTime object for actual or scheduled arrival) =item * arr_delay (arrival delay in minutes) =item * arr_cancelled (arrival is cancelled) =item * rt_dep (DateTime object for actual departure) =item * sched_dep (DateTime object for scheduled departure) =item * dep (DateTIme object for actual or scheduled departure) =item * dep_delay (departure delay in minutes) =item * dep_cancelled (departure is cancelled) =item * delay (departure or arrival delay in minutes) =item * direction (direction signage from this stop on, undef if unchanged) =item * rt_platform (actual platform) =item * sched_platform (scheduled platform) =item * platform (actual or scheduled platform) =item * is_changed_platform (true if real-time and scheduled platform disagree) =item * load (expected utilization / passenger load from this stop on) =back Individual entries may be undef. Returns a list of Travel::Status::DE::HAFAS::Stop(3pm) objects that describe individual stops along the journey. In stationboard mode, the list only contains arrivals prior to the requested station or departures after the requested station. In journey mode, it contains the entire route. =item $journey->route_interesting([I<count>]) Loading lib/Travel/Status/DE/HAFAS/Stop.pm +91 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ sub new { my $loc = $opt{loc}; my $ref = { eva => 0 + $loc->{extId}, eva => $loc->{extId} + 0, name => $loc->{name}, lat => $loc->{crd}{x} * 1e-6, lon => $loc->{crd}{y} * 1e-6, Loading @@ -28,6 +28,12 @@ sub new { distance_m => $loc->{dist}, }; if ( $opt{extra} ) { while ( my ( $k, $v ) = each %{ $opt{extra} } ) { $ref->{$k} = $v; } } bless( $ref, $obj ); return $ref; Loading @@ -35,6 +41,20 @@ sub new { # }}} sub TO_JSON { my ($self) = @_; my $ret = { %{$self} }; for my $k ( keys %{$ret} ) { if ( ref( $ret->{$k} ) eq 'DateTime' ) { $ret->{$k} = $ret->{$k}->epoch; } } return $ret; } 1; __END__ Loading Loading @@ -63,8 +83,8 @@ version 4.09 Travel::Status::DE::HAFAS::Stop describes a HAFAS stop. It may be part of a journey or part of a geoSearch / locationSearch request. geoSearch- and locationSearch-specific accessors are annotated accordingly and return undef for non-geoSearch / non-locationSearch stops. Journey-, geoSearch- and locationSearch-specific accessors are annotated accordingly and return undef in other contexts. =head1 METHODS Loading Loading @@ -97,6 +117,74 @@ Distance in meters between the requested coordinates and this stop. Weight / Relevance / Importance of this stop using an unknown metric. Higher values indicate more relevant stops. =item $stop->rt_arr (journey) DateTime object for actual arrival. =item $stop->sched_arr (journey) DateTime object for scheduled arrival. =item $stop->arr (journey) DateTime object for actual or scheduled arrival. =item $stop->arr_delay (journey) Arrival delay in minutes. =item $stop->arr_cancelled (journey) Arrival is cancelled. =item $stop->rt_dep (journey) DateTime object for actual departure. =item $stop->sched_dep (journey) DateTime object for scheduled departure. =item $stop->dep (journey) DateTIme object for actual or scheduled departure. =item $stop->dep_delay (journey) Departure delay in minutes. =item $stop->dep_cancelled (journey) Departure is cancelled. =item $stop->delay (journey) Departure or arrival delay in minutes. =item $stop->direction (journey) Direction signage from this stop on, undef if unchanged. =item $stop->rt_platform (journey) Actual platform. =item $stop->sched_platform (journey) Scheduled platform. =item $stop->platform (journey) Actual or scheduled platform. =item $stop->is_changed_platform (journey) True if real-time and scheduled platform disagree. =item $stop->load (journey) Expected utilization / passenger load from this stop on. =back =head1 DIAGNOSTICS Loading Loading
lib/Travel/Status/DE/HAFAS/Journey.pm +30 −81 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ use 5.014; no if $] >= 5.018, warnings => 'experimental::smartmatch'; use parent 'Class::Accessor'; use Travel::Status::DE::HAFAS::Stop; our $VERSION = '4.09'; Loading Loading @@ -139,10 +140,8 @@ sub new { push( @stops, { name => $loc->{name}, eva => $loc->{extId} + 0, lon => $loc->{crd}{x} * 1e-6, lat => $loc->{crd}{y} * 1e-6, loc => $loc, extra => { sched_arr => $sched_arr, rt_arr => $rt_arr, arr => $rt_arr // $sched_arr, Loading @@ -161,6 +160,7 @@ sub new { platform => $rt_platform // $sched_platform, load => $tco, } } ); $route_end = $loc->{name}; } Loading Loading @@ -338,6 +338,11 @@ sub route { my ($self) = @_; if ( $self->{route} ) { if ( $self->{route}[0] and $self->{route}[0]{extra} ) { $self->{route} = [ map { Travel::Status::DE::HAFAS::Stop->new( %{$_} ) } @{ $self->{route} } ]; } return @{ $self->{route} }; } return; Loading Loading @@ -413,14 +418,6 @@ sub TO_JSON { } } for my $stop ( @{ $ret->{route} } ) { for my $k ( keys %{$stop} ) { if ( ref( $stop->{$k} ) eq 'DateTime' ) { $stop->{$k} = $stop->{$k}->epoch; } } } return $ret; } Loading Loading @@ -598,58 +595,10 @@ UIC/EVA ID of the station at which this journey was requested. =item $journey->route Returns a list of hashes; each hash describes a single journey stop. In stationboard mode, it only contains arrivals prior to the requested station or departures after the requested station. In journey mode, it contains the entire route. Each hash contains the following keys: =over =item * name (name) =item * eva (EVA ID) =item * lon (longitude) =item * lat (latitude) =item * rt_arr (DateTime object for actual arrival) =item * sched_arr (DateTime object for scheduled arrival) =item * arr (DateTime object for actual or scheduled arrival) =item * arr_delay (arrival delay in minutes) =item * arr_cancelled (arrival is cancelled) =item * rt_dep (DateTime object for actual departure) =item * sched_dep (DateTime object for scheduled departure) =item * dep (DateTIme object for actual or scheduled departure) =item * dep_delay (departure delay in minutes) =item * dep_cancelled (departure is cancelled) =item * delay (departure or arrival delay in minutes) =item * direction (direction signage from this stop on, undef if unchanged) =item * rt_platform (actual platform) =item * sched_platform (scheduled platform) =item * platform (actual or scheduled platform) =item * is_changed_platform (true if real-time and scheduled platform disagree) =item * load (expected utilization / passenger load from this stop on) =back Individual entries may be undef. Returns a list of Travel::Status::DE::HAFAS::Stop(3pm) objects that describe individual stops along the journey. In stationboard mode, the list only contains arrivals prior to the requested station or departures after the requested station. In journey mode, it contains the entire route. =item $journey->route_interesting([I<count>]) Loading
lib/Travel/Status/DE/HAFAS/Stop.pm +91 −3 Original line number Diff line number Diff line Loading @@ -20,7 +20,7 @@ sub new { my $loc = $opt{loc}; my $ref = { eva => 0 + $loc->{extId}, eva => $loc->{extId} + 0, name => $loc->{name}, lat => $loc->{crd}{x} * 1e-6, lon => $loc->{crd}{y} * 1e-6, Loading @@ -28,6 +28,12 @@ sub new { distance_m => $loc->{dist}, }; if ( $opt{extra} ) { while ( my ( $k, $v ) = each %{ $opt{extra} } ) { $ref->{$k} = $v; } } bless( $ref, $obj ); return $ref; Loading @@ -35,6 +41,20 @@ sub new { # }}} sub TO_JSON { my ($self) = @_; my $ret = { %{$self} }; for my $k ( keys %{$ret} ) { if ( ref( $ret->{$k} ) eq 'DateTime' ) { $ret->{$k} = $ret->{$k}->epoch; } } return $ret; } 1; __END__ Loading Loading @@ -63,8 +83,8 @@ version 4.09 Travel::Status::DE::HAFAS::Stop describes a HAFAS stop. It may be part of a journey or part of a geoSearch / locationSearch request. geoSearch- and locationSearch-specific accessors are annotated accordingly and return undef for non-geoSearch / non-locationSearch stops. Journey-, geoSearch- and locationSearch-specific accessors are annotated accordingly and return undef in other contexts. =head1 METHODS Loading Loading @@ -97,6 +117,74 @@ Distance in meters between the requested coordinates and this stop. Weight / Relevance / Importance of this stop using an unknown metric. Higher values indicate more relevant stops. =item $stop->rt_arr (journey) DateTime object for actual arrival. =item $stop->sched_arr (journey) DateTime object for scheduled arrival. =item $stop->arr (journey) DateTime object for actual or scheduled arrival. =item $stop->arr_delay (journey) Arrival delay in minutes. =item $stop->arr_cancelled (journey) Arrival is cancelled. =item $stop->rt_dep (journey) DateTime object for actual departure. =item $stop->sched_dep (journey) DateTime object for scheduled departure. =item $stop->dep (journey) DateTIme object for actual or scheduled departure. =item $stop->dep_delay (journey) Departure delay in minutes. =item $stop->dep_cancelled (journey) Departure is cancelled. =item $stop->delay (journey) Departure or arrival delay in minutes. =item $stop->direction (journey) Direction signage from this stop on, undef if unchanged. =item $stop->rt_platform (journey) Actual platform. =item $stop->sched_platform (journey) Scheduled platform. =item $stop->platform (journey) Actual or scheduled platform. =item $stop->is_changed_platform (journey) True if real-time and scheduled platform disagree. =item $stop->load (journey) Expected utilization / passenger load from this stop on. =back =head1 DIAGNOSTICS Loading