Skip Menu |

This queue is for tickets about the Term-ReadPassword CPAN distribution.

Report information
The Basics
Id: 28714
Status: resolved
Priority: 0/
Queue: Term-ReadPassword

People
Owner: Nobody in particular
Requestors: schwigon [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 0.07
Fixed in: (no value)



Subject: constant CC_FIELDS error with Perl 5.9.x
Hi! Something in "use constant" has changed since Perl 5.9.3 which breaks the way it is used in Term::ReadPassword. The attached patch fixes it by using a real variable instead of a constant. I'm anyway not sure I understood this termios stuff right, e.g. I also have problems using the constant NCCS, for which POSIX::Termios complains in getcc calls. The patch does not include a fix to this as I'm not sure. Although I personally had to remove the constant NCCS from the CC_FIELDS array locally on my machine. I hope you have tuits to fix that, else feel free to ask for co-maintainership. Thanks for your module. Greetings from Dresden, Steffen -- Steffen Schwigon <schwigon@webit.de> Dresden Perl Mongers <http://dresden-pm.org/> Deutscher Perl-Workshop <http://www.perl-workshop.de/>
Subject: constant_5.9_fix.patch
--- ReadPassword.pm 2005-10-25 20:56:02.000000000 +0200 +++ ../ReadPassword.pm 2007-08-07 14:18:23.000000000 +0200 @@ -3,16 +3,17 @@ use strict; use Term::ReadLine; use POSIX qw(:termios_h); - use constant CC_FIELDS => - (VEOF VEOL VERASE VINTR VKILL VQUIT - VSUSP VSTART VSTOP VMIN VTIME NCCS); use vars qw( - $VERSION @ISA @EXPORT @EXPORT_OK + $VERSION @ISA @EXPORT @EXPORT_OK @CC_FIELDS $ALLOW_STDIN %SPECIAL $SUPPRESS_NEWLINE $INPUT_LIMIT $USE_STARS $STAR_STRING $UNSTAR_STRING ); +@CC_FIELDS = + (VEOF, VEOL, VERASE, VINTR, VKILL, VQUIT, + VSUSP, VSTART, VSTOP, VMIN, VTIME, NCCS); + require Exporter; @ISA = qw(Exporter); @@ -74,7 +75,7 @@ my $term = POSIX::Termios->new(); $term->getattr($fd_tty); my $original_flags = $term->getlflag(); - my %original_cc = map +($_, $term->getcc($_)), CC_FIELDS; + my %original_cc = map +($_, $term->getcc($_)), @CC_FIELDS; # What makes this setup different from the ordinary? # No keyboard-generated signals, no echoing, no canonical input
CC: bug-Term-ReadPassword [...] rt.cpan.org
Subject: Re: [rt.cpan.org #28714] constant CC_FIELDS error with Perl 5.9.x
Date: Tue, 7 Aug 2007 08:35:11 -0700
To: "Steffen Schwigon" <schwigon [...] webit.de>
From: "Tom Phoenix" <rootbeer [...] redcat.com>
On 8/7/07, Steffen Schwigon via RT <bug-Term-ReadPassword@rt.cpan.org> wrote: Show quoted text
> Something in "use constant" has changed since Perl 5.9.3 > which breaks the way it is used in Term::ReadPassword.
Show quoted text
> The attached patch fixes it by using a real variable > instead of a constant.
Thanks for the patch. But a change in the behavior of "use constant" will affect many more programs and modules than this minor one. Unless this module is mis-using "use constant", we shouldn't need to patch its code. (But thanks for submitting the patch; I may apply it anyway.) We need to fix "use constant" to work just as it used to, if at all possible. Have you filed a bug report (or are you filing one right now) about the change of behavior of "use constant"? Thanks! --Tom Phoenix
CC: SCHWIGON [...] cpan.org
Subject: Re: [rt.cpan.org #28714] constant CC_FIELDS error with Perl 5.9.x
Date: Wed, 08 Aug 2007 10:09:17 +0200
To: bug-Term-ReadPassword [...] rt.cpan.org
From: Steffen Schwigon <schwigon [...] webit.de>
"Tom Phoenix via RT" <bug-Term-ReadPassword@rt.cpan.org> writes: Show quoted text
> <URL: http://rt.cpan.org/Ticket/Display.html?id=28714 > > > On 8/7/07, Steffen Schwigon via RT <bug-Term-ReadPassword@rt.cpan.org> wrote: >
>> Something in "use constant" has changed since Perl 5.9.3 >> which breaks the way it is used in Term::ReadPassword.
>
>> The attached patch fixes it by using a real variable >> instead of a constant.
> > Thanks for the patch. But a change in the behavior of "use constant" > will affect many more programs and modules than this minor > one. Unless this module is mis-using "use constant", we shouldn't > need to patch its code. (But thanks for submitting the patch; I may > apply it anyway.) We need to fix "use constant" to work just as it > used to, if at all possible. > > Have you filed a bug report (or are you filing one right now) about > the change of behavior of "use constant"?
I already contacted Andreas Koenig, he currently checks with his amazing binary search which patch of Perl changed the constants behaviour. Depending on the results I will ask in perl5-porters what's the right way to handle that. Thanks for your quick response. GreetinX Steffen -- Steffen Schwigon <schwigon@webit.de> Dresden Perl Mongers <http://dresden-pm.org/> Deutscher Perl-Workshop <http://www.perl-workshop.de/>
From: SCHWIGON [...] cpan.org
Just to make it complete, as I wrote in p5p: http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2007-08/msg00268.html I think it is ok to just use commas in the constant list. Here's the patch. Please note that it also removes NCCS from the constant list, to solve the other bug http://rt.cpan.org/Ticket/Display.html?id=28726 which is only triggered when the array is correctly used which wasn't visible dur to this bug here. Thanks. Steffen -- Steffen Schwigon <schwigon@webit.de> Dresden Perl Mongers <http://dresden-pm.org/> Deutscher Perl-Workshop <http://www.perl-workshop.de/>
Attachment lost/forgotten?
I'm stupid ... :-)
--- ReadPassword.pm.orig 2005-10-25 20:56:02.000000000 +0200 +++ ReadPassword.pm 2007-08-10 17:15:43.000000000 +0200 @@ -4,8 +4,8 @@ use Term::ReadLine; use POSIX qw(:termios_h); use constant CC_FIELDS => - (VEOF VEOL VERASE VINTR VKILL VQUIT - VSUSP VSTART VSTOP VMIN VTIME NCCS); + (VEOF, VEOL, VERASE, VINTR, VKILL, VQUIT, + VSUSP, VSTART, VSTOP, VMIN, VTIME); use vars qw( $VERSION @ISA @EXPORT @EXPORT_OK
Fixed in 0.09