-----Original Message-----
From: Haimov, Eugene [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 5:22 PM
To: Sarah Killcoyne; [EMAIL PROTECTED]
Subject: RE: Perl Tk problemsSorry, I feel a bit slow to understand this.Anyone else ?Eugene Haimov-----Original Message-----
From: Sarah Killcoyne [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 5:13 PM
To: Haimov, Eugene
Subject: RE: Perl Tk problemsWell that's not all of what's in main so I just put that down to let you know it was in a subroutine called main.I got the original Tk code from a friend and he put sub main() down as where we do the work that isn't in the gui. I have a submit button on the gui that calls sub main() with the arguments that I gathered from the user. If I changed it to just main() can I still do that? So I think I didn't mention that normally that code that makes the system call make a noticible pause while it's working, when I run this from within the gui it doesn't pause at all. The sleep command doesn't seem to help either.-----Original Message-----
From: Haimov, Eugene [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 13, 2003 15:02
To: Killcoyne Sarah; [EMAIL PROTECTED]
Subject: RE: Perl Tk problemsThe line:
sub main()
looks strange to me.
Do you want to call the main here ?
Then it should be
main();
Or, if you mean that your main is defined here,
then it should be:
sub main
{
# ... body of main
}Eugene Haimov
-----Original Message-----
From: Sarah Killcoyne [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 13, 2003 4:55 PM
To: [EMAIL PROTECTED]
Subject: Perl Tk problems
I'm fairly new to Perl and a complete novice at this Tk stuff. However I
have managed to put together a working gui. However, I have a sub main()
that I added to code that was working fine on it's own. This bit of code
has to open and read various directories and run one other program (as a
system call). However, for some reason this isn't working anymore. I've
checked and rechecked. The lcqDtaFile program that I run with a system call
is working. It creates the correct files in the correct place. But when I
then open the dir they are in and read it, it cannot find the files. My
guess was for some reason the code wasn't waiting for the files to finish
being created. I also know that that piece of code CAN read the directory
because if I leave the files there from a previous run it can read them all.
This bit of code works fine outside of my Tk stuff. I've tried it alone, in
it's own sub and in the original form it came from. It all works, except in
the Tk code. Is there something special about Tk and doing dir reads?my $binDir = "..\\bin";
my $lcqDtaFile = "C:\\Xcalibur\\system\\programs\\lcq_dta.exe";
my $tmpDtaDir = "..\\tmpdta";
sub main()
chdir $tmpDtaDir or die "\nCouldn't cd to $tmpDtaDir $!\n";
if (-e $rawFile )
{
print "Running $lcqDtaFile on $rawFile now\n";
#create the files in the $tmpDtaDir
$ExitCode = system ("$lcqDtaFile -Z -G1 -I20 -B400 -T4000 $rawFile");
}
sleep 45; #i don't think this is doing anything#go through all the files in the tmpdta dir and add the ones that have .dta
#to the DtaFiles array
opendir(DIR, $tmpDtaDir) or die "\nCan't open $tmpDtaDir";
while (defined($file = readdir(DIR)))
{
if ($file =~ m/\.dta$/)
{
chomp ($file);
print "Found $file\n";
push @DtaFiles, "$tmpDtaDir" . "\\" . "$file";
}
}
closedir(DIR);
#if there was an error with lcq it does not tell you so we have to check
my $DtaSize = @DtaFiles;
if ($DtaSize <= 0)
{
print "There are no dta files in $tmpDtaDir. Exiting.\n";
exit;
}
else {print "There are $DtaSize dta files\n";}_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Title: Message
Well
the coding i've done, and seen, with Tk required a specific call to
"MainLoop();"
I'm
not sure if someone is reinventing the wheel or not. Unless we see all the
code
we can
only assume.
