in reply to Re^2: threaded sub cannot access external module
in thread threaded sub cannot access external module

You have posted some parts, and I still cannot conveniently reproduce your problem. This makes it hard for me to help you. But at least one of my guesses is that you are loading the modules later than you create your threads. Maybe the modules are not available in the other namespaces threads. Try loading the modules before you create your threads.

  • Comment on Re^3: threaded sub cannot access external module

Replies are listed 'Best First'.
Re^4: threaded sub cannot access external module
by mantyBBQ (Initiate) on Apr 19, 2010 at 23:28 UTC

    Corion...even though you didn't have the code needed to test, you did solve my problem...Vielen Dank! I now run a "dynamic" require within each thread...and all is well:

    # we have the artifact here, it's verified so we just need to parse it sub parse_artifact() { my ($format, $file) =@_; my $t_line; my @args = undef; # this thread's scope needs to re-load the file-specific input + module my @temp = split(/::/, $format->{'name'}); my $formatInput = $temp[2] . ".pm"; my $thread_format_dir = Log2t::Common::get_directory(); $thread_format_dir .= '/Log2t/input/'; require $thread_format_dir . '/' . $formatInput;

    I am seeing ~25% speed increases on my test machine already...thanks for your help