Talmash
asked on
perl tk : Undefined subroutine &main::Label
I am teaching myself perl-tk.
here is my "first" run:
#!/usr/bin/perl -w
# use strict;
use Tk; # Slurp the module in.
# -------------------------- ---------- ---------- ---------
# Create a main window
# -------------------------- ---------- ---------- ---------
my $top = MainWindow->new();
$top->title ("Simple");
# -------------------------- ---------- ---------- ---------
# Instantiate widgets and arrange them
# -------------------------- ---------- ---------- ---------
$l = $top-->Label('text' => 'hello', # label properties
'anchor' => 'n', # anchor text to "north"
'relief' => 'groove', # border style
'width' => 10, 'height' => 3); # 10 chars wide, 3 high.
$l->pack(); # Give it a default place within the main window
# -------------------------- ---------- ---------- ---------
# Sit in an infinite loop dispatching incoming events.
# -------------------------- ---------- ---------- ---------
MainLoop();
I am using linux station over unix.
talm> perltk simple.prl
Undefined subroutine &main::Label called at simple.prl line 12.
what is the problem with this struct?
thanks,
tal
I understand that $top is struct from type "MainWindow"
here is my "first" run:
#!/usr/bin/perl -w
# use strict;
use Tk; # Slurp the module in.
# --------------------------
# Create a main window
# --------------------------
my $top = MainWindow->new();
$top->title ("Simple");
# --------------------------
# Instantiate widgets and arrange them
# --------------------------
$l = $top-->Label('text' => 'hello', # label properties
'anchor' => 'n', # anchor text to "north"
'relief' => 'groove', # border style
'width' => 10, 'height' => 3); # 10 chars wide, 3 high.
$l->pack(); # Give it a default place within the main window
# --------------------------
# Sit in an infinite loop dispatching incoming events.
# --------------------------
MainLoop();
I am using linux station over unix.
talm> perltk simple.prl
Undefined subroutine &main::Label called at simple.prl line 12.
what is the problem with this struct?
thanks,
tal
I understand that $top is struct from type "MainWindow"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks.
$l = $top-->
To:
$l = $top->
Also, you should be running under strict.