David

You could certainly fork off the transfer process which reads the data. You
will then need an open pipe between the parent and child so the child can
pass back the number of bytes read and any other info, so that you can
update the progress bar in the parent. If the user hits 'cancel' then kill
the child pid from the parent - if it still exists.

Something along these lines...:-

pipe(READER,WRITER) or die "Can't open pipe: $!\n";

if (fork == 0) { # child writes to WRITER
  close READER;
  select WRITER; $| = 1;
  #do child stuff here - get data and send progress to WRITER
  close WRITER;
  exit 0;
}

# parent process closes WRITER and reads from READER
close WRITER;
#get data from  <READER> and update progress bar;

This type of code works fine in a finite program but if the GUI is going to
stay open and another transfer may be attempted, then there are probably
other file handle clean-up issues that will need addressing, but at least
you should be going in the right direction.

hth

Andy


----- Original Message -----
From: "David Johnson" <[EMAIL PROTECTED]>
To: "Perl Users" <[EMAIL PROTECTED]>
Sent: Saturday, May 26, 2001 8:17 PM
Subject: need advice


> I've developed a small, configurable file transfer program using
> Net::FTP.  I have one problem that I'm looking for advice on how to
> fix.  In a nutshell, this is the problem: I use Net::FTP's method retr()
> to get a dataconn obj so that I can count up how many bytes I've
> gotten.  Unfortunately, I am using a while loop to read() the data from
> the remote box.  This locks up the window (in which I am displaying
> progress bar, etc; I'm using Win32::GUI).  Is there some way I can fork
> this process off, or at least unlock the window so that the user can
> abort the transfer?  I can't think of any solutions (but this is my
> first time doing windows programming with perl).  Thanks for your input.
>
> david johnson
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>
>


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to