summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-01-29 19:20:50 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2024-01-29 19:20:50 +0100
commit911db44a6cc31431d34dd9fc1dbfe1e1777b2b64 (patch)
treeb7c1a0cac29ec995492a1b8825a4631f1a719736 /lib
parent12a5effb576b0d21a1ae47912d65b67f612c8fbd (diff)
IRIS, Result: Do not use smartmatch
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm12
-rw-r--r--lib/Travel/Status/DE/IRIS/Result.pm17
2 files changed, 15 insertions, 14 deletions
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 );