如何让 ActivePerl 与 cygwin 的屏幕完美配合?

发布于 2024-08-18 20:16:54 字数 1166 浏览 5 评论 0原文

我想使用 cygwin 工具(屏幕)进行开发,并从 cygwin 环境调用 ActiveState Perl 调试器会引发以下错误。

bash-3.2$ perl -d test.pl
The system cannot find the path specified.
Unable to get Terminal Size. The Win32 GetConsoleScreenBufferInfo call didn't work. The COLUMNS and LINES environment variables didn't work. The resiz
e program didn't work. at F:/Perl/lib/Term/ReadKey.pm line 362.
Compilation failed in require at F:/Perl/lib/Term/ReadLine/Perl.pm line 64.
 at F:/Perl/lib/Term/ReadLine/Perl.pm line 64
        Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0x18e2e0c)', 'GLOB(0x1883e14)') called at F:/Perl/lib/perl5db.pl line 6073
        DB::setterm called at F:/Perl/lib/perl5db.pl line 2237
        DB::DB called at testReliance1.pl line 2
Attempt to reload Term/ReadLine/readline.pm aborted.
Compilation failed in require at F:/Perl/lib/Term/ReadLine/Perl.pm line 64.
END failed--call queue aborted at testReliance1.pl line 64.
 at testReliance1.pl line 64
bash-3.2$

我找不到任何解决方法。
尝试使用 cygwin perl distrubution,但是在 cpan 下编译 perl 模块对我来说是一场噩梦,因为它们中的大多数都无法编译并且没有深入的知识来修复编译器错误。

为调试器提供一个假终端可能有效,但不知道可行性以及如何继续。
请建议是否有任何解决方法。

I would like to use cygwin tools (screen) for development and invoking ActiveState Perl debugger from cygwin environment throws the following error.

bash-3.2$ perl -d test.pl
The system cannot find the path specified.
Unable to get Terminal Size. The Win32 GetConsoleScreenBufferInfo call didn't work. The COLUMNS and LINES environment variables didn't work. The resiz
e program didn't work. at F:/Perl/lib/Term/ReadKey.pm line 362.
Compilation failed in require at F:/Perl/lib/Term/ReadLine/Perl.pm line 64.
 at F:/Perl/lib/Term/ReadLine/Perl.pm line 64
        Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0x18e2e0c)', 'GLOB(0x1883e14)') called at F:/Perl/lib/perl5db.pl line 6073
        DB::setterm called at F:/Perl/lib/perl5db.pl line 2237
        DB::DB called at testReliance1.pl line 2
Attempt to reload Term/ReadLine/readline.pm aborted.
Compilation failed in require at F:/Perl/lib/Term/ReadLine/Perl.pm line 64.
END failed--call queue aborted at testReliance1.pl line 64.
 at testReliance1.pl line 64
bash-3.2$

I couldn't find any workaround for this.
Tried to use cygwin perl distrubution,but compiling perl modules under cpan is nightmare for me as most of them won't compile and don't have in-depth knowledge to fix compiler errors.

Providing a fake terminal for debugger may work but no idea about feasibility and how to proceed.
Please suggest if there is any workaround for this.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

猫卆 2024-08-25 20:16:54

来自 Term::ReadLine 文档的 “环境”部分

环境变量PERL_RL 控制加载哪个ReadLine 克隆。如果该值为 false,则使用虚拟接口。

作为解决不兼容性问题之前的解决方法,您可以禁用 Term::ReadLine

bash$ PERL_RL=0 perl -d test.pl

From the "Environment" section of the Term::ReadLine documentation :

The environment variable PERL_RL governs which ReadLine clone is loaded. If the value is false, a dummy interface is used.

As a workaround until the incompatibility is sorted out, you can disable Term::ReadLine with

bash$ PERL_RL=0 perl -d test.pl
浮光之海 2024-08-25 20:16:54

请记住,Windows 控制台提供了与常规 *nix 控制台截然不同的环境。一般来说,想要与控制台交互的 Windows 应用程序无法在 Cygwin 控制台(如 MinTTY、XTerm、Screen)中运行,因为它们只提供 PTY 模拟。

