Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

Report information
The Basics
Id: 13807
Status: open
Priority: 0/
Queue: Tk

People
Owner: Nobody in particular
Requestors: perl [...] renee-baecker.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 804.027
Fixed in: (no value)



Subject: Bug in getOpenFile/getSaveFile
I think it's a bug, that getOpenFile needs at least two elements in the array for -filetypes. #!/usr/bin/perl use Tk; my $mw = MainWindow->new(); my $filetypes = [['pdf','.pdf']]; $mw->getOpenFile(-filetypes => $filetypes); MainLoop; produces the following error message: bad file type "ARRAY(0x1a5b338)", should be "typeName {extension ?extensions ... ?} ?{macType ?macTypes ...?}?" at C:/usr/lib/Tk.pm line 320. But the following code works fine: #!/usr/bin/perl use Tk; my $mw = MainWindow->new(); my $filetypes = [['pdf','.pdf'],['pdf','.pdf']]; $mw->getOpenFile(-filetypes => $filetypes); MainLoop; My system: OS: Microsoft Windows XP [Version 5.1.2600] Perl: This is perl, v5.8.6 built for MSWin32-x86-multi-thread (with 3 registered patches, see perl -V for more detail) Copyright 1987-2004, Larry Wall Binary build 811 provided by ActiveState Corp. http://www.ActiveState.com ActiveState is a division of Sophos. Built Dec 13 2004 09:52:01 Tk: C:\>perl -MTk -le "print $Tk::VERSION" 804.027
From: srezic [...] cpan.org
[guest - Wed Jul 20 17:21:26 2005]: Show quoted text
> I think it's a bug, that getOpenFile needs at least two elements in > the > array for -filetypes. > > > #!/usr/bin/perl > > use Tk; > > my $mw = MainWindow->new(); > my $filetypes = [['pdf','.pdf']]; > $mw->getOpenFile(-filetypes => $filetypes); > > MainLoop; > > > produces the following error message: > bad file type "ARRAY(0x1a5b338)", should be "typeName {extension > ?extensions ... > ?} ?{macType ?macTypes ...?}?" at C:/usr/lib/Tk.pm line 320. > > But the following code works fine: > > #!/usr/bin/perl > > use Tk; > > my $mw = MainWindow->new(); > my $filetypes = [['pdf','.pdf'],['pdf','.pdf']]; > $mw->getOpenFile(-filetypes => $filetypes); > > MainLoop; > > > > My system: > > OS: > Microsoft Windows XP [Version 5.1.2600] > > Perl: > This is perl, v5.8.6 built for MSWin32-x86-multi-thread > (with 3 registered patches, see perl -V for more detail) > > Copyright 1987-2004, Larry Wall > > Binary build 811 provided by ActiveState Corp. > http://www.ActiveState.com > ActiveState is a division of Sophos. > Built Dec 13 2004 09:52:01 > > Tk: > C:\>perl -MTk -le "print $Tk::VERSION" > 804.027
This seems to be Windows-only. The code works as expected on FreeBSD with perl5.8.0+Tk800.024 and perl5.8.7+Tk804.027.
From: keanans [...] techie.com
On Sat Oct 22 10:13:45 2005, SREZIC wrote: Show quoted text
> [guest - Wed Jul 20 17:21:26 2005]: >
> > I think it's a bug, that getOpenFile needs at least two elements in > > the > > array for -filetypes. > > > > > > #!/usr/bin/perl > > > > use Tk; > > > > my $mw = MainWindow->new(); > > my $filetypes = [['pdf','.pdf']]; > > $mw->getOpenFile(-filetypes => $filetypes); > > > > MainLoop; > > > > > > produces the following error message: > > bad file type "ARRAY(0x1a5b338)", should be "typeName {extension > > ?extensions ... > > ?} ?{macType ?macTypes ...?}?" at C:/usr/lib/Tk.pm line 320. > > > > But the following code works fine: > > > > #!/usr/bin/perl > > > > use Tk; > > > > my $mw = MainWindow->new(); > > my $filetypes = [['pdf','.pdf'],['pdf','.pdf']]; > > $mw->getOpenFile(-filetypes => $filetypes); > > > > MainLoop; > > > > > > > > My system: > > > > OS: > > Microsoft Windows XP [Version 5.1.2600] > > > > Perl: > > This is perl, v5.8.6 built for MSWin32-x86-multi-thread > > (with 3 registered patches, see perl -V for more detail) > > > > Copyright 1987-2004, Larry Wall > > > > Binary build 811 provided by ActiveState Corp. > > http://www.ActiveState.com > > ActiveState is a division of Sophos. > > Built Dec 13 2004 09:52:01 > > > > Tk: > > C:\>perl -MTk -le "print $Tk::VERSION" > > 804.027
> > This seems to be Windows-only. The code works as expected on FreeBSD > with perl5.8.0+Tk800.024 and perl5.8.7+Tk804.027.
There's an additional/related bug with file types *In Windows* If you specify two arguments to file types it will work the first time, however on one of the successive opens it will simply crash/exit, I've found that if I add an empty array ref [] at the end of the file types list, it will both prevent the above error, as well as this one. my $filetypes = [ ['Text Files', ['.txt', '.prt']], ['All Files', '*', ] ]; $mw->getOpenFile(-filetypes => $filetypes); ## Works first try, but on a successive try crashes my $filetypes = [ ['Text Files', ['.txt', '.prt']], ['All Files', '*', ], [] ]; $mw->getOpenFile(-filetypes => $filetypes); ## No Crash