From 911db44a6cc31431d34dd9fc1dbfe1e1777b2b64 Mon Sep 17 00:00:00 2001 From: Birte Kristina Friesel Date: Mon, 29 Jan 2024 19:20:50 +0100 Subject: IRIS, Result: Do not use smartmatch --- lib/Travel/Status/DE/IRIS.pm | 12 +++++++----- lib/Travel/Status/DE/IRIS/Result.pm | 17 ++++++++--------- 2 files changed, 15 insertions(+), 14 deletions(-) (limited to 'lib/Travel/Status') diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm index 677c671..faae7f1 100644 --- a/lib/Travel/Status/DE/IRIS.pm +++ b/lib/Travel/Status/DE/IRIS.pm @@ -4,14 +4,12 @@ use strict; use warnings; use 5.014; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - our $VERSION = '1.93'; use Carp qw(confess cluck); use DateTime; use DateTime::Format::Strptime; -use List::Util qw(first); +use List::Util qw(none first); use List::MoreUtils qw(uniq); use List::UtilsBy qw(uniq_by); use LWP::UserAgent; @@ -554,8 +552,12 @@ sub get_station { if ( $opt{recursive} and defined $station_node->getAttribute('meta') ) { my @refs = uniq( split( m{ \| }x, $station_node->getAttribute('meta') ) ); - @refs = grep { not( $_ ~~ \@seen or $_ ~~ \@queue ) } @refs; - push( @queue, @refs ); + for my $ref (@refs) { + if ( none { $_ == $ref } @seen and none { $_ == $ref } @queue ) + { + push( @queue, @refs ); + } + } $opt{root} = 0; } } diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index c6a1ba2..8b15c93 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -5,14 +5,13 @@ use warnings; use 5.014; use utf8; -no if $] >= 5.018, warnings => 'experimental::smartmatch'; - use parent 'Class::Accessor'; use Carp qw(cluck); use DateTime; use DateTime::Format::Strptime; use List::Compare; -use List::MoreUtils qw(none uniq lastval); +use List::Util qw(any); +use List::MoreUtils qw(uniq lastval); use Scalar::Util qw(weaken); our $VERSION = '1.93'; @@ -642,8 +641,8 @@ sub delay_messages { my @ret; for my $id (@msgids) { - if ( my @superseded = $self->superseded_messages($id) ) { - @ret = grep { not( $_->[2] ~~ \@superseded ) } @ret; + for my $superseded ( $self->superseded_messages($id) ) { + @ret = grep { not( $_->[2] == $superseded ) } @ret; } my $msg = lastval { $_->[2] == $id } @msgs; push( @ret, $msg ); @@ -697,12 +696,12 @@ sub qos_messages { my @keys = sort keys %{ $self->{messages} }; my @msgs - = grep { $_->[1] ~~ [qw[f q]] } map { $self->{messages}{$_} } @keys; + = grep { $_->[1] =~ m{^[fq]$} } map { $self->{messages}{$_} } @keys; my @ret; for my $msg (@msgs) { - if ( my @superseded = $self->superseded_messages( $msg->[2] ) ) { - @ret = grep { not( $_->[2] ~~ \@superseded ) } @ret; + for my $superseded ( $self->superseded_messages( $msg->[2] ) ) { + @ret = grep { not( $_->[2] == $superseded ) } @ret; } @ret = grep { $_->[2] != $msg->[2] } @ret; @@ -834,7 +833,7 @@ sub route_interesting { while ( @via_show < $max_parts and @via_main ) { my $stop = shift(@via_main); - if ( $stop ~~ \@via_show or $stop eq $last_stop ) { + if ( any { $stop eq $_ } @via_show or $stop eq $last_stop ) { next; } push( @via_show, $stop ); -- cgit v1.2.3