Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Tk destroy error

by blackadder (Hermit)
on Sep 10, 2009 at 12:38 UTC ( [id://794560] : perlquestion . print w/replies, xml ) Need Help??

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

Greetings PerlMonks

I have this simple script;
#! c:/perl/bin/perl.exe # # use strict; use warnings 'all'; system (CLS); my $vu_win = MainWindow->new(); $vu_win->configure(-title=>'Verify User', -background=>'blue'); $vu_win->geometry('+100+300'); my $vu_frm1 = $vu_win->Frame(-relief=>'groove', -borderwidth=>3, -back +ground=>'blue',)->pack(-side=>'top', -fill=>'x'); my $vu_lb1 = $vu_frm1->Label(-text=>'Enter Username',-background=>'blu +e',-foreground=>'white',)->pack(-side=>'left'); my $vu_en1 = $vu_frm1->Entry(-textvariable=> \my $usr, -width=>35, -ba +ckground=>'white')->pack(-side=>'left', -pady=>5); my $vu_frm2 = $vu_win->Frame(-relief=>'groove', -borderwidth=>3, -back +ground=>'blue',)->pack(-side=>'top', -fill=>'x'); my $vu_lb2 = $vu_frm2->Label(-text=>'Enter Password',-background=>'blu +e',-foreground=>'white',)->pack(-side=>'left'); my $vu_en2 = $vu_frm2->Entry(-textvariable=> \my $pw, -show=>'*',-widt +h=>35, -background=>'white')->pack(-side=>'left', -pady=>5); $vu_en2->bind('<Return>'=> sub{ &process( $usr, $pw ), $vu_win->destro +y}); sub process { my ($usr_name, $pass_wd) = @_; $vu_win->destroy; print "\n$usr_name, $pass_wd\n"; } MainLoop();
But when I run it I get the following output!
tsx14528, bncfvbncvbncvbncv destroy (1): 0 0x182e30c PVMG f=0008e507 {}(5)(5) SV = PVMG(0x34878e4) at 0x182e30c REFCNT = 5 FLAGS = (PADBUSY,PADMY,GMG,SMG,RMG,ROK) IV = 0 NV = 0 RV = 0x36b1c40 PV = 0x36b1c40 "" CUR = 0 LEN = 0 MAGIC = 0x36c791c MG_VIRTUAL = 0x3b86340 MG_TYPE = PERL_MAGIC_ext(~) MG_FLAGS = 0x02 REFCOUNTED MG_OBJ = 0x36c059c SV = PV(0x367fb94) at 0x36c059c REFCNT = 1 FLAGS = () PV = 0x36c78f4 "" CUR = 0 LEN = 20 C:\Scripts>
Would it be possible for you please:

to advice on the reasons for this output when I expect nothing but two strings ($usr_name, $pass_wd) to be displayed!

Any perls of wisdom would be highly appreciated!

Blackadder

Replies are listed 'Best First'.
Re: Tk destroy error
by Anonymous Monk on Sep 10, 2009 at 12:59 UTC
    Can't locate object method "new" via package "MainWindow" (perhaps you forgot to load "MainWindow"?)

    You're calling destroy twice

    perl -MTk -e " $a= tkinit; $a->destroy; warn $a; warn $a->destroy; " MainWindow=HASH(0x2bcb488) at -e line 1. destroy (1): 0 0x226260 PVMG f=00080007 {}(1)(1) SV = PVMG(0x1a6dccc) at 0x226260 REFCNT = 1 FLAGS = (ROK) IV = 0 NV = 0 RV = 0x2bcb488 PV = 0x2bcb488 "" CUR = 0 LEN = 0 Usage $widget->destroy(...) at -e line 1.
      Thank you

      Its been one of those days! Again!

      Regards
      Blackadder