From 71692dd1b7848e699ed4ff4eb5de3ac5a2005043 Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sun, 6 Feb 2011 15:53:53 -0800 Subject: [PATCH] Modified old-data-pruning function to use List::Util instead of List::MoreUtils. This now lets the script work with a stock install of perl without anything extra from CPAN --- bin/feedGnuplot | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/feedGnuplot b/bin/feedGnuplot index e139e4e..a820fd9 100755 --- a/bin/feedGnuplot +++ b/bin/feedGnuplot @@ -4,7 +4,7 @@ use warnings; use Getopt::Long; use Time::HiRes qw( usleep ); use IO::Handle; -use List::MoreUtils qw( first_index ); +use List::Util qw( first ); use Text::ParseWords; use threads; use threads::shared; @@ -550,11 +550,10 @@ sub pruneOldData { if( @$xy > 1 ) { - my $firstInWindow = first_index {$_->[0] >= $oldestx} @{$xy}[1..$#$xy]; - if($firstInWindow == -1) - { splice( @$xy, 1); } + if( my $firstInWindow = first {$xy->[$_][0] >= $oldestx} 1..$#$xy ) + { splice( @$xy, 1, $firstInWindow-1 ); } else - { splice( @$xy, 1, $firstInWindow ); } + { splice( @$xy, 1); } } } }