#!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 default behaviour if ###you does not provide autocompletion list ###but after, if you press ENTER: > Term::ReadLine::Perl IN CONTINUE EXISTS > a b >