http://qs321.pair.com?node_id=1168793

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

Below is my code i am getting below error of Tk::Frame::labelPack.pm is missing.

I have installed Tk multiple times and using strawberry perl. Failed to AUTOLOAD 'Tk::Frame::labelPack' at C:\Strawberry\perl\lib\Tk/Tk/Widget.pm line 203.

cpan> install Tk::Frame::labelPack Warning: Cannot install Tk::Frame::labelPack, don't know what it is.

Try the command i /Tk::Frame::labelPack/ to find objects with matching identifiers.

#########################################################################
my $mw = MainWindow->new(); $mw -> geometry("1000x400"); my $book = $mw->NoteBook()->pack(); my $title = $mw -> title("Spec Analysis"); $mw ->BrowseEntry(-label => 'Product', -choices=> \@product_list, -var +iable => \$product_st, -browsecmd =>\&getselect_product, -font => "co +urier 11 bold" ) ->place(-x=>1,-y=>120); $mw ->BrowseEntry(-label => 'Package', -choices=> \@package_list, -var +iable => \$package_st, -browsecmd =>\&getselect_package, -font => "co +urier 11 bold" ) ->place(-x=>275,-y=>120); MainLoop;
thx in advance

Replies are listed 'Best First'.
Re: Tk Failed to AUTOLOAD 'Tk::Frame::labelPack' at C:\Strawberry\perl\lib\Tk/Tk/Widget.pm line 203.
by kcott (Archbishop) on Jul 29, 2016 at 09:08 UTC

    G'day pks283,

    Welcome to the Monastery.

    Firstly, I searched CPAN for Tk::Frame::labelPack: Not Found!

    There's clearly much code you've omitted: 'use strict', 'use warnings', 'sub getselect_product {...}', 'sub getselect_package {...}', not to mention a raft of variable declarations and definitions. Unfortunately, this means we can't give you much in the way of specific or exacting advice.

    Here's a brace of pure guesses:

    • Somewhere in your program, you have code that looks like
      ...labelPack()...
      and should look more like
      ...Label()->pack()...
      or maybe changed to something different, or even removed.
    • Somewhere in your code, you're using a Tk::Frame object to invoke a Tk::Class_With_labelPack_method method.

    If one of those guesses pointed to a solution, that's great; however, if you have follow-up questions, or future questions of a similar nature, please supply a short (20-30 lines) script that we can run and reproduce your problem. You should also provide the input you used to generate your problem, whatever output, or outcome, you recieved (including warning and error messages), whatever output, or outcome, you expected, and any other pertinent information, which often includes such things as: configuration data; environment variable values; log entries; timings; file sizes; and so on. You'll find excellent guidelines for all of this, and more, in "How do I post a question effectively?".

    — Ken

Re: Tk Failed to AUTOLOAD 'Tk::Frame::labelPack' at C:\Strawberry\perl\lib\Tk/Tk/Widget.pm line 203.
by Marshall (Canon) on Jul 29, 2016 at 17:46 UTC
    I use ActiveState 5.22 now. But for grins, I ran your code and it worked with the standard distribution (no extra installations required, the standard Tk was enough albeit with some extra use statements). After adding use strict; and use warnings;, I had to add more stuff to get it to run, but run it does. I suspect that there is something that is not apparent in the code that you posted.
    use warnings; use strict; use Tk; use Tk::NoteBook; use Tk::BrowseEntry; my @product_list = (qw/asdf lijlj/); my @package_list = (qw/opiu qwerty/); my $product_st; my $package_st; my $mw = MainWindow->new(); $mw -> geometry("1000x400"); my $book = $mw->NoteBook()->pack(); my $title = $mw -> title("Spec Analysis"); $mw ->BrowseEntry(-label => 'Product', -choices=> \@product_list, -var +iable => \$product_st, -browsecmd =>\&getselect_product, -font => "co +urier 11 bold" ) ->place(-x=>1,-y=>120); $mw ->BrowseEntry(-label => 'Package', -choices=> \@package_list, -var +iable => \$package_st, -browsecmd =>\&getselect_package, -font => "co +urier 11 bold" ) ->place(-x=>275,-y=>120); MainLoop;
Re: Tk Failed to AUTOLOAD 'Tk::Frame::labelPack' at C:\Strawberry\perl\lib\Tk/Tk/Widget.pm line 203.
by stefbv (Curate) on Jul 31, 2016 at 08:40 UTC
    It looks like there is a problem with the Tk module installation. Search for a "auto\Tk\Frame\labelPack.al" file, not a "labelPack.pm" file.

      Hi,

      Thats a great observation, the error message says lib\Tk/Tk/Widget.pm line 203.

      That is definitely a botched installation of Tk module

Re: Tk Failed to AUTOLOAD 'Tk::Frame::labelPack' at C:\Strawberry\perl\lib\Tk/Tk/Widget.pm line 203.
by beech (Parson) on Jul 29, 2016 at 06:38 UTC

    Hi,

    The code you posted produces no errors after adding use Tk;

    Try again please

      Yes ... but i am still getting error. What perl and Tk rev you are using? I am on Win10, perl 5.24 and Tk33

        :) I'm on windows with Tk 804.033, the perl version is not important

        Yes ... but i am still getting error.

        Did you run the code you posted?

        It doesn't produce the labelPack error

        I misspoke earlier, it does complain  Undefined subroutine &main::getselect_product