#!perl package MyTest; use Moose; use Tk; has 'mw' => (is => 'rw', isa => 'Any'); has 'some_val' => (is => 'rw', isa => 'Str'); my $var = ''; sub new { my $class = shift; my $self = bless({}, $class); # -- init GUI my $mw = Tk::MainWindow->new(); $self->mw($mw); $mw->Entry( # geht nicht, weil keine Variable: #-textvariable => \$self->some_val, # geht: -textvariable => \$var, )->pack(); $mw->Label( -textvariable => \$var, )->pack(); return $self; } # /new sub run { my $self = shift; $self->mw->MainLoop(); return; } # /run 1; # /MyTest use strict; use warnings; my $app = MyTest->new(); $app->run(); exit(0);