MinTTY 的作者 Andy Koppe 撰写了一个名为 conin 的小程序,允许 Windows 程序像从控制台一样读取,但完整的输出支持仍被认为不可行。

Remember that the Windows console provides a very different environment to your regular *nix console. In general, Windows applications that want to interact with the console won't work in Cygwin consoles (like MinTTY, XTerm, Screen) because they only provide PTY emulation.

Andy Koppe, author of MinTTY, has written a small program called conin to allow windows programs to read as if from the console, but full output support is still considered infeasible.

顾挽 2024-08-25 20:16:54

在我看来,你好像遇到了很多问题。 ActiveState Perl 是一种将 Perl 移植到 Windows 的尝试,具有模块的二进制分发和版本控制,这种方法正在消亡。 strawberry perl 的成功和我的个人经验让我认为您只是使用了错误的产品。

我只用草莓,自从移民以来我遇到的问题数量一只手就能数得过来。我很高兴从 ActiveState 转换过来。我建议你也尝试一下。 Strawberry 附带了一个 mingw 环境——它甚至会为您编译 XS 模块,并且它为您打开了一个纯粹的 CPAN。

(这是一个完全不同寻常的答案,但我相当确定我已经在 cygwin 中使用了草莓 perl 的 bin,并且它已经起作用)

解决方案 - 使用 Cygwins Term ReadKey

本质上,您只需要 Cygwin Term::ReadKey< /code> 在你的 lib 啄食顺序中处于较高位置,以便使用它。

  1. 创建目录 D:\foo_lib
  2. 将 term/ReadKey 目录从 cygwins /usr/lib/perl 复制到 D:\foo_lib
  3. 将 Term/ReadKey.pm 复制到 D:\foo_lib\Term\
  4. prepend PERL5LIB="D:\foo_lib " 到您的 StrawBerry Perl 环境。

或。


从 Cygwin 运行此命令。

perl -MTerm::ReadKey -E"say Term::ReadKey::termsizeoptions()"

无论该值是什么,请从您的 Strawberry 安装中编辑 Term/ReadKey.pm 并将其手动破解,设置一个变量

  1. my $termoption = value_you_got from 上述
  2. 替换 &termsizeoptions(),与$termoption

It seems to me as if you're having a lot of problems. ActiveState Perl is an attempt at a port of Perl to windows with binary-distribution and version control for modules, this approach is dieing. The success of strawberry perl and my personal experience makes me think you're simply using the wrong product.

I use strawberry exclusively and the amount of problems that I've experienced since migration I can count on one hand. I'm very happy having converted from ActiveState. I'd suggest you give it a shot too. Strawberry comes with a mingw environment -- it will even compile XS modules for you, and it opens you up to an unadulterated CPAN.

(this is a totally off beat answer, but I'm fairly certain I've used strawbery perl's bin in cygwin and it has worked)

Solution - Use Cygwins Term ReadKey

Essentially, you simply need the Cygwin Term::ReadKey to sit higher in your lib pecking order so it is used.

  1. Create a directory D:\foo_lib
  2. Copy the term Term/ReadKey directory from your cygwins /usr/lib/perl to D:\foo_lib
  3. Copy Term/ReadKey.pm to D:\foo_lib\Term\
  4. prepend PERL5LIB="D:\foo_lib" to your environment for StrawBerry perl.

or.


Run this, from Cygwin.

perl -MTerm::ReadKey -E"say Term::ReadKey::termsizeoptions()"

Whatever that value is, edit Term/ReadKey.pm from your Strawberry install hand-hack it in there, set a variable

  1. my $termoption = value_you_got from above
  2. substitute &termsizeoptions(), with $termoption
赴月观长安 2024-08-25 20:16:54

在运行 Perl 之前尝试运行此命令:

export COLUMNS LINES

Try running this command before you run Perl:

export COLUMNS LINES
初心 2024-08-25 20:16:54

使用与 ActiveState perl 一起打包的 wperl.exe。这往往可以正常工作。

Use wperl.exe which is packaged with ActiveState perl. This tends to work properly.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文