At 10:32 AM 9/23/02 +0100, Ray Hilton wrote:
>At the time of creating the threads in question, no modules, except
>threads has been loaded, however, modules are loaded after this.  Would
>it be feasible that Perl is trying to clone the modules, even if they
>have not been loaded yet?

If you are using -use- to load the modules, they _will_ have been loaded 
already.  For example:

  use threads;
  my $thread = threads->new( 'doDIBstuff' );

  sub doDBIstuff {
    use DBI parameters;   # executed during compile time
  }

_will_ have loaded DBI when the threads starts.  This is because -use- is 
executed in compilation (BEGIN).  From perldoc -f use:

"It is exactly equivalent to BEGIN { require Module; import Module LIST; }..."

If you really want to load the DBI module inside the thread only, you 
should do:

  sub doDBIstuff {
    required DBI;               # executed during runtime
    DBI->import( parameters );  # executed during runtime
  }



Hope this helps...



Liz

Reply via email to