aydar.pl has asked for the wisdom of the Perl Monks concerning the following question:

Code:

#!/usr/bin/env perl use strict; use warnings; use Tkx; use utf8; my $main_window = Tkx::widget->new("."); $main_window->g_wm_title("Authorization"); $main_window->g_wm_resizable( 0, 0 ); my $label_of_telephone_or_email = $$main_window->new_ttk__label(-text +=> "Telephone or email:"); $label_of_telephone_or_email->g_pack; Tkx::MainLoop();

Error:

Can't locate object method "new_ttk__label" via package "."

Replies are listed 'Best First'.
Re: How to add label?
by kcott (Archbishop) on Dec 07, 2015 at 06:58 UTC

    G'day aydar.pl,

    Welcome to the Monastery.

    You're dereferencing $main_window in

    my $label_of_telephone_or_email = $$main_window->new_ttk__label(...

    Just use $main_window directly, i.e. remove the extraneous '$':

    my $label_of_telephone_or_email = $main_window->new_ttk__label(...

    and the GUI runs normally.

    — Ken