summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-09-01 12:32:20 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2023-09-01 12:32:20 +0200
commit0201467b3458a6ef74a3e7a975c0db065b0edb4c (patch)
tree34db3b898a93d320916cc2bc69feabf5c104388e
parent7e6b9de3abc7fd649d892560cad591465b5e2c91 (diff)
do not use now-deprecated smartmatch feature
-rwxr-xr-xbin/efa-m32
-rw-r--r--lib/Travel/Status/DE/EFA.pm10
-rw-r--r--lib/Travel/Status/DE/EFA/Result.pm2
-rw-r--r--lib/Travel/Status/DE/EFA/Stop.pm2
-rw-r--r--lib/Travel/Status/DE/VRR.pm2
5 files changed, 19 insertions, 29 deletions
diff --git a/bin/efa-m b/bin/efa-m
index fe9ba8a..69bdab6 100755
--- a/bin/efa-m
+++ b/bin/efa-m
@@ -4,15 +4,13 @@ use warnings;
use 5.010;
use utf8;
-no if $] >= 5.018, warnings => 'experimental::smartmatch';
-
our $VERSION = '1.21';
binmode( STDOUT, ':encoding(utf-8)' );
-use Encode qw(decode);
+use Encode qw(decode);
use Getopt::Long qw(:config no_ignore_case bundling);
-use List::Util qw(first max);
+use List::Util qw(first max none);
use Travel::Status::DE::EFA;
my $efa_url = 'https://efa.vrr.de/vrr/XSLT_DM_REQUEST';
@@ -80,13 +78,11 @@ if ( $input =~ s{ ^ (?<type> address|poi|stop|stopID) : }{}x ) {
}
for my $efield (@edata_pre) {
- given ($efield) {
- when ('a') { $edata{route_after} = 1; $full_routes = 1 }
- when ('b') { $edata{route_before} = 1; $full_routes = 1 }
- when ('f') { $edata{fullroute} = 1; $full_routes = 1 }
- when ('r') { $edata{route} = 1; $full_routes = 1 }
- default { $edata{$efield} = 1 }
- }
+ if ( $efield eq 'a' ) { $edata{route_after} = 1; $full_routes = 1 }
+ elsif ( $efield eq 'b' ) { $edata{route_before} = 1; $full_routes = 1 }
+ elsif ( $efield eq 'f' ) { $edata{fullroute} = 1; $full_routes = 1 }
+ elsif ( $efield eq 'r' ) { $edata{route} = 1; $full_routes = 1 }
+ else { $edata{$efield} = 1 }
}
if ($filter_via) {
$full_routes = 1;
@@ -94,7 +90,7 @@ if ($filter_via) {
if ($service) {
my $service_ref = first { lc( $_->{shortname} ) eq lc($service) }
- Travel::Status::DE::EFA::get_efa_urls();
+ Travel::Status::DE::EFA::get_efa_urls();
if ( not $service_ref ) {
printf STDERR (
"Error: Unknown service '%s'. See 'efa-m --list' for a "
@@ -224,13 +220,13 @@ sub show_lines {
for my $l ( $efa->lines ) {
- if ( ( @grep_lines and not( $l->name ~~ \@grep_lines ) )
- or ( @grep_mots and not( $l->mot_name ~~ \@grep_mots ) ) )
+ if ( ( @grep_lines and none { $l->name eq $_ } @grep_lines )
+ or ( @grep_mots and none { $l->mot_name eq $_ } @grep_mots ) )
{
next;
}
- if ( @grep_mots and not( $l->mot_name ~~ \@grep_mots ) ) {
+ if ( @grep_mots and none { $l->mot_name eq $_ } @grep_mots ) {
next;
}
@@ -262,10 +258,10 @@ sub show_results {
}
if (
- ( @grep_lines and not( $d->line ~~ \@grep_lines ) )
- or ( @grep_mots and not( $d->mot_name ~~ \@grep_mots ) )
+ ( @grep_lines and none { $d->line eq $_ } @grep_lines )
+ or ( @grep_mots and none { $d->mot_name eq $_ } @grep_mots )
or ( @grep_platforms
- and not( $platform ~~ \@grep_platforms ) )
+ and none { $platform eq $_ } @grep_platforms )
or ( $offset and $d->countdown < $offset )
or ( $filter_via
and
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index 1c994d8..5de9a76 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -5,11 +5,9 @@ use warnings;
use 5.010;
use utf8;
-no if $] >= 5.018, warnings => 'experimental::smartmatch';
-
our $VERSION = '1.21';
-use Carp qw(confess cluck);
+use Carp qw(confess cluck);
use Encode qw(encode);
use Travel::Status::DE::EFA::Line;
use Travel::Status::DE::EFA::Result;
@@ -34,7 +32,9 @@ sub new {
if ( not( $opt{name} ) ) {
confess('You must specify a name');
}
- if ( $opt{type} and not( $opt{type} ~~ [qw[stop stopID address poi]] ) ) {
+ if ( $opt{type}
+ and not( $opt{type} =~ m{ ^ (?: stop stopID address poi ) $ }x ) )
+ {
confess('type must be stop, stopID, address, or poi');
}
@@ -332,7 +332,7 @@ sub lines {
my $type = $e_info->getAttribute('name');
my $mot = $e->getAttribute('motType');
my $route = ( $e_route ? $e_route->textContent : undef );
- my $operator = ( $e_oper ? $e_oper->textContent : undef );
+ my $operator = ( $e_oper ? $e_oper->textContent : undef );
my $identifier = $e->getAttribute('stateless');
push(
diff --git a/lib/Travel/Status/DE/EFA/Result.pm b/lib/Travel/Status/DE/EFA/Result.pm
index 3b4710a..6c8017b 100644
--- a/lib/Travel/Status/DE/EFA/Result.pm
+++ b/lib/Travel/Status/DE/EFA/Result.pm
@@ -4,8 +4,6 @@ use strict;
use warnings;
use 5.010;
-no if $] >= 5.018, warnings => 'experimental::smartmatch';
-
use parent 'Class::Accessor';
our $VERSION = '1.21';
diff --git a/lib/Travel/Status/DE/EFA/Stop.pm b/lib/Travel/Status/DE/EFA/Stop.pm
index 5656b17..17e0eb7 100644
--- a/lib/Travel/Status/DE/EFA/Stop.pm
+++ b/lib/Travel/Status/DE/EFA/Stop.pm
@@ -4,8 +4,6 @@ use strict;
use warnings;
use 5.010;
-no if $] >= 5.018, warnings => 'experimental::smartmatch';
-
use parent 'Class::Accessor';
our $VERSION = '1.21';
diff --git a/lib/Travel/Status/DE/VRR.pm b/lib/Travel/Status/DE/VRR.pm
index 6af13e0..e9fa140 100644
--- a/lib/Travel/Status/DE/VRR.pm
+++ b/lib/Travel/Status/DE/VRR.pm
@@ -4,8 +4,6 @@ use strict;
use warnings;
use 5.010;
-no if $] >= 5.018, warnings => "experimental::smartmatch";
-
our $VERSION = '1.21';
use parent 'Travel::Status::DE::EFA';