Skip Menu |

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

Report information
The Basics
Id: 87973
Status: open
Priority: 0/
Queue: Devel-REPL

People
Owner: ether [...] cpan.org
Requestors: rocky [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Term::ReadLine::Perl5 support
Attached is a patch to add Term::ReadLine::Perl5 support in Devel::REPL. Term::ReadLine::Perl5 is like Term::ReadLine::Perl, but it has the history functions that are in Term::ReadLine::Gnu (and GNU readline itself). Also, if there is a problem with Term::ReadLine::Perl5, it will probably get addressed much quicker than Term::ReadLine::Perl.
Subject: Term::ReadLine::Perl5-support.patch
diff --git a/lib/Devel/REPL/Plugin/Completion.pm b/lib/Devel/REPL/Plugin/Completion.pm index dcc1837..144d0d5 100644 --- a/lib/Devel/REPL/Plugin/Completion.pm +++ b/lib/Devel/REPL/Plugin/Completion.pm @@ -34,9 +34,9 @@ has do_readline_filename_completion => ( # so default is no if Completion loade before 'read' => sub { my ($self) = @_; - if ((!$self->term->isa("Term::ReadLine::Gnu") and !$self->term->isa("Term::ReadLine::Perl")) + if ((!$self->term->isa("Term::ReadLine::Gnu") and !$self->term->isa("Term::ReadLine::Perl") and !$self->term->isa("Term::ReadLine::Perl5")) and !$self->no_term_class_warning) { - warn "Term::ReadLine::Gnu or Term::ReadLine::Perl is required for the Completion plugin to work"; + warn "Term::ReadLine::Gnu, Term::ReadLine::Perl5 or Term::ReadLine::Perl are required for the Completion plugin to work"; $self->no_term_class_warning(1); } @@ -49,7 +49,7 @@ before 'read' => sub { }; } - if ($self->term->isa("Term::ReadLine::Perl")) { + if ($self->term->isa("Term::ReadLine::Perl") or $self->term->isa("Term::ReadLine::Perl")) { $self->term->Attribs->{completion_function} = sub { $weakself->_completion(@_); }; @@ -138,4 +138,3 @@ Set the attribute C<do_readline_filename_completion> to 1 to enable this feature Shawn M Moore, C<< <sartak at gmail dot com> >> =cut - diff --git a/lib/Devel/REPL/Plugin/ReadLineHistory.pm b/lib/Devel/REPL/Plugin/ReadLineHistory.pm index 75e3b3b..bfec2a1 100644 --- a/lib/Devel/REPL/Plugin/ReadLineHistory.pm +++ b/lib/Devel/REPL/Plugin/ReadLineHistory.pm @@ -20,14 +20,15 @@ my $hist_len=$ENV{PERLREPL_HISTLEN} || 100; around 'run' => sub { my $orig=shift; my ($self, @args)=@_; - if ($self->term->ReadLine eq 'Term::ReadLine::Gnu') { + if ($self->term->ReadLine eq 'Term::ReadLine::Gnu' or + $self->term->ReadLine eq 'Term::ReadLine::Perl5') { $self->term->stifle_history($hist_len); - } - if ($self->term->ReadLine eq 'Term::ReadLine::Perl') { + } elsif ($self->term->ReadLine eq 'Term::ReadLine::Perl') { $self->term->Attribs->{MaxHistorySize} = $hist_len; } if (-f($hist_file)) { - if ($self->term->ReadLine eq 'Term::ReadLine::Gnu') { + if ($self->term->ReadLine eq 'Term::ReadLine::Gnu' or + $self->term->ReadLine eq 'Term::ReadLine::Perl5') { $self->term->ReadHistory($hist_file); } if ($self->term->ReadLine eq 'Term::ReadLine::Perl') { @@ -104,7 +105,6 @@ expansion method. In that case, you may wish to use the Devel::REPL History plugin which provides similar functions. Work is underway to make use of either History or ReadLineHistory consistent for expansion with either the -Term::ReadLine::Gnu support or Term::ReadLine::Perl. +Term::ReadLine::Gnu support Term::ReadLine::Perl5, or Term::ReadLine::Perl. =cut -
Rocky, can you please come up with a patch to generalise the readline handling across all Term::ReadLine modules? There's also Term::ReadLine::EditLine (libedit is native to BSD and OS X) and Term::ReadLine::Caroline (pure-perl port of the linenoise library). -- just another Devel::REPL user
On Wed Oct 09 12:10:45 2013, DAXIM wrote: Show quoted text
> Rocky, can you please come up with a patch to generalise the readline > handling across all Term::ReadLine modules? There's also > Term::ReadLine::EditLine (libedit is native to BSD and OS X) and > Term::ReadLine::Caroline (pure-perl port of the linenoise library). > > -- just another Devel::REPL user
Perhaps you would like to suggest a patch to generalize readline handling since this seems to be of interest to you? This is very far from my area of interest now. Originally I got involved with Term::ReadLine::Perl5 because I wanted to add a history mechanism to Term::ReadLine:Perl and the author of that is unresponsive. I'd really like to find someone to take over maintaining of Term::ReadLine::Perl5.