summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status/DE')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index 4e3cad4..6cdf092 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -159,13 +159,15 @@ sub get_with_cache {
sub get_station {
my ( $self, %opt ) = @_;
+ my $iter_depth = 0;
my @ret;
my @queue = ( $opt{name} );
my @seen;
- while (@queue) {
+ while ( @queue and $iter_depth < 12 ) {
my $station = shift(@queue);
push( @seen, $station );
+ $iter_depth++;
my ( $raw, $err )
= $self->get_with_cache( $self->{main_cache},
@@ -212,6 +214,11 @@ sub get_station {
}
}
+ if (@queue) {
+ cluck( "Reached $iter_depth iterations when tracking station IDs. "
+ . "This is probably a bug" );
+ }
+
@ret = uniq_by { $_->{uic} } @ret;
return @ret;