From e925a1ef0e7ce9e4dce7c76ea3726e03198f5731 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 1 Sep 2023 11:39:31 +0200 Subject: do not use the now-deprecated smartmatch feature --- bin/ura-m | 27 +++++++++++++-------------- lib/Travel/Status/DE/ASEAG.pm | 2 -- lib/Travel/Status/DE/MM.pm | 2 -- lib/Travel/Status/DE/URA.pm | 2 -- lib/Travel/Status/GB/TFL.pm | 2 -- 5 files changed, 13 insertions(+), 22 deletions(-) diff --git a/bin/ura-m b/bin/ura-m index d3d036c..eacfc86 100755 --- a/bin/ura-m +++ b/bin/ura-m @@ -3,8 +3,6 @@ use strict; use warnings; use 5.010; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - our $VERSION = '2.01'; binmode( STDOUT, ':encoding(utf-8)' ); @@ -12,7 +10,7 @@ binmode( STDOUT, ':encoding(utf-8)' ); use DateTime; use DateTime::Format::Duration; use Getopt::Long qw(:config no_ignore_case bundling); -use List::Util qw(first max); +use List::Util qw(any first max); use Travel::Status::DE::URA; my (@grep_lines); @@ -62,20 +60,21 @@ if ( not $service and $script_name ne 'ura-m' ) { @grep_lines = split( qr{,}, join( q{,}, @grep_lines ) ); for my $efield (@edata_pre) { - given ($efield) { - when ('a') { $edata{route_after} = 1; $calculate_routes = 1 } - when ('b') { $edata{route_before} = 1; $calculate_routes = 1 } - when ('f') { $edata{route_full} = 1; $calculate_routes = 1 } - when ('i') { $edata{indicator} = 1 } - when ('r') { $edata{route_interesting} = 1; $calculate_routes = 1 } - when ('T') { $edata{relative_times} = 1 } - default { $edata{$efield} = 1 } + if ( $efield eq 'a' ) { $edata{route_after} = 1; $calculate_routes = 1 } + elsif ( $efield eq 'b' ) { $edata{route_before} = 1; $calculate_routes = 1 } + elsif ( $efield eq 'f' ) { $edata{route_full} = 1; $calculate_routes = 1 } + elsif ( $efield eq 'i' ) { $edata{indicator} = 1 } + elsif ( $efield eq 'r' ) { + $edata{route_interesting} = 1; + $calculate_routes = 1; } + elsif ( $efield eq 'T' ) { $edata{relative_times} = 1 } + else { $edata{$efield} = 1 } } if ($service) { my $service_ref = first { lc( $_->{shortname} ) eq lc($service) } - Travel::Status::DE::URA::get_services(); + Travel::Status::DE::URA::get_services(); if ( not $service_ref ) { printf STDERR ( "Error: Unknown service '%s'. The following services are supported:\n\n", @@ -226,7 +225,7 @@ sub show_results { ) { - if ( ( @grep_lines and not( $d->line ~~ \@grep_lines ) ) ) { + if ( ( @grep_lines and not( any { $d->line eq $_ } @grep_lines ) ) ) { next; } my ( @line, @route ); @@ -461,7 +460,7 @@ Unknown. =head1 AUTHOR -Copyright (C) 2013-2016 by Birte Kristina Friesel Ederf@finalrewind.orgE +Copyright (C) 2013-2023 by Birte Kristina Friesel Ederf@finalrewind.orgE =head1 LICENSE diff --git a/lib/Travel/Status/DE/ASEAG.pm b/lib/Travel/Status/DE/ASEAG.pm index ff408f6..cc851e9 100644 --- a/lib/Travel/Status/DE/ASEAG.pm +++ b/lib/Travel/Status/DE/ASEAG.pm @@ -4,8 +4,6 @@ use strict; use warnings; use 5.010; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - our $VERSION = '2.01'; use parent 'Travel::Status::DE::URA'; diff --git a/lib/Travel/Status/DE/MM.pm b/lib/Travel/Status/DE/MM.pm index c264597..0fa53ab 100644 --- a/lib/Travel/Status/DE/MM.pm +++ b/lib/Travel/Status/DE/MM.pm @@ -4,8 +4,6 @@ use strict; use warnings; use 5.010; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - our $VERSION = '2.01'; use parent 'Travel::Status::DE::URA'; diff --git a/lib/Travel/Status/DE/URA.pm b/lib/Travel/Status/DE/URA.pm index f36ea68..8859583 100644 --- a/lib/Travel/Status/DE/URA.pm +++ b/lib/Travel/Status/DE/URA.pm @@ -5,8 +5,6 @@ use warnings; use 5.010; use utf8; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - our $VERSION = '2.01'; # create CONSTANTS for different Return Types diff --git a/lib/Travel/Status/GB/TFL.pm b/lib/Travel/Status/GB/TFL.pm index 6d54733..a6167cb 100644 --- a/lib/Travel/Status/GB/TFL.pm +++ b/lib/Travel/Status/GB/TFL.pm @@ -4,8 +4,6 @@ use strict; use warnings; use 5.010; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - our $VERSION = '2.01'; use parent 'Travel::Status::DE::URA'; -- cgit v1.2.3