develooper Front page | perl.perl5.porters | Postings from July 2002

Re: Thread::Use - use a module inside a thread only

Thread Previous | Thread Next
From:
Jenda Krynicky
Date:
July 30, 2002 05:55
Subject:
Re: Thread::Use - use a module inside a thread only
Message ID:
3D46A8AB.13903.145DA6EE@localhost
From: Rafael Garcia-Suarez <raphel.garcia-suarez@hexaflux.com>
> Well, "useit Foo" should call import() just like "use Foo" does --
> without any arguments. The parser does some magic to distinguish
> between "use Foo" and "use Foo ()". I think you may provide a
> useit_noimport() subroutine. But in this case a straight require() is
> probably simpler.

The problem with run-time "useit Foo" instead of compile-time "use 
Foo" is that the symbols are not exported while compiling, prototypes 
not "installed", constants not defined, etc. etc. etc.

Would not it be simpler then to require() or do() the whole thread?

	use threads;
	$thread = threads->create(sub {do 'worker_thread.pl';})
	...

Jenda


=========== Jenda@Krynicky.cz == http://Jenda.Krynicky.cz ==========
There is a reason for living. There must be. I've seen it somewhere.
It's just that in the mess on my table ... and in my brain
I can't find it.
					--- me


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About