I have two scripts (let's call them A and B) that use TK. They are not CGI
or anything just normal scripts.  When I call from A:

do "$path/B.pl";

it works ok if neither or only one has TK. However if there is a TK part in
script B AND script A there is a problem. Once it gets to "MainLoop();" in
script B, script A resumes at the next step after the do.  I can only
speculate as why, or how it does this (does MainLoop use an internal
thread?). 

Has anyone else encountered this? My main question is how to get around
this, without using threads.

The program these scripts run through provides a facility to call other
scripts. However, after testing that it works ok, I discovered other
problems with it.... so I was wondering if there was another way around.


I've posted at the bottom the smallest example that would show what I mean. 
First modify A.pl so the path to B.pl is correct
Run A.pl
Press the "go" button.
You'll see another window appear with a "go back" button, but you'll also
see the line appear in the text box the bottom of the first window. I would
have assumed this line would appear only after B.pl was shutdown. (either
with the "go back" button or the "x" in the upper right).

Thanks,
-Wayne

A.pl
---- CUT ----
#!/Perl/bin/perl
use strict;
use Tk;
my $TKmain = MainWindow->new();

$TKmain->Label(-text=>'Test')->pack();
$TKmain->Button(-text=>'Go',-command=>sub{DoIt();})->pack();
my $txt = $TKmain->Text()->pack();

MainLoop();
exit 0;

sub DoIt
{
    do "c:/b.pl";
    $txt->insert('end', "this is the next line\n");
}
---- CUT ----
B.pl
---- CUT ---- 
#!/Perl/bin/perl
use strict;
use Tk;
my $TKmain = MainWindow->new();

$TKmain->Label(-text=>'Test')->pack();
$TKmain->Button(-text=>'Go
back',-command=>sub{$TKmain->destroy();})->pack();

MainLoop();

exit 0 unless caller();
return undef;
---- CUT ---- 
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to