Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: re.pl: Unable to find … in history

by Corion (Patriarch)
on Aug 22, 2019 at 11:01 UTC ( [id://11104851]=note: print w/replies, xml ) Need Help??


in reply to re.pl: Unable to find … in history

Looking through the source code of Devel::REPL::Plugin::History, it seems that Devel::REPL::Plugin::ReadLineHistory::WithoutExpansion simply fiddles the wrong bits (well, the ReadLine expansion of the underlying Term::ReadLine object). The source code in Devel::REPL::Plugin::History ignores all that and does the ! expansion in a hardcoded way:

# Devel::REPL::Plugin::History around 'read' => sub { my $orig = shift; my ($self, @args) = @_; my $line = $self->$orig(@args); if (defined $line) { if ($line =~ m/^!(.*)$/) { my $call = $1; $line = $self->history_call($call); if (defined $line) { $self->print($line."\n"); } else { return "'Unable to find ${call} in history'"; } } if ($line =~ m/\S/) { $self->push_history($line); } } return $line; };

Looking at the code more, prefixing !!1 by whitespace should work around the issue in the way you want...

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11104851]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-19 00:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found