develooper Front page | perl.perl5.porters | Postings from November 2004

[perl #32639] [PATCH] Bug in Term::Complete Module with $_ Usage

Thread Previous | Thread Next
From:
Steve Peters via RT
Date:
November 26, 2004 09:14
Subject:
[perl #32639] [PATCH] Bug in Term::Complete Module with $_ Usage
Message ID:
rt-3.0.11-32639-101066.11.6172971744206@perl.org
Actually, the bug can be demonstrated with the following script:

#!/usr/bin/perl -w

use strict;
use lib ".";
use Term::Complete;

$_ = "Foo";
my @completion_list;
my $input = Complete('Hit Enter', \@completion_list);

print "$_\n";

Now, here's the patch that fixes the problem.

--- /usr/libdata/perl5/Term/Complete.pm Fri Sep 17 13:09:30 2004
+++ ./Term/Complete.pm  Fri Nov 26 11:13:08 2004
@@ -5,7 +5,7 @@
 use strict;
 our @ISA = qw(Exporter);
 our @EXPORT = qw(Complete);
-our $VERSION = '1.401';
+our $VERSION = '1.402';

 #      @(#)complete.pl,v1.2            (me@anywhere.EBay.Sun.COM) 09/23/91

@@ -113,6 +113,7 @@
     }
     system $tty_raw_noecho if defined $tty_raw_noecho;
     LOOP: {
+        local $_;
         print($prompt, $return);
         while (($_ = getc(STDIN)) ne "\r") {
             CASE: {


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About