summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/db-iris58
1 files changed, 36 insertions, 22 deletions
diff --git a/bin/db-iris b/bin/db-iris
index c291e8f..e05f26f 100755
--- a/bin/db-iris
+++ b/bin/db-iris
@@ -4,8 +4,6 @@ use warnings;
use 5.014;
use utf8;
-no if $] >= 5.018, warnings => 'experimental::smartmatch';
-
our $VERSION = '1.93';
use DateTime;
@@ -14,7 +12,7 @@ use Encode qw(decode);
use Getopt::Long qw(:config no_ignore_case bundling);
use JSON;
use List::Util qw(first max);
-use List::MoreUtils qw(none);
+use List::MoreUtils qw(any none);
use Travel::Status::DE::IRIS;
use Travel::Status::DE::IRIS::Stations;
@@ -121,20 +119,18 @@ if ($time) {
}
for my $efield (@edata_pre) {
- given ($efield) {
- when ('a') { $edata{additional} = 1 }
- when ('c') { $edata{canceled} = 1 }
- when ('d') { $edata{delay} = 1 }
- when ('D') { $edata{delays} = 1 }
- when ('f') { $edata{fullroute} = 1 }
- when ('m') { $edata{messages} = 1 }
- when ('q') { $edata{qos} = 1 }
- when ('r') { $edata{route} = 1 }
- when ('R') { $edata{replacements} = 1 }
- when ('t') { $edata{times} = 1 }
- when ('!') { $edata{debug} = 1 }
- default { $edata{$efield} = 1 }
- }
+ if ( $efield eq 'a' ) { $edata{additional} = 1 }
+ elsif ( $efield eq 'c' ) { $edata{canceled} = 1 }
+ elsif ( $efield eq 'd' ) { $edata{delay} = 1 }
+ elsif ( $efield eq 'D' ) { $edata{delays} = 1 }
+ elsif ( $efield eq 'f' ) { $edata{fullroute} = 1 }
+ elsif ( $efield eq 'm' ) { $edata{messages} = 1 }
+ elsif ( $efield eq 'q' ) { $edata{qos} = 1 }
+ elsif ( $efield eq 'r' ) { $edata{route} = 1 }
+ elsif ( $efield eq 'R' ) { $edata{replacements} = 1 }
+ elsif ( $efield eq 't' ) { $edata{times} = 1 }
+ elsif ( $efield eq '!' ) { $edata{debug} = 1 }
+ else { $edata{$efield} = 1 }
}
if ($use_cache) {
@@ -461,15 +457,33 @@ for my $d ( $status->results() ) {
# route may be incomplete, so check route_end as well
@via = ( $d->route_post, $d->route_end );
- if ( ( $filter_via and not( first { $_ =~ m{$filter_via}io } @via ) )
- or ( @grep_class and none { $_ ~~ \@grep_class } $d->classes )
- or ( @grep_platform and not( $d->platform ~~ \@grep_platform ) )
- or ( @grep_type and not( $d->type ~~ \@grep_type ) )
+ if ( ( $filter_via and not( first { $_ =~ m{$filter_via}io } @via ) )
or $d->is_wing )
{
next;
}
+ if ( @grep_platform and none { $d->platform eq $_ } @grep_platform ) {
+ next;
+ }
+
+ if ( @grep_type and none { $d->type eq $_ } @grep_type ) {
+ next;
+ }
+
+ if (@grep_class) {
+ my $skip = 1;
+ for my $class ( $d->classes ) {
+ if ( any { $class eq $_ } @grep_class ) {
+ $skip = 0;
+ last;
+ }
+ }
+ if ($skip) {
+ next;
+ }
+ }
+
my $delay = format_delay($d);
my $platformstr = $d->platform // q{};
@@ -534,7 +548,7 @@ for my $d ( $status->results() ) {
push( @processed_wings, $wing->wing_id );
}
for my $wing ( $d->arrival_wings ) {
- if ( not $wing->wing_id ~~ \@processed_wings ) {
+ if ( none { $wing->wing_id eq $_ } @processed_wings ) {
my $wingdelay = format_delay($wing);
push(
@output,