summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog14
-rwxr-xr-xbin/dbris-m10
-rw-r--r--lib/Travel/Status/DE/DBRIS.pm6
-rw-r--r--lib/Travel/Status/DE/DBRIS/Formation.pm12
-rw-r--r--lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm36
-rw-r--r--lib/Travel/Status/DE/DBRIS/Formation/Group.pm3
-rw-r--r--lib/Travel/Status/DE/DBRIS/Formation/Sector.pm2
-rw-r--r--lib/Travel/Status/DE/DBRIS/Journey.pm4
-rw-r--r--lib/Travel/Status/DE/DBRIS/JourneyAtStop.pm10
-rw-r--r--lib/Travel/Status/DE/DBRIS/Location.pm2
-rw-r--r--lib/Travel/Status/DE/DBRIS/Operators.pm.PL2
-rw-r--r--share/admin-id-to-operator.json1
12 files changed, 71 insertions, 31 deletions
diff --git a/Changelog b/Changelog
index 96893cd..2cce888 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,17 @@
+Travel::Status::DE::DBRIS 0.22 - Sun Jan 04 2026
+
+ * Further fixes for fundefined fvalues
+ * Update train and operator names (patch by Lili Chelsea Urban)
+
+Travel::Status::DE::DBRIS 0.21 - Fri Jan 02 2026
+
+ * Formation: Fix uninitialized value warnings
+
+Travel::Status::DE::DBRIS 0.20 - Sun Dec 28 2025
+
+ * Formation::Group: Update carriage name list (patch by Lili Chelsea Urban)
+ * Fix a variety of uninitialized value warnings
+
Travel::Status::DE::DBRIS 0.19 - Sun Dec 14 2025
* DBRIS->new, ->new-p: Add optional num_vias key
diff --git a/bin/dbris-m b/bin/dbris-m
index 668e17a..46f128d 100755
--- a/bin/dbris-m
+++ b/bin/dbris-m
@@ -3,7 +3,7 @@ use strict;
use warnings;
use 5.020;
-our $VERSION = '0.19';
+our $VERSION = '0.22';
use utf8;
use DateTime;
@@ -601,7 +601,9 @@ if ($train_no) {
if ( my $min_percentage = min @start_percentages ) {
print ' ' x ( $min_percentage - 1 );
}
- print $wr->direction == 100 ? '>' : '<';
+ if ( defined $wr->direction ) {
+ print $wr->direction == 100 ? '>' : '<';
+ }
for my $wagon ( $wr->carriages ) {
my $wagon_length = $wagon->length_percent;
@@ -683,7 +685,7 @@ B<dbris-m> B<?>I<query>|I<lat>B<:>I<lon>
=head1 VERSION
-version 0.19
+version 0.22
=head1 DESCRIPTION
@@ -830,7 +832,7 @@ None.
=head1 AUTHOR
-Copyright (C) 2024-2025 Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt>
+Copyright (C) 2024-2026 Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt>
=head1 LICENSE
diff --git a/lib/Travel/Status/DE/DBRIS.pm b/lib/Travel/Status/DE/DBRIS.pm
index ad17461..c3278bb 100644
--- a/lib/Travel/Status/DE/DBRIS.pm
+++ b/lib/Travel/Status/DE/DBRIS.pm
@@ -19,7 +19,7 @@ use Travel::Status::DE::DBRIS::JourneyAtStop;
use Travel::Status::DE::DBRIS::Journey;
use Travel::Status::DE::DBRIS::Location;
-our $VERSION = '0.19';
+our $VERSION = '0.22';
# {{{ Constructors
@@ -473,7 +473,7 @@ Non-blocking variant;
=head1 VERSION
-version 0.19
+version 0.22
=head1 DESCRIPTION
@@ -650,7 +650,7 @@ L<https://github.com/derf/Travel-Status-DE-DBRIS>
=head1 AUTHOR
-Copyright (C) 2024-2025 Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt>
+Copyright (C) 2024-2026 Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt>
=head1 LICENSE
diff --git a/lib/Travel/Status/DE/DBRIS/Formation.pm b/lib/Travel/Status/DE/DBRIS/Formation.pm
index 38a55aa..4d206cc 100644
--- a/lib/Travel/Status/DE/DBRIS/Formation.pm
+++ b/lib/Travel/Status/DE/DBRIS/Formation.pm
@@ -12,7 +12,7 @@ use Travel::Status::DE::DBRIS::Formation::Group;
use Travel::Status::DE::DBRIS::Formation::Sector;
use Travel::Status::DE::DBRIS::Formation::Carriage;
-our $VERSION = '0.19';
+our $VERSION = '0.22';
Travel::Status::DE::DBRIS::Formation->mk_ro_accessors(
qw(direction platform train_type));
@@ -102,7 +102,8 @@ sub parse_carriages {
push( @{ $self->{carriages} }, $carriage_object );
}
@group_carriages
- = sort { $a->start_percent <=> $b->start_percent } @group_carriages;
+ = sort { ( $a->start_percent // 0 ) <=> ( $b->start_percent // 0 ) }
+ @group_carriages;
my $group_obj = Travel::Status::DE::DBRIS::Formation::Group->new(
json => $group,
carriages => \@group_carriages,
@@ -111,13 +112,16 @@ sub parse_carriages {
push( @numbers, $group_obj->train_no );
}
- @groups = sort { $a->start_percent <=> $b->start_percent } @groups;
+ @groups = sort { ( $a->start_percent // 0 ) <=> ( $b->start_percent // 0 ) }
+ @groups;
@numbers = uniq @numbers;
$self->{train_numbers} = \@numbers;
if ( @{ $self->{carriages} // [] } > 1 ) {
- if ( $self->{carriages}[0]->{start_percent}
+ if ( defined $self->{carriages}[0]->{start_percent}
+ and defined $self->{carriages}[-1]->{start_percent}
+ and $self->{carriages}[0]->{start_percent}
> $self->{carriages}[-1]->{start_percent} )
{
$self->{direction} = 100;
diff --git a/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm b/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm
index f4f602d..0ec2b2b 100644
--- a/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm
+++ b/lib/Travel/Status/DE/DBRIS/Formation/Carriage.pm
@@ -8,7 +8,7 @@ use utf8;
use parent 'Class::Accessor';
use Carp qw(cluck);
-our $VERSION = '0.19';
+our $VERSION = '0.22';
Travel::Status::DE::DBRIS::Formation::Carriage->mk_ro_accessors(
qw(class_type is_closed is_dosto is_locomotive is_powercar
number model section uic_id type
@@ -49,7 +49,10 @@ sub new {
$ref->{section} = $json{platformPosition}{sector};
$ref->{type} = $json{type}{constructionType};
- $ref->{model} =~ s{^.....(...)....(?:-.)?$}{$1} or $ref->{model} = undef;
+ if ( defined $ref->{model} ) {
+ $ref->{model} =~ s{^.....(...)....(?:-.)?$}{$1}
+ or $ref->{model} = undef;
+ }
my $self = bless( $ref, $obj );
@@ -80,14 +83,16 @@ sub new {
$ref->{has_first_class} = $json{type}{hasFirstClass};
$ref->{has_second_class} = $json{type}{hasEconomyClass};
- if ( $ref->{type} =~ m{AB} ) {
- $ref->{class_type} = 12;
- }
- elsif ( $ref->{type} =~ m{A} ) {
- $ref->{class_type} = 1;
- }
- elsif ( $ref->{type} =~ m{B|WR} ) {
- $ref->{class_type} = 2;
+ if ( $ref->{type} ) {
+ if ( $ref->{type} =~ m{AB} ) {
+ $ref->{class_type} = 12;
+ }
+ elsif ( $ref->{type} =~ m{A} ) {
+ $ref->{class_type} = 1;
+ }
+ elsif ( $ref->{type} =~ m{B|WR} ) {
+ $ref->{class_type} = 2;
+ }
}
my $pos = $json{platformPosition};
@@ -144,6 +149,11 @@ sub parse_type {
my $type = $self->{type};
my @desc;
+ if ( not $type ) {
+ $self->{attributes} = [];
+ return;
+ }
+
if ( $type =~ m{^D} ) {
$self->{is_dosto} = 1;
push( @desc, 'Doppelstock' );
@@ -198,6 +208,9 @@ sub parse_type {
sub is_first_class {
my ($self) = @_;
+ if ( not defined $self->{type} ) {
+ return;
+ }
if ( $self->{type} =~ m{^D?A} ) {
return 1;
}
@@ -207,6 +220,9 @@ sub is_first_class {
sub is_second_class {
my ($self) = @_;
+ if ( not defined $self->{type} ) {
+ return;
+ }
if ( $self->{type} =~ m{^D?A?B} ) {
return 1;
}
diff --git a/lib/Travel/Status/DE/DBRIS/Formation/Group.pm b/lib/Travel/Status/DE/DBRIS/Formation/Group.pm
index 9c3425f..fd8ae2a 100644
--- a/lib/Travel/Status/DE/DBRIS/Formation/Group.pm
+++ b/lib/Travel/Status/DE/DBRIS/Formation/Group.pm
@@ -8,7 +8,7 @@ use utf8;
use parent 'Class::Accessor';
use List::Util qw(uniq);
-our $VERSION = '0.19';
+our $VERSION = '0.22';
Travel::Status::DE::DBRIS::Formation::Group->mk_ro_accessors(
qw(designation name train_no train_type description desc_short destination has_sectors model series start_percent end_percent)
@@ -267,7 +267,6 @@ my %ice_name = (
8019 => 'Düsseldorf',
8020 => 'Amsterdam',
8022 => 'Waldecker Land',
- 8026 => 'Christmas-Train',
8029 => 'Europa/Europe',
9006 => 'Martin Luther',
9009 => 'Cottbus/Chóśebuz',
diff --git a/lib/Travel/Status/DE/DBRIS/Formation/Sector.pm b/lib/Travel/Status/DE/DBRIS/Formation/Sector.pm
index 8bc7fe3..8870ce4 100644
--- a/lib/Travel/Status/DE/DBRIS/Formation/Sector.pm
+++ b/lib/Travel/Status/DE/DBRIS/Formation/Sector.pm
@@ -7,7 +7,7 @@ use utf8;
use parent 'Class::Accessor';
-our $VERSION = '0.19';
+our $VERSION = '0.22';
Travel::Status::DE::DBRIS::Formation::Sector->mk_ro_accessors(
qw(name start_percent end_percent length_percent start_meters end_meters length_meters cube_meters cube_percent)
diff --git a/lib/Travel/Status/DE/DBRIS/Journey.pm b/lib/Travel/Status/DE/DBRIS/Journey.pm
index 0d27516..d12aaca 100644
--- a/lib/Travel/Status/DE/DBRIS/Journey.pm
+++ b/lib/Travel/Status/DE/DBRIS/Journey.pm
@@ -9,7 +9,7 @@ use parent 'Class::Accessor';
use Travel::Status::DE::DBRIS::Location;
use Travel::Status::DE::DBRIS::Operators;
-our $VERSION = '0.19';
+our $VERSION = '0.22';
# ->number is deprecated
Travel::Status::DE::DBRIS::Journey->mk_ro_accessors(
@@ -337,7 +337,7 @@ journey received by Travel::Status::DE::DBRIS
=head1 VERSION
-version 0.19
+version 0.22
=head1 DESCRIPTION
diff --git a/lib/Travel/Status/DE/DBRIS/JourneyAtStop.pm b/lib/Travel/Status/DE/DBRIS/JourneyAtStop.pm
index 6a29e98..eb2f217 100644
--- a/lib/Travel/Status/DE/DBRIS/JourneyAtStop.pm
+++ b/lib/Travel/Status/DE/DBRIS/JourneyAtStop.pm
@@ -6,7 +6,7 @@ use 5.020;
use parent 'Class::Accessor';
-our $VERSION = '0.19';
+our $VERSION = '0.22';
Travel::Status::DE::DBRIS::JourneyAtStop->mk_ro_accessors(
qw(type dep sched_dep rt_dep delay is_cancelled line stop_eva id platform rt_platform destination via_last
@@ -40,8 +40,12 @@ sub new {
shift( @{ $ref->{via} } );
}
- $ref->{maybe_train_no} = $ref->{train} =~ s{^.* ++}{}r;
- $ref->{maybe_line_no} = $ref->{train_mid} =~ s{^.* ++}{}r;
+ if ( defined $ref->{train} ) {
+ $ref->{maybe_train_no} = $ref->{train} =~ s{^.* ++}{}r;
+ }
+ if ( defined $ref->{train_mid} ) {
+ $ref->{maybe_line_no} = $ref->{train_mid} =~ s{^.* ++}{}r;
+ }
bless( $ref, $obj );
diff --git a/lib/Travel/Status/DE/DBRIS/Location.pm b/lib/Travel/Status/DE/DBRIS/Location.pm
index 47ef89a..85f8cb3 100644
--- a/lib/Travel/Status/DE/DBRIS/Location.pm
+++ b/lib/Travel/Status/DE/DBRIS/Location.pm
@@ -6,7 +6,7 @@ use 5.020;
use parent 'Class::Accessor';
-our $VERSION = '0.19';
+our $VERSION = '0.22';
Travel::Status::DE::DBRIS::Location->mk_ro_accessors(
qw(eva id lat lon name admin_id operator products type is_cancelled is_additional is_separation display_priority
diff --git a/lib/Travel/Status/DE/DBRIS/Operators.pm.PL b/lib/Travel/Status/DE/DBRIS/Operators.pm.PL
index d345ead..37008e5 100644
--- a/lib/Travel/Status/DE/DBRIS/Operators.pm.PL
+++ b/lib/Travel/Status/DE/DBRIS/Operators.pm.PL
@@ -23,7 +23,7 @@ use warnings;
use 5.020;
use utf8;
-our $VERSION = '0.19';
+our $VERSION = '0.22';
# Automatically generated, see share/stations.json
my %admin_id_to_operator = (
diff --git a/share/admin-id-to-operator.json b/share/admin-id-to-operator.json
index 0a79953..6c743d3 100644
--- a/share/admin-id-to-operator.json
+++ b/share/admin-id-to-operator.json
@@ -71,6 +71,7 @@
"800486": ["DB", "DB Regio AG Südost"],
"800487": ["DB", "DB Regio AG Südost"],
"800489": ["DB", "DB Regio AG Südost"],
+"800520": ["DB", "DB Regio AG Mitte"],
"800523": ["KHB", "DB RegioNetz Verkehrs GmbH Kurhessenbahn"],
"800528": ["S", "DB Regio AG S-Bahn Rhein-Main"],
"800535": ["DB", "DB Regio AG Mitte"],