Skip Menu |

This queue is for tickets about the UI-Dialog CPAN distribution.

Report information
The Basics
Id: 33365
Status: resolved
Worked: 20 min
Priority: 0/
Queue: UI-Dialog

People
Owner: kevin [...] krinke.ca
Requestors: ronaldxs [...] software-path.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.08
Fixed in: 1.09



I have successfully built dialog 1.1, the program that used to be called Cdialog, under windows Vista and cygwin. The resulting executable, dialog,exe, works well both through cygwin and independently as a windows command shell / cmd application under both Vista and Windows XP. The UI::Dialog module did not run the dialog program successfully with the UI::Dialog::Backend::CDialog backend but I was able to get it to run well with some OS independence modifications to UI::Dialog::Backend::CDialog and one seemingly minor, and plausibly safe enough, modification to UI::Dialog::Backend. I have tested the results under Windows Vista, XP, and ubuntu 7.10 successfully. My tests under Windows were conducted with Activestate Perl 5.10. Patches are attached and included below. The dialog source that was used for my build came from the dialog home page at: http://invisible-island.net/dialog/ Best Wishes, Ronald Schmidt ronaldxs@software-path.com Patch for UI::Dialog::Backend::CDialog: --- /usr/local/share/perl/5.8.8/UI/Dialog/Backend/CDialog.pm 2004-10-03 23:16:43.000000000 -0400 +++ ./UI/Dialog/Backend/CDialog.pm 2008-02-08 10:55:00.000000000 -0500 @@ -18,6 +18,7 @@ ############################################################################### use 5.006; use strict; +use Config; use FileHandle; use Carp; use Cwd qw( abs_path ); @@ -44,12 +45,13 @@ $self->{'_opts'} = {}; #: Dynamic path discovery... + my $path_sep = $Config::Config{path_sep}; my $CFG_PATH = $cfg->{'PATH'}; if ($CFG_PATH) { if (ref($CFG_PATH) eq "ARRAY") { $self->{'PATHS'} = $CFG_PATH; } - elsif ($CFG_PATH =~ m!:!) { $self->{'PATHS'} = [ split(/:/,$CFG_PATH) ]; } + elsif ($CFG_PATH =~ m!$path_sep!) { $self->{'PATHS'} = [ split(/$path_sep/,$CFG_PATH) ]; } elsif (-d $CFG_PATH) { $self->{'PATHS'} = [ $CFG_PATH ]; } - } elsif ($ENV{'PATH'}) { $self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ]; } + } elsif ($ENV{'PATH'}) { $self->{'PATHS'} = [ split(/$path_sep/,$ENV{'PATH'}) ]; } else { $self->{'PATHS'} = ''; } $self->{'_opts'}->{'literal'} = $cfg->{'literal'} || 0; @@ -64,6 +66,7 @@ $self->{'_opts'}->{'percentage'} = $cfg->{'percentage'} || 1; $self->{'_opts'}->{'colours'} = ($cfg->{'colours'} || $cfg->{'colors'}) ? 1 : 0; $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog'); + $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog.exe') if $^O =~ /win32/i; $self->{'_opts'}->{'autoclear'} = $cfg->{'autoclear'} || 0; $self->{'_opts'}->{'clearbefore'} = $cfg->{'clearbefore'} || 0; $self->{'_opts'}->{'clearafter'} = $cfg->{'clearafter'} || 0; @@ -200,7 +203,8 @@ my $self = $_[0]; my $cmnd = $_[1]; $self->_debug("".$cmnd); - system($cmnd . " 2> /dev/null"); + my $null_dev = $^O =~ /win32/i ? 'NUL:' : '/dev/null'; + system($cmnd . " 2> $null_dev"); return($? >> 8); } sub command_string { @@ -274,7 +278,11 @@ && (length($s_line) <= $self->{'max-scale'}); } } + + my $want_chop; + my $default_pad = $^O !~ /win32/i ? "\n" : ' '; foreach my $line (@array) { + undef $want_chop; my $pad; my $s_line = $self->_strip_text($line); if ($line =~ /\[A\=(\w+)\]/i) { @@ -291,8 +299,13 @@ } } if ($pad) { $text .= (" " x $pad).$line."\n"; } - else { $text .= $line."\n"; } + else { + $text .= "$line$default_pad"; + $want_chop = 1; # only remains set for last line + } } + chop $array[ $#array ] if $want_chop; # small actual change here + return($self->_filter_text($text)); } sub _strip_text { Patch for UI::Dialog::Backend: --- /usr/local/share/perl/5.8.8/UI/Dialog/Backend.pm 2004-10-03 23:19:29.000000000 -0400 +++ ./UI/Dialog/Backend.pm 2008-02-08 10:32:52.000000000 -0500 @@ -222,8 +222,13 @@ if (eval("require File::Temp; 1")) { use File::Temp qw( tempfile ); my ($fh,$filename) = tempfile( UNLINK => 1 ) or croak( "Can't create tempfile: $!" ); - return($filename) unless wantarray; + if (wantarray) { return($fh,$filename); + } + else { + close($fh); # actually required on win32 + return($filename); + } } else { my $mktemp = $self->_find_bin('mktemp'); if ($mktemp && -x $mktemp) {
Subject: UI_Dialog_win32_1.patch
--- /usr/local/share/perl/5.8.8/UI/Dialog/Backend.pm 2004-10-03 23:19:29.000000000 -0400 +++ ./UI/Dialog/Backend.pm 2008-02-08 10:32:52.000000000 -0500 @@ -222,8 +222,13 @@ if (eval("require File::Temp; 1")) { use File::Temp qw( tempfile ); my ($fh,$filename) = tempfile( UNLINK => 1 ) or croak( "Can't create tempfile: $!" ); - return($filename) unless wantarray; + if (wantarray) { return($fh,$filename); + } + else { + close($fh); # actually required on win32 + return($filename); + } } else { my $mktemp = $self->_find_bin('mktemp'); if ($mktemp && -x $mktemp) {
Subject: UI_Dialog_win32_2.patch
--- /usr/local/share/perl/5.8.8/UI/Dialog/Backend/CDialog.pm 2004-10-03 23:16:43.000000000 -0400 +++ ./UI/Dialog/Backend/CDialog.pm 2008-02-08 10:55:00.000000000 -0500 @@ -18,6 +18,7 @@ ############################################################################### use 5.006; use strict; +use Config; use FileHandle; use Carp; use Cwd qw( abs_path ); @@ -44,12 +45,13 @@ $self->{'_opts'} = {}; #: Dynamic path discovery... + my $path_sep = $Config::Config{path_sep}; my $CFG_PATH = $cfg->{'PATH'}; if ($CFG_PATH) { if (ref($CFG_PATH) eq "ARRAY") { $self->{'PATHS'} = $CFG_PATH; } - elsif ($CFG_PATH =~ m!:!) { $self->{'PATHS'} = [ split(/:/,$CFG_PATH) ]; } + elsif ($CFG_PATH =~ m!$path_sep!) { $self->{'PATHS'} = [ split(/$path_sep/,$CFG_PATH) ]; } elsif (-d $CFG_PATH) { $self->{'PATHS'} = [ $CFG_PATH ]; } - } elsif ($ENV{'PATH'}) { $self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ]; } + } elsif ($ENV{'PATH'}) { $self->{'PATHS'} = [ split(/$path_sep/,$ENV{'PATH'}) ]; } else { $self->{'PATHS'} = ''; } $self->{'_opts'}->{'literal'} = $cfg->{'literal'} || 0; @@ -64,6 +66,7 @@ $self->{'_opts'}->{'percentage'} = $cfg->{'percentage'} || 1; $self->{'_opts'}->{'colours'} = ($cfg->{'colours'} || $cfg->{'colors'}) ? 1 : 0; $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog'); + $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog.exe') if $^O =~ /win32/i; $self->{'_opts'}->{'autoclear'} = $cfg->{'autoclear'} || 0; $self->{'_opts'}->{'clearbefore'} = $cfg->{'clearbefore'} || 0; $self->{'_opts'}->{'clearafter'} = $cfg->{'clearafter'} || 0; @@ -200,7 +203,8 @@ my $self = $_[0]; my $cmnd = $_[1]; $self->_debug("".$cmnd); - system($cmnd . " 2> /dev/null"); + my $null_dev = $^O =~ /win32/i ? 'NUL:' : '/dev/null'; + system($cmnd . " 2> $null_dev"); return($? >> 8); } sub command_string { @@ -274,7 +278,11 @@ && (length($s_line) <= $self->{'max-scale'}); } } + + my $want_chop; + my $default_pad = $^O !~ /win32/i ? "\n" : ' '; foreach my $line (@array) { + undef $want_chop; my $pad; my $s_line = $self->_strip_text($line); if ($line =~ /\[A\=(\w+)\]/i) { @@ -291,8 +299,13 @@ } } if ($pad) { $text .= (" " x $pad).$line."\n"; } - else { $text .= $line."\n"; } + else { + $text .= "$line$default_pad"; + $want_chop = 1; # only remains set for last line + } } + chop $array[ $#array ] if $want_chop; # small actual change here + return($self->_filter_text($text)); } sub _strip_text {
Subject: Win32/Cygwin OS independence patches for dialog/cdialog back end.
I have successfully built dialog 1.1, the program that used to be called Cdialog, under windows Vista and cygwin. The resulting executable, dialog,exe, works well both through cygwin and independently as a windows command shell / cmd application under both Vista and Windows XP. The UI::Dialog module did not run the dialog program successfully with the UI::Dialog::Backend::CDialog backend but I was able to get it to run well with some OS independence modifications to UI::Dialog::Backend::CDialog and one seemingly minor, and plausibly safe enough, modification to UI::Dialog::Backend. I have tested the results under Windows Vista, XP, and ubuntu 7.10 successfully. My tests under Windows were conducted with Activestate Perl 5.10. Patches are attached. The dialog source that was used for my build came from the dialog home page at: http://invisible-island.net/dialog/ Best Wishes, Ronald Schmidt ronaldxs@software-path.com This is a cleaned up version of bug report #33364 which may be removed when I, or someone else, figures out how.
Subject: UI_Dialog_win32_1.patch
--- /usr/local/share/perl/5.8.8/UI/Dialog/Backend.pm 2004-10-03 23:19:29.000000000 -0400 +++ ./UI/Dialog/Backend.pm 2008-02-08 10:32:52.000000000 -0500 @@ -222,8 +222,13 @@ if (eval("require File::Temp; 1")) { use File::Temp qw( tempfile ); my ($fh,$filename) = tempfile( UNLINK => 1 ) or croak( "Can't create tempfile: $!" ); - return($filename) unless wantarray; + if (wantarray) { return($fh,$filename); + } + else { + close($fh); # actually required on win32 + return($filename); + } } else { my $mktemp = $self->_find_bin('mktemp'); if ($mktemp && -x $mktemp) {
Subject: UI_Dialog_win32_2.patch
--- /usr/local/share/perl/5.8.8/UI/Dialog/Backend/CDialog.pm 2004-10-03 23:16:43.000000000 -0400 +++ ./UI/Dialog/Backend/CDialog.pm 2008-02-08 10:55:00.000000000 -0500 @@ -18,6 +18,7 @@ ############################################################################### use 5.006; use strict; +use Config; use FileHandle; use Carp; use Cwd qw( abs_path ); @@ -44,12 +45,13 @@ $self->{'_opts'} = {}; #: Dynamic path discovery... + my $path_sep = $Config::Config{path_sep}; my $CFG_PATH = $cfg->{'PATH'}; if ($CFG_PATH) { if (ref($CFG_PATH) eq "ARRAY") { $self->{'PATHS'} = $CFG_PATH; } - elsif ($CFG_PATH =~ m!:!) { $self->{'PATHS'} = [ split(/:/,$CFG_PATH) ]; } + elsif ($CFG_PATH =~ m!$path_sep!) { $self->{'PATHS'} = [ split(/$path_sep/,$CFG_PATH) ]; } elsif (-d $CFG_PATH) { $self->{'PATHS'} = [ $CFG_PATH ]; } - } elsif ($ENV{'PATH'}) { $self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ]; } + } elsif ($ENV{'PATH'}) { $self->{'PATHS'} = [ split(/$path_sep/,$ENV{'PATH'}) ]; } else { $self->{'PATHS'} = ''; } $self->{'_opts'}->{'literal'} = $cfg->{'literal'} || 0; @@ -64,6 +66,7 @@ $self->{'_opts'}->{'percentage'} = $cfg->{'percentage'} || 1; $self->{'_opts'}->{'colours'} = ($cfg->{'colours'} || $cfg->{'colors'}) ? 1 : 0; $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog'); + $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog.exe') if $^O =~ /win32/i; $self->{'_opts'}->{'autoclear'} = $cfg->{'autoclear'} || 0; $self->{'_opts'}->{'clearbefore'} = $cfg->{'clearbefore'} || 0; $self->{'_opts'}->{'clearafter'} = $cfg->{'clearafter'} || 0; @@ -200,7 +203,8 @@ my $self = $_[0]; my $cmnd = $_[1]; $self->_debug("".$cmnd); - system($cmnd . " 2> /dev/null"); + my $null_dev = $^O =~ /win32/i ? 'NUL:' : '/dev/null'; + system($cmnd . " 2> $null_dev"); return($? >> 8); } sub command_string { @@ -274,7 +278,11 @@ && (length($s_line) <= $self->{'max-scale'}); } } + + my $want_chop; + my $default_pad = $^O !~ /win32/i ? "\n" : ' '; foreach my $line (@array) { + undef $want_chop; my $pad; my $s_line = $self->_strip_text($line); if ($line =~ /\[A\=(\w+)\]/i) { @@ -291,8 +299,13 @@ } } if ($pad) { $text .= (" " x $pad).$line."\n"; } - else { $text .= $line."\n"; } + else { + $text .= "$line$default_pad"; + $want_chop = 1; # only remains set for last line + } } + chop $array[ $#array ] if $want_chop; # small actual change here + return($self->_filter_text($text)); } sub _strip_text {
From: KCK [...] cpan.org
On Sun Feb 17 20:19:13 2008, ronaldxs wrote: Show quoted text
> I have successfully built dialog 1.1, the program that used to be called > Cdialog, under windows Vista and cygwin. The resulting executable, > dialog,exe, works well both through cygwin and independently as a > windows command shell / cmd application under both Vista and Windows XP. > The UI::Dialog module did not run the dialog program successfully with > the UI::Dialog::Backend::CDialog backend but I was able to get it to run > well with some OS independence modifications to > UI::Dialog::Backend::CDialog and one seemingly minor, and plausibly safe > enough, modification to UI::Dialog::Backend. I have tested the results > under Windows Vista, XP, and ubuntu 7.10 successfully. My tests under > Windows were conducted with Activestate Perl 5.10. Patches are attached. > > The dialog source that was used for my build came from the dialog home > page at: http://invisible-island.net/dialog/ > > Best Wishes, > Ronald Schmidt > ronaldxs@software-path.com > > This is a cleaned up version of bug report #33364 which may be removed > when I, or someone else, figures out how. >
OK, this is just astounding! I've wanted UI::Dialog to work in Win32 for *ages* but never got around to making one of the dialog variants work there. Thanks for these patches! I'm not sure when my schedule will permit me to make a new UI::Dialog release but one thing's for certain; this new feature will be included in the next release. (As a note for anyone else reading these... if you're interested in co-maintaining UI::Dialog, send me an email and let's work something out. Being that I have extremely limited time, I rarely will have an opportunity to update UI::Dialog.) -- Kevin C. Krinke <kckrinke@opendoorsoftware.com> Open Door Software Inc.
From: ronaldxs [...] software-path.com
One of the patches, the one for CDialog.pm, did more work than needed. I am attaching a simpler, cleaner and more appropriate version of that patch here.
--- /cygdrive/c/Perl/site/lib/UI/Dialog/Backend/CDialog.pm 2008-02-19 16:25:25.965095000 -0500 +++ UI/Dialog/Backend/CDialog.pm 2008-02-19 17:27:27.850081200 -0500 @@ -18,6 +18,7 @@ ############################################################################### use 5.006; use strict; +use Config; use FileHandle; use Carp; use Cwd qw( abs_path ); @@ -44,12 +45,13 @@ $self->{'_opts'} = {}; #: Dynamic path discovery... + my $path_sep = $Config::Config{path_sep}; my $CFG_PATH = $cfg->{'PATH'}; if ($CFG_PATH) { if (ref($CFG_PATH) eq "ARRAY") { $self->{'PATHS'} = $CFG_PATH; } - elsif ($CFG_PATH =~ m!:!) { $self->{'PATHS'} = [ split(/:/,$CFG_PATH) ]; } + elsif ($CFG_PATH =~ m!$path_sep!) { $self->{'PATHS'} = [ split(/$path_sep/,$CFG_PATH) ]; } elsif (-d $CFG_PATH) { $self->{'PATHS'} = [ $CFG_PATH ]; } - } elsif ($ENV{'PATH'}) { $self->{'PATHS'} = [ split(/:/,$ENV{'PATH'}) ]; } + } elsif ($ENV{'PATH'}) { $self->{'PATHS'} = [ split(/$path_sep/,$ENV{'PATH'}) ]; } else { $self->{'PATHS'} = ''; } $self->{'_opts'}->{'literal'} = $cfg->{'literal'} || 0; @@ -64,6 +66,7 @@ $self->{'_opts'}->{'percentage'} = $cfg->{'percentage'} || 1; $self->{'_opts'}->{'colours'} = ($cfg->{'colours'} || $cfg->{'colors'}) ? 1 : 0; $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog'); + $self->{'_opts'}->{'bin'} ||= $self->_find_bin('dialog.exe') if $^O =~ /win32/i; $self->{'_opts'}->{'autoclear'} = $cfg->{'autoclear'} || 0; $self->{'_opts'}->{'clearbefore'} = $cfg->{'clearbefore'} || 0; $self->{'_opts'}->{'clearafter'} = $cfg->{'clearafter'} || 0; @@ -200,7 +203,8 @@ my $self = $_[0]; my $cmnd = $_[1]; $self->_debug("".$cmnd); - system($cmnd . " 2> /dev/null"); + my $null_dev = $^O =~ /win32/i ? 'NUL:' : '/dev/null'; + system($cmnd . " 2> $null_dev"); return($? >> 8); } sub command_string { @@ -274,6 +278,8 @@ && (length($s_line) <= $self->{'max-scale'}); } } + + my $new_line = $^O =~ /win32/i ? '\n' : "\n"; foreach my $line (@array) { my $pad; my $s_line = $self->_strip_text($line); @@ -290,8 +296,8 @@ # $pad = (($self->{'_opts'}->{'width'}) - length($s_line)); } } - if ($pad) { $text .= (" " x $pad).$line."\n"; } - else { $text .= $line."\n"; } + if ($pad) { $text .= (" " x $pad).$line.$new_line; } + else { $text .= $line . $new_line; } } return($self->_filter_text($text)); }
On Sun Feb 17 20:19:13 2008, ronaldxs wrote: Show quoted text
> I have successfully built dialog 1.1, the program that used to be called > Cdialog, under windows Vista and cygwin. The resulting executable, > dialog,exe, works well both through cygwin and independently as a > windows command shell / cmd application under both Vista and Windows XP. > The UI::Dialog module did not run the dialog program successfully with > the UI::Dialog::Backend::CDialog backend but I was able to get it to run > well with some OS independence modifications to > UI::Dialog::Backend::CDialog and one seemingly minor, and plausibly safe > enough, modification to UI::Dialog::Backend. I have tested the results > under Windows Vista, XP, and ubuntu 7.10 successfully. My tests under > Windows were conducted with Activestate Perl 5.10. Patches are attached.
Ronald, Thanks for submitting these patches! I've looked them over and checked them into CVS (we're hoping to put out a bugfix release reasonably soon). I won't have access to a Windows box for testing until next week; if you're up for doing some testing this weekend, you're welcome to get a checkout of the current 1.x branch with $ cvs -d :pserver:anonymous@ui-dialog.cvs.sourceforge.net/cvsroot/ui-dialog \ co -r ui-dialog-1_0x UI-Dialog Just hit return when prompted for a password. all the best, -Steve -- Steve Huff * hakamadare@users.sourceforge.net
From: ronaldxs [...] software-path.com
On Sat Aug 23 16:53:42 2008, SHUFF wrote: Show quoted text
> > I won't have access to a Windows box for testing until next week; if > you're up for doing some testing this weekend, you're welcome to get a > checkout of the current 1.x branch with > > $ cvs -d > :pserver:anonymous@ui-dialog.cvs.sourceforge.net/cvsroot/ui-dialog \ > co -r ui-dialog-1_0x UI-Dialog >
I tested the version of UI-Dialog that I checked out today and my cdialog tests ran fine. I have attached a file with the tests that I ran and reviewed manually. Best of luck, Ron
use UI::Dialog::Backend::CDialog; my $d = new UI::Dialog::Backend::CDialog ( backtitle => 'Demo', title => 'Default'); $d->msgbox( title => 'Welcome!', text => 'Welcome one and all!'); $d->msgbox( title => 'Welcome!', text => 'Welcome one and all![A=C]'); $d->msgbox( title => 'Welcome!', text => 'Welcome one and all![A=C]', width => 15); my $string = $d->inputbox( text => 'Please enter some text.', entry => 'this is the input field' ); print STDERR "result is $string\n"; my $selection1 = $d->menu( text => 'Select one:', list => [ 'tag1', 'item1', 'tag2', 'item2', 'tag3', 'item3' ] ); print STDERR "result is $selection1\n"; my $selection = $d->radiolist( text => 'Select one:', list => [ 'tag1', [ 'item1', 0 ], 'tag2', [ 'item2', 1 ], 'tag3', [ 'item3', 0 ] ] ); print STDERR "result is $selection\n";
Patch applied to 1.09 -- Kevin C. Krinke <kevin@krinke.ca>