Term/Complete.pm: quote metachars
Brendan O'Dea [Mon, 6 May 2002 14:04:48 +0000 (00:04 +1000)]
   Message-Id: <20020506040448.GA8241@londo.odea.dropbear.id.au>

p4raw-id: //depot/perl@16424

lib/Term/Complete.pm

index 308af04..e20b2a6 100644 (file)
@@ -116,7 +116,7 @@ sub Complete {
             CASE: {
                 # (TAB) attempt completion
                 $_ eq "\t" && do {
-                    @match = grep(/^$return/, @cmp_lst);
+                    @match = grep(/^\Q$return/, @cmp_lst);
                     unless ($#match < 0) {
                         $l = length($test = shift(@match));
                         foreach $cmp (@match) {
@@ -133,7 +133,7 @@ sub Complete {
 
                 # (^D) completion list
                 $_ eq $complete && do {
-                    print(join("\r\n", '', grep(/^$return/, @cmp_lst)), "\r\n");
+                    print(join("\r\n", '', grep(/^\Q$return/, @cmp_lst)), "\r\n");
                     redo LOOP;
                 };