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

Hello - Jumping into UI dev. I have perl 5.10. Build 1005 In one of my books, it says to use command
use Tk::Dialogbox
But when i provide that in my script, it puts out the error cant locate tk/dialogbox.pm @inc contains C:\perl\site\lib;c:\perl\lib Did they change something in newer version? I have a old book though 1998 edition. :-) How should i get started?

Replies are listed 'Best First'.
Re: User Interface
by toolic (Bishop) on Sep 14, 2009 at 17:33 UTC
    use Tk::Dialogbox
    Perl is case-sensitive; did you really mean (with an upper-case B?):
    use Tk::DialogBox; ^ |
    If you do not have this module installed on your system, you can download and install it from CPAN: Tk::DialogBox.
      Right :-) In C:\perl\lib\ there is no Tk dir. There is only tkx. I am using activeperl installation 5.10.0 Is this TK standard or I will have to look everytime for updates? from the link you gave me? From the link, it says Tk-804.028_501 Does this work with my version of perl? How can i find that out?

        I think I'm right in saying that Tk was dropped from ActivePerl 5.10.0 but it was present in the 5.8.8 version which can still be downloaded.

        Cheers,

        JohnGG

Re: User Interface
by liverpole (Monsignor) on Sep 14, 2009 at 21:56 UTC
    Hi kingjamesid,

    Try using ppm to install Tk:

    C:\Documents and Settings\myself> ppm install Tk

    If that's successful, you'll get DialogBox for free (but you'll still have to use Tk::DialogBox in your program).

    For example:

    #!/usr/bin/perl -w use strict; use warnings; use Tk; use Tk::DialogBox; my $mw = new MainWindow(); my $a_btn = [ "Of course!", "No way" ]; my $dbox = $mw->DialogBox(-buttons => $a_btn); my $lbl = $dbox->add("Label", -text => "Isn't this a great program?" +); $lbl->pack; $dbox->Show(); # Do something with the answer, etc. ... MainLoop;

    s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/
      I choose ?ppm install Tk ...and I get this error.....
      Downloading ActiveState Package Repository packlist...failed 500 Can't connect t o ppm4.activestate.com:80 (Bad hostname 'ppm4.activestate.com') ppm install failed: Can't find any package that provides Tk
        That sounds a lot like a transient problem on the net.

        But, OTOH, I have no idea what the question mark before your ppm command signifies.

        Regardless, this works for 5.8.8 and ppm 4.0:

        ppm install TK
        Ok. Installed Tk-804.028_501.tar, extracted it. It contains a BUNCH of files. Should this go under C:\perl\*.* or a separate dir for Tk-804.028_501 and put this path in path? Any recommendations? Thanks
Re: User Interface
by Gangabass (Vicar) on Sep 15, 2009 at 02:27 UTC
      Hey Gang- You got me started. Thanks.