http://www.perlmonks.org?node_id=752993

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.

Replies are listed 'Best First'.
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.
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?

      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.

      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...