Guillem,

You'll probably find that forking and then using waitpid doesn't do what
you want.  If you're parent process is waiting it won't be able to respond
to user input.  What I think you need to do is disable any user input
controls that might cause problems if they are clicked while you're
downloading, fork, have the child download, the parent return to the  when
the child has finished get it to re-enable the controls, eg

sub download_click {

      # disable controls

      if (fork() ) {
         # empty as parent goes back
         #  to dealing with user  interaction of
         # still enabled controls
      } else {
         # do lwp download
         # renable controls
      }

I haven't tried this but have tried forking earlier, having the child
process do the work and the parent repsond to user input (in my case,
moving the window and minimizing).   This does require communication
between the child and parent.  I've used pipes and it does work most of the
time, although sometimes I get an Dr Watson error when the program is
exited.  I can let you have a copy of a script if you're interested.

Hope that makes sense,

Kev.



|---------+------------------------------------------------>
|         |           [EMAIL PROTECTED]              |
|         |           Sent by:                             |
|         |           [EMAIL PROTECTED]|
|         |           ceforge.net                          |
|         |                                                |
|         |                                                |
|         |           23/03/2002 16:08                     |
|         |                                                |
|---------+------------------------------------------------>
  
>----------------------------------------------------------------------------------------------|
  |                                                                             
                 |
  |       To:       Perl-Win32-GUI-Users@lists.sourceforge.net                  
                 |
  |       cc:                                                                   
                 |
  |       Subject:  [perl-win32-gui-users] Using fork to avoid a frozen window 
while using LWP   |
  
>----------------------------------------------------------------------------------------------|




Can anybody put in this list some example of how to use fork and waitpid
while I am downloading some web pages with LWP. I don't remember how to do
it.

Regards from Catalonia,
Guillem Cunillera i Wefers

_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users




Reply via email to