in reply to emulate the Term::ReadLine's two arguments form

I was recently also struggeling with T:RL. as it seems Gnu-Readline is the reference implementation and all alternatives have practically no POD.

If you don't wanna install an XS module, I'd recommend to take one of the pure Perl implemantations, which have practically no dependencies, i.e. you could simply copy them into your distribution and modify them as you wish (but check licence before!)

see %Features of T::RL to know which functionality is supported by underlying module.

DB<105> $term->Features => { addHistory => 1, appname => 1, attribs => 1, autohistory => 1, getHistory => 1, minline => 1, newTTY => 1, ornaments => 1, preput => 1, readHistory => 1, setHistory => 1, stiflehistory => 1, tkRunning => 1, writeHistory => 1, }

I suppose preput means what your looking for.

HTH

Cheers Rolf

Replies are listed 'Best First'.
Re^2: emulate the Term::ReadLine's two arguments form
by Khen1950fx (Canon) on Feb 17, 2012 at 16:13 UTC
    "preput" it is. Good work++. Here's my attempt at a preput.
    #!/usr/bin/perl -l use strict; use warnings; use Term::ReadLine; my $term = new Term::ReadLine "Default Input"; my $input = $term->readline("Enter some text: ", "What do you want to +say?"); print "You entered: $input";
      thanks to you all, but
      the problem is that in the previous posted code, in my two installations the 'editable second arg' is simply ignored.

      more: i cannot succesfully load the T:RL:Perl module in the starwberry installation: the error is my first post.
      if i load directly that module in a script, nothing special appens nor error catched by strict or warning..

      how can i then replicate this behavior in every Perl installation?

      thanks
      L*
      there are no rules, there are no thumbs..
        So install it by hand, as I told you I'm pretty sure even copying should do it and¹ if you want to distribute your app, include that module into it.

        Cheers Rolf

        ¹) updated