inductor has asked for the wisdom of the Perl Monks concerning the following question:
When I run script, it quits immediately, not ever printing "Foo." to stdout. If I do '$feed->join', script works, but I don`t want to pause main program until this thread finishes. Is it possible to use IO::Socket within a thread? Thanks in advance, and sorry for terrible English.use threads; use threads::shared; use IO::Socket; my $feed = threads->new (\&getData); sub getData { my $remote = IO::Socket::INET->new("somehost:port") or die "Can`t +open feed\n"; print "Foo.\n"; while ( <$remote> ) { print } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Working with IO::Socket in thread.
by BrowserUk (Patriarch) on Sep 23, 2005 at 12:12 UTC | |
|
Re: Working with IO::Socket in thread.
by pg (Canon) on Sep 23, 2005 at 12:06 UTC | |
|
Re: Working with IO::Socket in thread.
by castaway (Parson) on Sep 23, 2005 at 11:16 UTC | |
|
Re: Working with IO::Socket in thread.
by inductor (Novice) on Sep 26, 2005 at 08:00 UTC |