]> ruin.nu Git - NDIRC.git/commitdiff
Use a non-local variable for the file so it doesn't get garbage collected too early
authorMichael Andreen <harv@ruin.nu>
Sat, 23 Feb 2013 11:31:08 +0000 (12:31 +0100)
committerMichael Andreen <harv@ruin.nu>
Sat, 23 Feb 2013 11:31:08 +0000 (12:31 +0100)
Commands/Quotes.pm

index 42fbc80ca8c3680b6fba24ab8e60ecbb6a405b3e..0e50dd4569d4768648e0d9ef3101ead167368059 100644 (file)
@@ -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){