Stoney2005 has asked for the wisdom of the Perl Monks concerning the following question:
well below is my entire test code. The problem i'm encountering is that it won't return the directory name on win7 ult under activeperl. This is perl 5, version 12, subversion 3 (v5.12.3) built for MSWin32-x64-multi-thread (with 9 registered patches, see perl -V for more detail). Not sure what else I need to include to be helpful. This same code works fine on debian linux under Perl 5.10.1 with 51 patches. i'm surprised that a slightly older version of perl does it better. it could just be the differences between windows and linux
This is the entire error i get#!/usr/bin/env perl use Tk; use Env; use Tk::DirSelect; use diagnostics; #use warnings; $mw = new MainWindow; #Initialize main window my $entry_output_dir = $mw -> Entry(-textvariable=>\$last_directory); +# Directory my $label_output_dir = $mw -> Label(-text=>"Output Directory:"); my $button_choose_output_directory = $mw -> Button(-text => "Choose", +-command =>\&choose_output_directory); # open a directory picker $entry_output_dir -> grid(-row=>1,-column=>2); $label_output_dir -> grid(-row=>1,-column=>1); $button_choose_output_directory -> grid(-row=>1,-column=>3); MainLoop; sub choose_output_directory { use Data::Dumper; $new_directory = ' '; print Dumper( $last_directory, $new_directory); my $ds = $mw->DirSelect(-title => 'Select Directory', -width => 40); my $new_directory = $ds->Show($last_directory); if ($new_directory ne '') {$last_directory = $new_directory} }
Tk::Error: Can't call method "selectionGet" on unblessed reference at +C:/Perl64/ site/lib/Tk/DirSelect.pm line 53. DirSelect::__ANON__ at C:/Perl64/site/lib/Tk/DirSelect.pm line 53 Tk callback for .dirselect.frame2.button Tk::__ANON__ at C:/Perl64/site/lib/Tk.pm line 250 Tk::Button::butUp at C:/Perl64/site/lib/Tk/Button.pm line 175 <ButtonRelease-1> (command bound to event)
|
---|
Back to
Seekers of Perl Wisdom