Roy Johnson has asked for the wisdom of the Perl Monks concerning the following question:

This little script:
#!perl use warnings; use strict; use Tk; my $main = MainWindow->new; use Tk::FileDialog; my $LoadDialog = $main->FileDialog; MainLoop;
gives me the Subject error on the PC I've moved it to, but not on the one I originally wrote it on. I'm running ActiveState Perl 5.8.8 build 822 (just installed it, since I was having the problem on build 818). I don't know what version the previous machine was running, though it was ActiveState.

I can't make sense of the error message. Ideas, anyone?


Caution: Contents may have been coded under pressure.

Replies are listed 'Best First'.
Re: Tk::FileDialog: can't make ".filedialog" its own master
by liverpole (Monsignor) on Oct 19, 2007 at 21:40 UTC
    Hi Roy Johnson,

    I hadn't heard of this bug before, but it's apparently been discussed.  Here, for example, is a closely-related bug written against ActiveState's bug database.

    While searching google, there was one place where it was recommended that the programmer use Tk::getFileOpen instead.  Would that be a valid alternative, perhaps?


    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
      Your Google-fu is apparently more powerful than mine. Thanks for the link. I didn't find a Tk::getFileOpen, but searching CPAN for getopenfile brought up chooseDirectory, and its file-selecting counterpart, getOpenFile, which appears to be undocumented on CPAN (but it's in chooseDirectory's SEE ALSO, and it works when I try it — and perldoc covers it). These are very fine widgets indeed.

      Caution: Contents may have been coded under pressure.
        Thanks for this one. It's been three years since your posts, but the bug hasn't been fixed. I just came up against it on a Win7 system with ActivePerl 5.10.0.
        GetOpenFile works fine for me, so I'll just use that. Here's the documentation on getOpenFile. It comes with Tk, no install needed.