in reply to Re: about Term::ReadLine and it's imported function
in thread about Term::ReadLine and it's imported function
Eventually, modifying the code to use the ENV var seems to produce the same results:CPAN Terminal> l Term::ReadLine .. Version Installed 1.14 Version on CPAN 1.14 CPAN Terminal> l Term::ReadLine::Perl .. Version Installed 1.0303 Version on CPAN 1.0303 #anyway using Term::ReadLine::Perl directly cause some error: io@COMP:C>perl -MTerm::ReadLine::Perl -e 0 Can't locate object method "Features" via package "Term::ReadLine::Stu +b" at C:/ulisse/strawberry/perl/lib/Term/ReadLine Perl.pm line 101. Compilation failed in require. BEGIN failed--compilation aborted.
That said, it seems to be an headache builder. Thanks for the suggestions.#!perl use strict; use warnings; use Term::ReadLine; BEGIN{$ENV{PERL_RL}="Perl"} print "\$ENV{PERL_RL} $ENV{PERL_RL}\n"; $ENV{TERM}=undef; my $term = Term::ReadLine->new('xxx'); print $term->ReadLine; my %cmds = (a=>1,b=>2); # THIS WORKS &readline::rl_basic_commands(keys %cmds); # THE FOLLOWING CHECK DOES NOT WORK if (exists &readline::rl_basic_commands){print "BEFORE WHILE EXISTS +\n"; &readline::rl_basic_commands(keys %cmds);} while ( defined ( $_ = $term->readline( '>') ) ) { print "$_\n"; } continue{ # THIS CHECK WORKS INDEED! if (exists &readline::rl_basic_commands){print "IN CONTINUE EXISTS\ +n"; &readline::rl_basic_commands(keys %cmds);} } ###OUTPUT $ENV{PERL_RL} Perl > ###if you press TAB the current dir content is dumped: this is the def +ault behaviour if ###you does not provide autocompletion list ###but after, if you press ENTER: > Term::ReadLine::Perl IN CONTINUE EXISTS > a b >
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: about Term::ReadLine and it's imported function
by LanX (Saint) on Nov 24, 2014 at 20:25 UTC |