hello there,

i was trying to add an 'edit' function to a command line interactive menù where i have to use only core modules.
The behaviour i want is: when you type 'edit somekey', if somekey exists in a hash, you get a prompt like:
edit somekey>This is the editable string: change it if you want.
Then you can use backspace to cancel, arrows to move, etc, etc..
Borwsing the core modules list i have encountered Term::ReadLine and asking in the chatterbox some wise monk told me that T:RL:Perl can call readline with two argouments where the second one is an 'editable text string'
In some clean new installation this worked but in some other no, beacuse seems that T:RL call other modules (T:RL::Perl and T:RL::GNU, for example) and only some module can handle the two argouments form and this is why the form is not documented.

in which way can I reproduce this behaviour?

I looked at the source of the T:RL::Perl at the readline sub but, sincerely, i cannot understand it.

More: i'm a little bit confused about this module and the core list: the main is in the core list but can load the perl or the gnu version. But T:RL::Perl is not in the core list..

the docs say that the method call ReadLine returns which version is loaded so in two different Perl installation i tried this:
perl -e "use Term::ReadLine; $term = Term::ReadLine->new('name'); + print $term->ReadLine" #in both installation it returns: Term::ReadLine::Perl # #but when i tried: # perl -e "use Term::ReadLine::Perl" #in one installation (strawberry) i got: Can't locate object method "Features" via package "Term::ReadLine::Stu +b" at C:/Perl_Flash/pperl2/pperl/perl/site/lib/Term/ReadLine/Perl.pm +line 101. Compilation failed in require at -e line 1. BEGIN failed--compilation aborted at -e line 1.
in conclusion:

how can i replicate the wanted behaviour of pre-filling some user's input?
what is the situation for this module? thanks for the patience

L*

there are no rules, there are no thumbs..

In reply to emulate the Term::ReadLine's two arguments form by Discipulus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.