From: Mike Taylor Date: Thu, 20 Sep 2007 10:14:37 +0000 (+0000) Subject: _next_connection() correctly returns undef when reading past the end X-Git-Tag: CPAN-v1.02~54^2~286 X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=commitdiff_plain;h=df249d500ca3cfefbc1e0fd82e3a7c1bd7f85142;hp=1009cb5e43e8d615cf5ee1931aa1d5fda3bb6f47 _next_connection() correctly returns undef when reading past the end of the target queue when no modulo-selection is in force, rather than trying to connect to an undefined target. --- diff --git a/lib/ZOOM/IRSpy.pm b/lib/ZOOM/IRSpy.pm index 8e6d3ac..3bd1aaf 100644 --- a/lib/ZOOM/IRSpy.pm +++ b/lib/ZOOM/IRSpy.pm @@ -1,4 +1,4 @@ -# $Id: IRSpy.pm,v 1.88 2007-09-18 16:57:37 mike Exp $ +# $Id: IRSpy.pm,v 1.89 2007-09-20 10:14:37 mike Exp $ package ZOOM::IRSpy; @@ -230,6 +230,7 @@ sub _next_connection { my $i = $this->{modi}; if (!defined $n) { $target = shift @{ $this->{queue} }; + return undef if !defined $target; } else { while (1) { $target = shift @{ $this->{queue} }; @@ -241,6 +242,7 @@ sub _next_connection { } } + die "oops -- target is undefined" if !defined $target; return create ZOOM::IRSpy::Connection($this, $target, async => 1, timeout => $this->{timeout}); }