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
#!/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} }
This is the entire error i get
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)

In reply to Tk::Error: Can't call method "selectionGet" on unblessed reference at C:/Perl64/ site/lib/Tk/DirSelect.pm line 53. using TK::DirSelect by Stoney2005

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.