Hello monks,
i used
readline::rl_basic_commands as only way to have autocompletion working in win32. if i remember correctly i found the mention
here.
I had used this sub in some programs based on various Strawberry distros without any problem.
Now i have a new program i would like to run on Win32 as in Linux and it uses only core modules.
I developped on my strawberry Perl but when tried on the Linux box it complains about that missing sub:
Undefined subroutine &readline::rl_basic_commands called at...
So i changed the call in something like:
if (exists &readline::rl_basic_commands){&readline::rl_basic_commands(
+keys %cmds);}
Now on Linux works (without autocompletion), but using that syntax on win32 made the first time intialization of available commands not working. The following working example shows my problem:
#!perl
use strict;
use warnings;
use Term::ReadLine;
$ENV{TERM}=undef;
my $term = Term::ReadLine->new('xxx');
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);}
}
Where and when the sub is defined?
There is safe way to deal with it?
There is a way have it working on both Linux and Win32, even in the sad case without autocompletion?
Thanks for the attention.
L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.