summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-11-19 12:49:41 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-11-19 12:49:41 +0100
commit1c82ee17d2fa06a79fe3b96883d603408b4fe74a (patch)
tree3eb7216bc56cfd2ae52b89969325ea0e3358a795
parentcfb45724bbc0cfcd2847dc0847d434bdcef0f2e2 (diff)
Replace built-in Location package with Travel::Status::DE::HAFAS::Location
-rw-r--r--Build.PL31
-rw-r--r--cpanfile3
-rw-r--r--lib/Travel/Routing/DE/HAFAS.pm4
-rw-r--r--lib/Travel/Routing/DE/HAFAS/Connection.pm4
-rw-r--r--lib/Travel/Routing/DE/HAFAS/Connection/Section.pm4
-rw-r--r--lib/Travel/Routing/DE/HAFAS/Location.pm104
6 files changed, 24 insertions, 126 deletions
diff --git a/Build.PL b/Build.PL
index 564f909..f80720a 100644
--- a/Build.PL
+++ b/Build.PL
@@ -17,21 +17,22 @@ Module::Build->new(
module_name => 'Travel::Routing::DE::HAFAS',
license => 'perl',
requires => {
- 'perl' => '5.14.0',
- 'Carp' => 0,
- 'Class::Accessor' => '0.16',
- 'DateTime' => 0,
- 'DateTime::Duration' => 0,
- 'DateTime::Format::Strptime' => 0,
- 'Digest::MD5' => 0,
- 'Getopt::Long' => 0,
- 'JSON' => 0,
- 'List::MoreUtils' => 0,
- 'List::Util' => 0,
- 'LWP::UserAgent' => 0,
- 'LWP::Protocol::https' => 0,
- 'Travel::Status::DE::HAFAS' => 0,
- 'Travel::Status::DE::HAFAS::Message' => '4.19',
+ 'perl' => '5.14.0',
+ 'Carp' => 0,
+ 'Class::Accessor' => '0.16',
+ 'DateTime' => 0,
+ 'DateTime::Duration' => 0,
+ 'DateTime::Format::Strptime' => 0,
+ 'Digest::MD5' => 0,
+ 'Getopt::Long' => 0,
+ 'JSON' => 0,
+ 'List::MoreUtils' => 0,
+ 'List::Util' => 0,
+ 'LWP::UserAgent' => 0,
+ 'LWP::Protocol::https' => 0,
+ 'Travel::Status::DE::HAFAS' => 0,
+ 'Travel::Status::DE::HAFAS::Location' => '5.00',
+ 'Travel::Status::DE::HAFAS::Message' => '4.19',
},
script_files => 'bin/',
sign => 1,
diff --git a/cpanfile b/cpanfile
index 7722f7f..42c9567 100644
--- a/cpanfile
+++ b/cpanfile
@@ -10,7 +10,8 @@ requires 'List::Util';
requires 'LWP::UserAgent';
requires 'LWP::Protocol::https';
requires 'Travel::Status::DE::HAFAS';
-requires 'Travel::Status::DE::HAFAS::Message', '4.19';
+requires 'Travel::Status::DE::HAFAS::Location', '5.00';
+requires 'Travel::Status::DE::HAFAS::Message', '4.19';
on test => sub {
requires 'Test::Compile';
diff --git a/lib/Travel/Routing/DE/HAFAS.pm b/lib/Travel/Routing/DE/HAFAS.pm
index 32eb6f0..4890c3c 100644
--- a/lib/Travel/Routing/DE/HAFAS.pm
+++ b/lib/Travel/Routing/DE/HAFAS.pm
@@ -15,7 +15,7 @@ use Encode qw(decode encode);
use JSON;
use LWP::UserAgent;
use Travel::Routing::DE::HAFAS::Connection;
-use Travel::Routing::DE::HAFAS::Location;
+use Travel::Status::DE::HAFAS::Location;
use Travel::Status::DE::HAFAS::Message;
our $VERSION = '0.01';
@@ -517,7 +517,7 @@ sub check_mgate {
sub parse_trips {
my ($self) = @_;
- my @locL = map { Travel::Routing::DE::HAFAS::Location->new( loc => $_ ) }
+ my @locL = map { Travel::Status::DE::HAFAS::Location->new( loc => $_ ) }
@{ $self->{raw_json}{svcResL}[0]{res}{common}{locL} // [] };
my @conL = @{ $self->{raw_json}{svcResL}[0]{res}{outConL} // [] };
diff --git a/lib/Travel/Routing/DE/HAFAS/Connection.pm b/lib/Travel/Routing/DE/HAFAS/Connection.pm
index bc587fc..64583e9 100644
--- a/lib/Travel/Routing/DE/HAFAS/Connection.pm
+++ b/lib/Travel/Routing/DE/HAFAS/Connection.pm
@@ -208,7 +208,7 @@ if available, falls back to schedule data otherwise.
=item $connection->arr_loc
-Travel::Routing::DE::HAFAS::Location(3pm) object describing the arrival stop.
+Travel::Status::DE::HAFAS::Location(3pm) object describing the arrival stop.
=item $connection->arr_platform
@@ -230,7 +230,7 @@ data if available, falls back to schedule data otherwise.
=item $connection->dep_loc
-Travel::Routing::DE::HAFAS::Location(3pm) object describing the departure stop.
+Travel::Status::DE::HAFAS::Location(3pm) object describing the departure stop.
=item $connection->dep_platform
diff --git a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm
index 375398b..b298419 100644
--- a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm
+++ b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm
@@ -231,7 +231,7 @@ Arrival delay in minutes. Undef if unknown.
=item $section->arr_loc
-Travel::Routing::DE::HAFAS::Location(3pm) object describing the arrival stop.
+Travel::Status::DE::HAFAS::Location(3pm) object describing the arrival stop.
=item $section->arr_platform
@@ -253,7 +253,7 @@ Departure dlay in minutes. Undef if unknown.
=item $section->dep_loc
-Travel::Routing::DE::HAFAS::Location(3pm) object describing the departure stop.
+Travel::Status::DE::HAFAS::Location(3pm) object describing the departure stop.
=item $section->dep_platform
diff --git a/lib/Travel/Routing/DE/HAFAS/Location.pm b/lib/Travel/Routing/DE/HAFAS/Location.pm
deleted file mode 100644
index a852a55..0000000
--- a/lib/Travel/Routing/DE/HAFAS/Location.pm
+++ /dev/null
@@ -1,104 +0,0 @@
-package Travel::Routing::DE::HAFAS::Location;
-
-use strict;
-use warnings;
-use 5.014;
-
-use parent 'Class::Accessor';
-
-our $VERSION = '0.01';
-
-Travel::Routing::DE::HAFAS::Location->mk_ro_accessors(
- qw(lid type name eva state coordinate));
-
-sub new {
- my ( $obj, %opt ) = @_;
-
- my $loc = $opt{loc};
-
- my $ref = {
- lid => $loc->{lid},
- type => $loc->{type},
- name => $loc->{name},
- eva => 0 + $loc->{extId},
- state => $loc->{state},
- coordinate => $loc->{crd}
- };
-
- bless( $ref, $obj );
-
- return $ref;
-}
-
-sub TO_JSON {
- my ($self) = @_;
-
- my $ret = { %{$self} };
-
- return $ret;
-}
-
-1;
-
-__END__
-
-=head1 NAME
-
-Travel::Routing::DE::HAFAS::Location - A single public transit stop
-
-=head1 SYNOPSIS
-
- printf("Destination: %s (%8d)\n", $stop->name, $stop->eva);
-
-=head1 VERSION
-
-version 0.01
-
-=head1 DESCRIPTION
-
-Travel::Routing::DE::HAFAS::Stop describes a HAFAS stop that is part of
-a connection, connection section, or (partial) journey.
-
-=head1 METHODS
-
-=head2 ACCESSORS
-
-=over
-
-=item $stop->name
-
-Stop name, e.g. "Essen Hbf" or "Unter den Linden/B75, Tostedt".
-
-=item $stop->eva
-
-EVA ID, e.g. 8000080.
-
-=back
-
-=head1 DIAGNOSTICS
-
-None.
-
-=head1 DEPENDENCIES
-
-=over
-
-=item Class::Accessor(3pm)
-
-=back
-
-=head1 BUGS AND LIMITATIONS
-
-None known.
-
-=head1 SEE ALSO
-
-Travel::Routing::DE::HAFAS(3pm).
-
-=head1 AUTHOR
-
-Copyright (C) 2023 by Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt>
-
-=head1 LICENSE
-
-This module is licensed under the same terms as Perl itself.