From 18c919fe959905141924a5f0b49865e59f2453ff Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Fri, 1 Sep 2023 10:53:23 +0200 Subject: do not use now-deprecated smartmatch feature --- lib/DBInfoscreen.pm | 2 -- lib/DBInfoscreen/Controller/Stationboard.pm | 27 ++++++++++++++++++--------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index 4618059..092c45f 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -15,8 +15,6 @@ use JSON; use utf8; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - sub startup { my ($self) = @_; diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index d22443e..3cdf5b8 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -23,8 +23,6 @@ use XML::LibXML; use utf8; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - my %default = ( mode => 'app', admode => 'deparr', @@ -266,7 +264,13 @@ sub json_route_diff { } # this branch is inefficient, but won't be taken frequently - elsif ( not( $route[$route_idx] ~~ \@sched_route ) ) { + elsif ( + not( + List::MoreUtils::any { $route[$route_idx] eq $_ } + @sched_route + ) + ) + { push( @json_route, { @@ -402,7 +406,13 @@ sub handle_request { $self->stash( departures => [] ); $self->stash( title => 'DBF' ); - if ( not( $template ~~ [qw[app infoscreen json multi single text]] ) ) { + if ( + not( + List::MoreUtils::any { $template eq $_ } + (qw(app infoscreen json multi single text)) + ) + ) + { $template = 'app'; } @@ -1344,13 +1354,12 @@ sub handle_result { if ( $template eq 'single' ) { if ( not @platforms ) { for my $result (@results) { + my $num_part + = $self->numeric_platform_part( $result->platform ); if ( - not( $self->numeric_platform_part( $result->platform ) ~~ - \@platforms ) - ) + not( List::MoreUtils::any { $num_part eq $_ } @platforms ) ) { - push( @platforms, - $self->numeric_platform_part( $result->platform ) ); + push( @platforms, $num_part ); } } @platforms = sort { $a <=> $b } @platforms; -- cgit v1.2.3