Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

You can only create a single object of Term::ReadLine if the Term::ReadLine::Perl 'personality' is being used.

Behold

C:\tmp>perl foo.pl What is your default prog. lang? [Perl]: What is your OS? [MacOS]: C:\tmp>perl -I Term-ReadLine-Perl-1.0303\blib\lib foo.pl What is your default prog. lang? [Perl]: Cannot create second readline interface, falling back to dumb. What is your OS? [MacOS]: C:\tmp>

And this limitation isn't just a MSWin32 thing:

[canker:]$ perl foo.pl What is your default prog. lang? [Perl]: What is your OS? [MacOS]: [canker:]$ perl -ITerm-ReadLine-Perl-1.0303/blib/lib foo.pl What is your default prog. lang? [Perl]: Cannot create second readline interface, falling back to dumb. What is your OS? [MacOS]:

Forcing Term::ReadLine to load the Stub personality should work fine.

use strict; use warnings; BEGIN { $ENV{PERL_RL}='Stub'; }; use Term::UI; use Term::ReadLine; my $term = Term::ReadLine->new('lang'); my $reply = $term->get_reply( prompt => 'What is your default prog. la +ng?', default => 'Perl'); my $term2 = Term::ReadLine->new('OS'); $reply = $term2->get_reply( prompt => 'What is your OS?', default => ' +MacOS');

And it does

C:\tmp>perl -I Term-ReadLine-Perl-1.0303\blib\lib foo.pl What is your default prog. lang? [Perl]: What is your OS? [MacOS]: C:\tmp>

And on a non-MSWin32 OS too

[canker:]$ perl -ITerm-ReadLine-Perl-1.0303/blib/lib foo.pl What is your default prog. lang? [Perl]: What is your OS? [MacOS]: [canker:]$

In reply to Re^3: Term::UI on Win32 by bingos
in thread Term::UI on Win32 by derimac

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-25 12:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found