Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: how to make LWP calls compatible with forked script

by iburrell (Chaplain)
on Sep 02, 2004 at 16:47 UTC ( [id://387991] : note . print w/replies, xml ) Need Help??


in reply to how to make LWP calls compatible with forked script

First, you aren't using threads, you are using multiple processes.

Second, why don't you create an LWP::UserAgent in each child process. Sharing the object between the processes does not share the data. It may create problems with sharing a socket or similar. Creating the object should be cheap.

Replies are listed 'Best First'.
Re^2: how to make LWP calls compatible with forked script
by piyush.shourie (Beadle) on Sep 03, 2004 at 06:18 UTC
    Hi,

    Firstly, I have already updated the problem description.
    Secondly, I tried creating LWP::UserAgent in each child process, but of no use. Still it crashes the Perl.
    Can you please suggest a way to handle this?

    Thanks in advance

      It might be a bug in ActivePerl. Perl on Windows does some special stuff to provide the Unix API on Windows which does things differently. For example, fork() is emulated with threads, and sockets need to be mapped to WinSock API.

      I know there were some bugs in earlier releases of ActivePerl 5.6. Make sure you have the most recent release. ActivePerl 5.8 is supposed to be better; try that if you can. Finally, what Windows version are you running? The NT-based ones (NT 4, 2000, XP) are more stable than 95, 98, ME.

        Actually I cant change the version of Perl. Got to use the ActivePerl 5.6.

        The platform is Windows 2000. One thing to note is that the same script runs fine on Solaris. Is there a way to rectify the behaviour on Windows platform?