summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog10
-rw-r--r--README.md6
-rwxr-xr-xbin/hafas43
-rw-r--r--cpanfile2
-rw-r--r--lib/Travel/Routing/DE/HAFAS.pm28
-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/Utils.pm4
-rwxr-xr-xscripts/makedeb-docker-helper4
9 files changed, 65 insertions, 40 deletions
diff --git a/Changelog b/Changelog
index 13de410..de4a053 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,13 @@
+Travel::Routing::DE::HAFAS 0.10 - Sun Jan 19 2025
+
+ * DB HAFAS is dead.
+ * hafas: Use VRN by default and adjust documentation.
+ * HAFAS: The service option is now mandatory; adjust documentation.
+
+Travel::Routing::DE::HAFAS 0.09 - Wed Nov 20 2024
+
+ * Improve handling of backend messages and errors
+
Travel::Routing::DE::HAFAS 0.08 - Tue Jun 11 2024
* Adjust walking connection segment handling for DB HAFAS update on
diff --git a/README.md b/README.md
index f4f9511..aaa3e2d 100644
--- a/README.md
+++ b/README.md
@@ -28,11 +28,11 @@ Debian repository and are not covered by its quality assurance process.
To install the latest release, run:
```
-wget https://lib.finalrewind.org/deb/libtravel-status-de-deutschebahn-perl_latest_all.deb \
+wget https://lib.finalrewind.org/deb/libtravel-status-de-hafas-perl_latest_all.deb \
https://lib.finalrewind.org/deb/libtravel-routing-de-hafas-perl_latest_all.deb
-sudo apt install ./libtravel-status-de-deutschebahn-perl_latest_all.deb \
+sudo apt install ./libtravel-status-de-hafas-perl_latest_all.deb \
./libtravel-routing-de-hafas-perl_latest_all.deb
-rm libtravel-status-de-deutschebahn-perl_latest_all.deb \
+rm libtravel-status-de-hafas-perl_latest_all.deb \
libtravel-routing-de-hafas-perl_latest_all.deb
```
diff --git a/bin/hafas b/bin/hafas
index 5c57d3e..d7dc9d3 100755
--- a/bin/hafas
+++ b/bin/hafas
@@ -3,7 +3,7 @@ use strict;
use warnings;
use 5.014;
-our $VERSION = '0.08';
+our $VERSION = '0.10';
use utf8;
use DateTime;
@@ -70,17 +70,29 @@ GetOptions(
) or show_help(1);
if ($list_services) {
- printf( "%-40s %-14s %s\n\n", 'operator', 'abbr. (-s)', 'languages (-l)' );
+ printf(
+ "%-40s %-14s %-15s %s\n\n",
+ 'operator', 'abbr. (-s)', 'languages (-l)',
+ 'time zone'
+ );
for my $service ( Travel::Routing::DE::HAFAS::get_services() ) {
+ if ( $service->{shortname} eq 'DB' ) {
+ next;
+ }
printf(
- "%-40s %-14s %s\n",
- @{$service}{qw(name shortname)},
- join( q{ }, @{ $service->{languages} // [] } )
+ "%-40s%1s %-14s %-15s %s\n",
+ $service->{name},
+ $service->{geoip_lock} ? q{!} : q{ },
+ $service->{shortname},
+ join( q{ }, @{ $service->{languages} // [] } ),
+ $service->{time_zone} // q{},
);
}
exit 0;
}
+$service //= 'VRN';
+
parse_mot_options();
my ( $from_stop, @via_stops ) = @ARGV;
@@ -164,7 +176,7 @@ sub parse_mot_options {
for my $type ( split( qr{,}, $types ) ) {
if ( $type eq 'help' or $type eq 'list' or $type eq q{?} ) {
- $service //= 'DB';
+ $service //= 'VRN';
my $desc = Travel::Routing::DE::HAFAS::get_service($service);
if ($desc) {
my @mots = @{ $desc->{productbits} };
@@ -291,7 +303,7 @@ sub show_message {
}
if ( my $err = $hafas->errstr ) {
- say STDERR "Request error: ${err}";
+ say STDERR "Backend error: ${err}";
if ( $hafas->errcode ) {
if ( $hafas->errcode eq 'H730' or $hafas->errcode eq 'LOCATION' ) {
show_similar_stops();
@@ -489,7 +501,7 @@ __END__
=head1 NAME
-hafas - Interface to HAFAS (e.g. Deutsche Bahn) itinerary services
+hafas - Interface to HAFAS-based itinerary services
=head1 SYNOPSIS
@@ -498,13 +510,12 @@ B<hafas> [B<-d> I<date>] [B<-t> I<time>] [B<-m> I<motlist>]
=head1 VERSION
-version 0.08
+version 0.10
=head1 DESCRIPTION
B<hafas> is a command line client for HAFAS-based public transit itinerary
-services, e.g. the one operated by Deutsche Bahn. It requests connections
-between two stops and prints the results.
+services. It requests connections between two stops and prints the results.
=head1 OPTIONS
@@ -549,6 +560,10 @@ Note that requesting an invalid/unsupported language may lead to garbage output.
List known HAFAS installations and exit. Use B<-s>|B<--service> to select an
operator from this list for a HAFAS request.
+Instances marked with an exclamation mark (C<< ! >>) are behind a GeoIP filter
+and may need a proxy to work. See the documentation of get_active_service in
+Travel::Status::DE::HAFAS(3pm) for details.
+
=item B<-m>, B<--mot> I<motlist>
By default, B<hafas> considers all modes of transport for routing. With
@@ -563,8 +578,8 @@ The I<mot> types depend on the used service. Use C<< -m help >> to list them.
=item B<-s>, B<--service> I<service>
-Use the API provided by I<service> for routing; defaults to DB (Deutsche Bahn).
-See B<--list> for a list of known services.
+Use the API provided by I<service> for routing; defaults to VRN
+(Verkehrsverbund Rhein-Neckar). See B<--list> for a list of known services.
=item B<-t>, B<--time>, B<--depart> I<hh>:I<mm>
@@ -618,7 +633,7 @@ None.
=head1 BUGS AND LIMITATIONS
-The non-default services (anything other than DB) are not well-tested.
+Some services are not well-tested.
=head1 AUTHOR
diff --git a/cpanfile b/cpanfile
index 9ae4e1b..7630cbc 100644
--- a/cpanfile
+++ b/cpanfile
@@ -9,7 +9,7 @@ requires 'List::MoreUtils';
requires 'List::Util';
requires 'LWP::UserAgent';
requires 'LWP::Protocol::https';
-requires 'Travel::Status::DE::HAFAS', '6.02';
+requires 'Travel::Status::DE::HAFAS', '6.19';
on test => sub {
requires 'Test::Compile';
diff --git a/lib/Travel/Routing/DE/HAFAS.pm b/lib/Travel/Routing/DE/HAFAS.pm
index 62ec34c..692b48c 100644
--- a/lib/Travel/Routing/DE/HAFAS.pm
+++ b/lib/Travel/Routing/DE/HAFAS.pm
@@ -19,7 +19,7 @@ use Travel::Status::DE::HAFAS;
use Travel::Status::DE::HAFAS::Location;
use Travel::Status::DE::HAFAS::Message;
-our $VERSION = '0.08';
+our $VERSION = '0.10';
# {{{ Endpoint Definition
@@ -46,7 +46,7 @@ sub new {
}
if ( not defined $service ) {
- $service = $conf{service} = 'DB';
+ confess("The service option is mandatory");
}
if ( defined $service and not exists $hafas_instance{$service} ) {
@@ -437,10 +437,10 @@ sub add_message {
for my $message ( @{ $self->{messages} } ) {
if (
(
- not( not defined $code or not defined $message->{code} )
+ not( defined $code and defined $message->{code} )
or $code eq $message->{code}
)
- and ( not( not defined $text or not defined $message->{text} )
+ and ( not( defined $text and defined $message->{text} )
or $text eq $message->{text} )
)
{
@@ -527,6 +527,7 @@ Travel::Routing::DE::HAFAS - Interface to HAFAS itinerary services
use Travel::Routing::DE::HAFAS;
my $hafas = Travel::Routing::DE::HAFAS->new(
+ service => 'VRN',
from_stop => 'Eichlinghofen H-Bahn, Dortmund',
to_stop => 'Essen-Kupferdreh',
);
@@ -553,13 +554,12 @@ Travel::Routing::DE::HAFAS - Interface to HAFAS itinerary services
=head1 VERSION
-version 0.08
+version 0.10
=head1 DESCRIPTION
Travel::Routing::DE::HAFAS is an interface to HAFAS itinerary services
-using the mgate.exe interface. It works best with the legacy instance of
-Deutsche Bahn, but supports other transit services as well.
+using the mgate.exe interface.
=head1 METHODS
@@ -574,6 +574,12 @@ supports the following additional flags:
=over
+=item B<service> => I<service> (mandatory)
+
+Request results from I<service>.
+See B<get_services> (and C<< hafas-m --list >>) for a list of supported
+services.
+
=item B<from_stop> => I<stop> (mandatory)
Origin stop, e.g. "Essen HBf" or "Alfredusbad, Essen (Ruhr)". The stop
@@ -639,12 +645,6 @@ Request connections with scheduled changeover durations of at least I<minutes>.
Note that this does not account for real-time data: the backend may return
delayed connections that violate the specified changeover duration.
-=item B<service> => I<service>
-
-Request results from I<service>, defaults to "DB".
-See B<get_services> (and C<< hafas-m --list >>) for a list of supported
-services.
-
=back
=item $hafas_p = Travel::Routing::DE::HAFAS->new_p(I<%opt>)
@@ -737,7 +737,7 @@ None.
=head1 BUGS AND LIMITATIONS
-The non-default services (anything other than DB) are not well tested.
+Some HAFAS services are not well-tested.
=head1 SEE ALSO
diff --git a/lib/Travel/Routing/DE/HAFAS/Connection.pm b/lib/Travel/Routing/DE/HAFAS/Connection.pm
index a51389f..d1a5d16 100644
--- a/lib/Travel/Routing/DE/HAFAS/Connection.pm
+++ b/lib/Travel/Routing/DE/HAFAS/Connection.pm
@@ -11,7 +11,7 @@ use DateTime::Duration;
use Travel::Routing::DE::HAFAS::Utils;
use Travel::Routing::DE::HAFAS::Connection::Section;
-our $VERSION = '0.08';
+our $VERSION = '0.10';
Travel::Routing::DE::HAFAS::Connection->mk_ro_accessors(
qw(changes duration sched_dep rt_dep sched_arr rt_arr dep arr dep_platform arr_platform dep_loc arr_loc dep_cancelled arr_cancelled is_cancelled load)
@@ -213,7 +213,7 @@ Travel::Routing::DE::HAFAS::Connection - A single connection between two stops
=head1 VERSION
-version 0.08
+version 0.10
=head1 DESCRIPTION
diff --git a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm
index b57a391..625b8fe 100644
--- a/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm
+++ b/lib/Travel/Routing/DE/HAFAS/Connection/Section.pm
@@ -11,7 +11,7 @@ use DateTime::Duration;
use Travel::Routing::DE::HAFAS::Utils;
use Travel::Status::DE::HAFAS::Journey;
-our $VERSION = '0.08';
+our $VERSION = '0.10';
Travel::Routing::DE::HAFAS::Connection::Section->mk_ro_accessors(
qw(type schep_dep rt_dep sched_arr rt_arr dep arr arr_delay dep_delay journey distance duration transfer_duration dep_loc arr_loc
@@ -212,7 +212,7 @@ Travel::Routing::DE::HAFAS::Connection::Section - A single trip between two stop
=head1 VERSION
-version 0.08
+version 0.10
=head1 DESCRIPTION
diff --git a/lib/Travel/Routing/DE/HAFAS/Utils.pm b/lib/Travel/Routing/DE/HAFAS/Utils.pm
index 3c7f8c0..b1568dd 100644
--- a/lib/Travel/Routing/DE/HAFAS/Utils.pm
+++ b/lib/Travel/Routing/DE/HAFAS/Utils.pm
@@ -9,7 +9,7 @@ use 5.014;
use parent 'Exporter';
our @EXPORT = qw(handle_day_change);
-our $VERSION = '0.08';
+our $VERSION = '0.10';
sub handle_day_change {
my (%opt) = @_;
@@ -55,7 +55,7 @@ None.
=head1 VERSION
-version 0.08
+version 0.10
=head1 METHODS
diff --git a/scripts/makedeb-docker-helper b/scripts/makedeb-docker-helper
index 7033c78..902c367 100755
--- a/scripts/makedeb-docker-helper
+++ b/scripts/makedeb-docker-helper
@@ -15,8 +15,8 @@ apt-get -y install \
libtest-compile-perl libtest-pod-perl \
libtest-simple-perl wget
-wget https://lib.finalrewind.org/deb/libtravel-status-de-deutschebahn-perl_6.02-1_all.deb
-dpkg -i libtravel-status-de-deutschebahn-perl_6.02-1_all.deb
+wget https://lib.finalrewind.org/deb/libtravel-status-de-hafas-perl_6.19-1_all.deb
+dpkg -i libtravel-status-de-hafas-perl_6.19-1_all.deb
apt-file update
apt-cache dumpavail | dpkg --merge-avail