Skip Menu |

This queue is for tickets about the Tk CPAN distribution.

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

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

Bug Information
Severity: Normal
Broken in:
  • 804.031
  • 804.033
Fixed in: (no value)



Subject: Tk::chooseDirectory -mustexist causes errors in Ubuntu 14.04
my $selected = $mw->chooseDirectory(-mustexist => 1, -title => 'Title'); On Ubuntu 14.04 running perl 5.18.2, I get the following error: --------------------------------------------------------------- Tk::Error: Can't set -mustexist to `1' for Tk::FBox=HASH(0x2278840): Can't set -mustexist to `1' for Tk::IconList=HASH(0x24f0330): unknown option "-mustexist" at /usr/local/lib/perl/5.18.2/Tk/Configure.pm line 45. at /usr/local/lib/perl/5.18.2/Tk/Derived.pm line 294. at /usr/local/lib/perl/5.18.2/Tk/Derived.pm line 306. Tk callback for .fbox.frame Tk callback for .fbox.frame1 Tk callback for .fbox.frame2 Tk callback for .fbox Tk callback for .fbox.iconlist Tk::Derived::configure at /usr/local/lib/perl/5.18.2/Tk/Derived.pm line 306 Tk::Derived::configure at /usr/local/lib/perl/5.18.2/Tk/Derived.pm line 306 Tk::Widget::new at /usr/local/lib/perl/5.18.2/Tk/Widget.pm line 205 Tk::Widget::__ANON__ at /usr/local/lib/perl/5.18.2/Tk/Widget.pm line 256 Tk::DialogWrapper at /usr/local/lib/perl/5.18.2/Tk.pm line 373 Tk::FDialog at /usr/local/lib/perl/5.18.2/Tk.pm line 404 Tk::__ANON__ at /usr/local/lib/perl/5.18.2/Tk.pm line 272 Tk::chooseDirectory at /usr/local/lib/perl/5.18.2/Tk.pm line 353 main::_browse at examples/snippet.pl line 22 Tk callback for .button Tk::__ANON__ at /usr/local/lib/perl/5.18.2/Tk.pm line 251 Tk::Button::butUp at /usr/local/lib/perl/5.18.2/Tk/Button.pm line 175 <ButtonRelease-1> (command bound to event) Use of uninitialized value in string eq at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 449. XS_Tk__Callback_Call error:Can't use an undefined value as a subroutine reference at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441. Tk::Error: Can't use an undefined value as a subroutine reference at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441. Tk::FBox::__ANON__ at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441 Tk::FBox::Update at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 450 Tk::After::once at /usr/local/lib/perl/5.18.2/Tk/After.pm line 90 [once,[{},after#13,idle,once,[{},Update]]] ("after" script) --------------------------------------------------------------- The Tk::FBox is displayed, but the title is missing, and the "Ok" button causes the following to be generated: --------------------------------------------------------------- Use of uninitialized value in string eq at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 804. Use of uninitialized value $arg in substitution (s///) at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 1037. Use of uninitialized value $arg in split at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 1038. Use of uninitialized value in string eq at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 449. XS_Tk__Callback_Call error:Can't use an undefined value as a subroutine reference at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441. Tk::Error: Can't use an undefined value as a subroutine reference at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441. Tk::FBox::__ANON__ at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441 Tk::FBox::Update at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 450 Tk::After::once at /usr/local/lib/perl/5.18.2/Tk/After.pm line 90 [once,[{},after#17,idle,once,[{},Update]]] ("after" script) ----------------------------------------------- If you leave out the -mustexist option and value, the Tk::FBox works as expected. I have attached a short script that shows the issue.
Subject: tk_chooseDirectory_issue.pl
#!/usr/bin/perl -w ##---------------------------------------------------------------------------- ## :mode=perl:indentSize=2:tabSize=2:noTabs=true: ##---------------------------------------------------------------------------- use strict; use warnings; use Tk; my ($mw, $entry); ##---------------------------------------------------------------------------- ## _browse(): ##---------------------------------------------------------------------------- sub _browse { my $initial_dir = $entry->get; $initial_dir = qq{UNDEF} unless defined($initial_dir); print(qq{_browse(): Initial directory is "$initial_dir"\n}); my $selected = $mw->chooseDirectory( -initialdir => $initial_dir, -title => qq{Select Directory}, -mustexist => 1, ## Does not work in Ubuntu if this option is provided ); if ($selected) { ## Delete current text in Entry widget $entry->delete(0, qq{end}); ## Add selected directory to text in Entry widget $entry->insert(qq{end}, $selected); } } ##---------------------------------------------------------------------------- ## MAIN ##---------------------------------------------------------------------------- $mw = MainWindow->new(-title => qq{Snippet}); $mw->Label(-text => qq{Directory:})->pack(-side => qq{left}); $entry = $mw->Entry(-width => 20,)->pack(-side => qq{left}); $mw->Button(-text => qq{Browse}, -command => \&_browse)->pack(-side => qq{left}); MainLoop; __END__
On 2015-09-29 17:23:35, PDURDEN wrote: Show quoted text
> > > my $selected = $mw->chooseDirectory(-mustexist => 1, -title => > 'Title'); > > On Ubuntu 14.04 running perl 5.18.2, I get the following error: > > --------------------------------------------------------------- > Tk::Error: Can't set -mustexist to `1' for Tk::FBox=HASH(0x2278840): > Can't set -mustexist to `1' for Tk::IconList=HASH(0x24f0330): unknown > option "-mustexist" at /usr/local/lib/perl/5.18.2/Tk/Configure.pm line > 45. > at /usr/local/lib/perl/5.18.2/Tk/Derived.pm line 294. > > > at /usr/local/lib/perl/5.18.2/Tk/Derived.pm line 306. > Tk callback for .fbox.frame > Tk callback for .fbox.frame1 > Tk callback for .fbox.frame2 > Tk callback for .fbox > Tk callback for .fbox.iconlist > Tk::Derived::configure at /usr/local/lib/perl/5.18.2/Tk/Derived.pm > line 306 > Tk::Derived::configure at /usr/local/lib/perl/5.18.2/Tk/Derived.pm > line 306 > Tk::Widget::new at /usr/local/lib/perl/5.18.2/Tk/Widget.pm line 205 > Tk::Widget::__ANON__ at /usr/local/lib/perl/5.18.2/Tk/Widget.pm line > 256 > Tk::DialogWrapper at /usr/local/lib/perl/5.18.2/Tk.pm line 373 > Tk::FDialog at /usr/local/lib/perl/5.18.2/Tk.pm line 404 > Tk::__ANON__ at /usr/local/lib/perl/5.18.2/Tk.pm line 272 > Tk::chooseDirectory at /usr/local/lib/perl/5.18.2/Tk.pm line 353 > main::_browse at examples/snippet.pl line 22 > Tk callback for .button > Tk::__ANON__ at /usr/local/lib/perl/5.18.2/Tk.pm line 251 > Tk::Button::butUp at /usr/local/lib/perl/5.18.2/Tk/Button.pm line 175 > <ButtonRelease-1> > (command bound to event) > Use of uninitialized value in string eq at > /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 449. > XS_Tk__Callback_Call error:Can't use an undefined value as a > subroutine reference at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line > 441. > > Tk::Error: Can't use an undefined value as a subroutine reference at > /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441. > Tk::FBox::__ANON__ at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441 > Tk::FBox::Update at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 450 > Tk::After::once at /usr/local/lib/perl/5.18.2/Tk/After.pm line 90 > [once,[{},after#13,idle,once,[{},Update]]] > ("after" script) > --------------------------------------------------------------- > > > The Tk::FBox is displayed, but the title is missing, and the "Ok" > button causes the following to be generated: > > --------------------------------------------------------------- > Use of uninitialized value in string eq at > /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 804. > Use of uninitialized value $arg in substitution (s///) at > /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 1037. > Use of uninitialized value $arg in split at > /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 1038. > Use of uninitialized value in string eq at > /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 449. > XS_Tk__Callback_Call error:Can't use an undefined value as a > subroutine reference at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line > 441. > > Tk::Error: Can't use an undefined value as a subroutine reference at > /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441. > Tk::FBox::__ANON__ at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 441 > Tk::FBox::Update at /usr/local/lib/perl/5.18.2/Tk/FBox.pm line 450 > Tk::After::once at /usr/local/lib/perl/5.18.2/Tk/After.pm line 90 > [once,[{},after#17,idle,once,[{},Update]]] > ("after" script) > > ----------------------------------------------- > > If you leave out the -mustexist option and value, the Tk::FBox works > as expected. > > I have attached a short script that shows the issue.
Confirmed. -mustexist is only implemented for Windows.