Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

CPAN and readline on windows

by BrowserUk (Pope)
on Mar 25, 2009 at 02:11 UTC ( #752993=perlquestion: print w/ replies, xml ) Need Help??
BrowserUk has asked for the wisdom of the Perl Monks concerning the following question:

Is there any (official) way to disable CPAN's use of readline?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Comment on CPAN and readline on windows
Re: CPAN and readline on windows
by Narveson (Chaplain) on Mar 25, 2009 at 09:18 UTC

    I'm terribly sorry, after BrowserUk has given so much help to so many, to see how little help we are giving him.

    While we're waiting for an answer, could someone help me understand the question? How does CPAN use readline, and why might BrowserUk wish to disable this?

      Windows itself already provides functionality similar but different from what Readline provides. And of course, not everybody likes Emacs shortcuts like ^A when the Windows default is to use the HOME key...

      How does CPAN use readline, and why might BrowserUk wish to disable this?

      It is (apparently) used on other platforms to provide line editing, command line history etc.

      The reasons I want to disable it is because:

      1. it doesn't work on my system.

        With it enabled I can neither edit the current line as I am typing, nor retrieve previous lines--even from the current session. It effectively renders all input as write-only. Make a typo and your only option is to start again from scratch.

      2. it disables my shell's existing, perfectly functional command line editing and history facilities.

      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.
Re: CPAN and readline on windows
by xdg (Monsignor) on Mar 25, 2009 at 10:57 UTC

    Well, given that so much of CPAN.pm is still based on globals, you can do this:

    perl -MCPAN -e "$CPAN::Suppress_readline=1; shell"

    Eventually, that should probably get moved to (yet another) configuration option. Please consider opening up an RT ticket about it if there isn't one already so we have it on the list of things to do.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

      Yes. I've added:

      $Suppress_readline = 1;

      just after the use vars: where it is declared.

      The reason for asking if there was an official way of disabling it is because at the top of the shell() method, there is this line:

      $Suppress_readline = ! -t STDIN unless defined $Suppress_readline;

      which implies that $Suppress_readline could somehow be defined prior to the test on STDIN.

      I couldn't find the mechanism whereby that might occur--barring your way of setting it on the command line--, but had there been some existing mechanism (maybe an environment variable or similar), I would prefer that to modifying the script directly.


      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority".
      In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://752993]
Approved by bobf
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-04-17 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (437 votes), past polls