We don't bite newbies here... much | |
PerlMonks |
Gnu ReadLine word completion questionby rmcgowan (Sexton) |
on Mar 18, 2005 at 06:34 UTC ( [id://440634]=perlquestion: print w/replies, xml ) | Need Help?? |
rmcgowan has asked for the wisdom of the Perl Monks concerning the following question: I have an application that uses the ReadLine::Gnu module to provide list completion for data input. For example, I have a list of 2 or more items that the user is to select from. If the user already knows the value, it's ok to just type it in, but if not, I want the user to be able to press the tab key to get either the full list, partial list, or word competion, as appropriate. If I don't use the .inputrc 'set show-all-if-ambiguous On', the user has to press the tab key twice to get the full or partial list. With the variable 'On', a single tab press is enough. I want to set this programatically so users don't have to create a .inputrc file (and so the thing works as advertised, my input prompt says 'Press TAB key for a list'. I've found the attribute variable 'completion_type', but setting it does not have any impact on the script operation. My code looks like this (basically from the pftp example in the eg/ directory of the distribution):
Thanks for the help, Bob Update: I tried the rl_set(...) call suggested by Tanktalus, which resulted in the error:
I've also tried setting the attribute I thought is the one that controls this, as follows:
which does nothing. According to the documentation, the Gnu interger type variable 'rl_completion_type' "...describing the type of completion Readline is currently attempting...", so it sounds like it's actually an internal state record, not to be used to actually set the state. If anyone has any pointers to some decent tutorials on Gnu ReadLine itself, or the Perl module interface to it, I'd be deeply grateful. Bob
Back to
Seekers of Perl Wisdom
|
|