From b3ae591da9a5de242bbadc3aa975c1c1ec505cd8 Mon Sep 17 00:00:00 2001 From: Michael Andreen Date: Sat, 23 Feb 2013 12:31:08 +0100 Subject: [PATCH] Use a non-local variable for the file so it doesn't get garbage collected too early --- Commands/Quotes.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Commands/Quotes.pm b/Commands/Quotes.pm index 42fbc80..0e50dd4 100644 --- a/Commands/Quotes.pm +++ b/Commands/Quotes.pm @@ -66,6 +66,7 @@ command findquote => { help => q(syntax .findquote pattern | findqre lets you use a regex pattern), alias => q(findqre), }, class extends NDIRC::Command { + my $file; method execute($c,$pattern) { die 'ARGS' unless $pattern; @@ -80,7 +81,7 @@ command findquote => { }else{ $matcher = '(index uc($_), uc($pattern)) != -1'; } - my $file = new File::Temp( SUFFIX => '.txt' ); + $file = new File::Temp( SUFFIX => '.txt' ); my $n = 1; my $match = 0; for (@FILE){ -- 2.39.2