Skip Menu |

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

Report information
The Basics
Id: 40724
Status: resolved
Priority: 0/
Queue: Term-Interact

People
Owner: PRL [...] cpan.org
Requestors: henrik.seidel [...] gmx.de
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.44
Fixed in: (no value)



I think I found a bug in Term::Interact. The default message which is constructed if no msg but a name is specified is wrong - the default value is missing in the displayed message. I attached an example script demonstrating the bug and a patch. Term-Interact-0.44.tar.gz perl, v5.10.0 built for cygwin-thread-multi-64int on Windows XP CYGWIN_NT-5.1 1.5.25(0.156/4/2) 2008-06-12 19:34 i686 Cygwin
Subject: Interact.pm.diff
--- Interact.pm.orig 2008-11-06 14:42:45.548803900 +0000 +++ Interact.pm 2008-11-06 15:09:05.437858300 +0000 @@ -1030,6 +1030,7 @@ my $enter = 'Enter a value'; my $default = ''; + my $w_value_values = 'value'; my $w_is_are = 'is'; if (defined $parm->{default} and $parm->{default} ne '') { $enter = 'enter a value'; @@ -1049,15 +1050,13 @@ } else { $w_default = $parm->{default}->[0]; } - } else { - if (defined $parm->{type} and $parm->{type} eq 'date') { - $w_default = UnixDate('epoch ' . $parm->{default}, '%s' ); - } else { - $w_default = $parm->{default}; - } } } else { - $w_value_values = 'value'; + if (defined $parm->{type} and $parm->{type} eq 'date') { + $w_default = UnixDate('epoch ' . $parm->{default}, $parm->{date_format_display} ); + } else { + $w_default = $parm->{default}; + } } $default = "The default $w_value_values $w_is_are $w_default. Press ENTER to accept the default, or ";
Subject: t.pl
use strict; use warnings; use Term::Interact; my $ti = Term::Interact->new( date_format_display => '%Y-%m-%d', date_format_return => '%Y-%m-%d', confirm => 1, ); my $date = $ti->get( name => 'Order date', default => 'today', type => 'date', ); print "Date: $date\n";
Version 0.50 has been uploaded to CPAN. Thanks again for the bug report. prl