简体   繁体   中英

Missing "cpan>" prompt when running the CPAN shell in a Strawberry Perl environment under Cygwin

I've encountered a strange prompt problem when running the CPAN shell in a Strawberry Perl environment under Cygwin.

When launching the CPAN using perl -MCPAN -eshell I get the following output:

cpan shell -- CPAN exploration and modules installation (v1.9600)
Enter 'h' for help.

Please not that the standard cpan> prompt is missing. Why is that and how do I fix it?

When typing quit\\n I get the prompt but I issue the command:我发出命令后:

quit
cpan> Lockfile removed.

This is a basic problem running interactive windows programs in a cygwin terminal window. I don't have a handy cygwin installation to try it on, but try either

cygstart perl -MCPAN -eshell

or install conin and do

conin perl -MCPAN -eshell

If running git-bash (not cygwin), then start cpan with winpty:

winpty perl -MCPAN -eshell

The 'cpan> ' prompt should now be presented. You may get a warning:

Unable to get Terminal Size. The Win32 GetConsoleScreenBufferInfo call didn't work. The COLUMNS and LINES environment variables didn't work. at C:\Strawberry\perl\vendor\lib/Term/ReadLine/readline.pm line 410.

Which can be resolved by exporting the COLUMNS and LINES variables with the appropriate values. (Say):

export COLUMNS=80
export LINES=100

There are scripts that will pull the current window settings using bash, node or python.

bash:

export LINES=$(tput lines)
export COLUMNS=$(tput cols)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM