Skip Menu |

This queue is for tickets about the Devel-REPL CPAN distribution.

Report information
The Basics
Id: 48459
Status: resolved
Priority: 0/
Queue: Devel-REPL

People
Owner: Nobody in particular
Requestors: spang@mit.edu (no email address)
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 1.003006
  • 1.003007
Fixed in: (no value)



Subject: ReadLineHistory plugin causes annoying interpretation of !
When I enable the ReadLineHistory plugin (using Term::ReadLine::Gnu), it causes ! to be interpreted in a shell-like manner, which essentially makes it so that I cannot use the ! character. Disabling the plugin makes this behaviour go away. Here's an example of what happens: Show quoted text
> my $var = "foo!";
!";: event not found Show quoted text
> my $var = '!!!';
!';: event not found I've tried this using 1.003006 (Debian package) and 1.003007 (from CPAN) on Debian GNU/Linux (unstable). Thanks for Devel::REPL!
Are you sure this is from the ReadLineHistory plugin? I think the !-expansion is from the History plugin. At any rate, in double quotes you can escape the special meaning of the ! by back-slashing it: Show quoted text
> my $var = "foo\!";
foo! This doesn't work for the single quoted string but if you replace the single quotes by double quotes there it will work too: ? my $var = "\!\!\!"; !!! --Chris On Wed Aug 05 14:18:10 2009, spang wrote: Show quoted text
> When I enable the ReadLineHistory plugin (using Term::ReadLine::Gnu), it > causes ! to be interpreted in a shell-like manner, which essentially > makes it so that I cannot use the ! character. Disabling the plugin > makes this behaviour go away. > > Here's an example of what happens: >
> > my $var = "foo!";
> !";: event not found >
> > my $var = '!!!';
> !';: event not found
The 'event not found' message is actually from the GNU history library which is actually doing history expansion on its own. See the GNU History library manual for details. Two suggested work arounds: (1) escape the history character with \, e.g. "foo\!" (2) use Term::ReadLine::Perl which does not do history expansion (instead of Term::ReadLine::Gnu which does). You'll need to be using Devel::REPL version 1.003010 or higher. --Chris On Wed Aug 05 14:18:10 2009, spang wrote: Show quoted text
> > When I enable the ReadLineHistory plugin (using Term::ReadLine::Gnu), > it causes ! to be interpreted in a shell-like manner, which > essentially makes it so that I cannot use the ! character. > Disabling the plugin makes this behaviour go away. > > Here's an example of what happens: >
> > my $var = "foo!";
> !";: event not found >
> > my $var = '!!!';
> !';: event not found > > I've tried this using 1.003006 (Debian package) and 1.003007 > (from CPAN) on Debian GNU/Linux (unstable). > > Thanks for Devel::REPL!
TO DO: document this in the Devel::REPL::Plugin::ReadLineHistory documentation as to how to quote history characters (a la bash) or how to configure to use Term::ReadLine::Perl with Devel::REPL. On Tue Jun 01 12:34:41 2010, CHM wrote: Show quoted text
> > Two suggested work arounds: > > (1) escape the history character with \, e.g. "foo\!" > > (2) use Term::ReadLine::Perl which does not do history > expansion (instead of Term::ReadLine::Gnu which does). > You'll need to be using Devel::REPL version 1.003010 > or higher.
I've confirmed that this is the GNU readline/history doing the expansion. If you wish to disable history expansion, just set $_REPL->term->Attribs->{do_expand} = 0; or use quotes to avoid the expansion as below. Using Term::ReadLine::Perl also will not do the expansion. Show quoted text
> On Tue Jun 01 12:34:41 2010, CHM wrote:
> > > > Two suggested work arounds: > > > > (1) escape the history character with \, e.g. "foo\!" > > > > (2) use Term::ReadLine::Perl which does not do history > > expansion (instead of Term::ReadLine::Gnu which does). > > You'll need to be using Devel::REPL version 1.003010 > > or higher.