views:

387

answers:

6

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.

A: 

Try running this command before you run Perl:

export COLUMNS LINES
Chris Jester-Young
Hi Chris,Tried exporting COLUMNS,LINES now invoking the debugger just hangs with out taking to the debugger prompt.bash-3.2$ export COLUMNS=80bash-3.2$ export LINES=24bash-3.2$ perl -d testReliance1.pl
Naga Kiran
In that case, it sounds like ActiveState Perl isn't compatible with Screen (or Cygwin ptys in general) then. :-(
Chris Jester-Young
A: 

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
Greg Bacon
Disabling TERM::ReadLine also doesn't work as it just hangs without taking to the debugger prompt.one more strange thing is that it works fine at bash shell in cgywin but fails to run from bash shell inside screen..so GNU screen enviornment may be causing the problem
Naga Kiran
It seems that it works fine if bash shell is launched from DOS Prompt(cmd.exe) and it doesn't work from cygwin shell
Naga Kiran
+1  A: 

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.

Andrew Aylett
+1  A: 

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
Evan Carroll
+1  A: 

Hi Evan,

Thanks for suggestion. I installed Strawberry perl but the issue still persists. Please correct me if I need to set any configuration to make it work.

bash-3.2$ perl -d testPerl1.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 C:\strawberry\perl\vendor\lib/Term/ReadKey.pm line 370.
Compilation failed in require at C:\strawberry\perl\vendor\lib/Term/ReadLine/Perl.pm line 63.
 at C:\strawberry\perl\vendor\lib/Term/ReadLine/Perl.pm line 63
        Term::ReadLine::Perl::new('Term::ReadLine', 'perldb', 'GLOB(0xa7d1fc)', 'GLOB(0xa21a74)') called at C:/strawberry/perl/lib/perl5db.pl line 607
3
        DB::setterm called at C:/strawberry/perl/lib/perl5db.pl line 2237
        DB::DB called at testPerl1.pl line 10
Attempt to reload Term/ReadLine/readline.pm aborted.
Compilation failed in require at C:\strawberry\perl\vendor\lib/Term/ReadLine/Perl.pm line 63.
END failed--call queue aborted at testPerl1.pl line 63.
 at testPerl1.pl line 63   
Naga Kiran
check my update.
Evan Carroll
ok, i got the solution that should work.
Evan Carroll
A: 

Hi Evan,

Really appreciate your help.

with cygwin Perl

bash-3.2$ /usr/bin/perl -MTerm::ReadKey -E"say Term::ReadKey::termsizeoptions()"
2

with strwaberry Perl

bash-3.2$ perl -MTerm::ReadKey -E"say Term::ReadKey::termsizeoptions()"
8

If I replace &termsizeoptions with 8,its not working. It looks like if termsizeoptions equals to 8,it uses Windows API "GetConsoleScreenBufferInfo" which is failing in cygwin environment. If I replace &termsizeoptions with 2, getting the following error

bash-3.2$ perl -d testPerl1.pl
TermSizeGWINSZ is not implemented on this architecture at C:\strawberry\perl\vendor\lib/Term/ReadKey.pm line 304.
Naga Kiran