http://www.perlmonks.org?node_id=380893


in reply to Re^2: Thread::Pool and Template Toolkit
in thread Thread::Pool and Template Toolkit

Threading problems are notoriously difficult and on top of that Perl's implementation is probably still buggy. It's very hard to give you a helpful answer without seeing the code of the script and the template(s).

I think the best thing for you to do is to cut the offending program back to the smallest example that still demonstrates the bug. If the problem isn't clear by then, feel free to post the code here for people to look at. I'm sure the monks will be happy to help you out.

  • Comment on Re^3: Thread::Pool and Template Toolkit

Replies are listed 'Best First'.
Re^4: Thread::Pool and Template Toolkit
by perldragon80 (Sexton) on Aug 07, 2004 at 18:56 UTC
    Ok here a code snippet to demonstrate the issue. If I uncomment Thread::Pool I don't see anything in the web browser, but the logs don't show any error. As soon as I comment it out I see the expected template display:

    CGI code
    #!/usr/bin/perl -w use strict; use CGI; #use Thread::Pool; use Template; my $q = new CGI; print "Content-type: text/html\n\n"; my $file = 'template.html'; my $vars = { message => "Hello World\n" }; my $template = Template->new({ INCLUDE_PATH => $ENV{DOCUMENT_ROOT} . '/t +emplates' }); $template->process($file, $vars) || die "Template process failed: ", $template->error(), "\n";


    template.html:
    <html lang="en"> <head> <title>Template Thread Test</title> </head> <body> This is a test, [% message %] </body> </html>
      Well.. I can reproduce the problem. w/ perl 5.8.5, Thread::Pool v0.32 and TT v2.14

      #!/usr/local/bin/perl -w use strict; use CGI; use Thread::Pool; use Template; my $q = new CGI; print "Content-type: text/html\n\n"; my $file = 'template.html'; my $vars = { message => "Hello World\n" }; my $template = Template->new({ INCLUDE_PATH => './' }); $template->process($file, $vars) || die "Template process failed: ", $template->error(), "\n"; __END__ Content-type: text/html
      No error messages whatsoever.

      Interestingly, replacing the template->process() call with

      $template->process($file, $vars,'output.html')
      gives the error message
      Could not find file for 'output.html' at /usr/local/lib/perl5/site_per +l/5.8.5/load.pm line 209.
      (load.pm is loaded by Thread::Pool).

      Maybe liz knows more.

      May I ask how you installed Thread::Pool?


      Examine what is said, not who speaks.
      "Efficiency is intelligent laziness." -David Dunham
      "Think for yourself!" - Abigail
      "Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon
        CPAN shell from Linux:
        cpan>install Thread::Pool
        It prepended the other necessary modules(Thread::Serialize, Tie, Conveyor, etc..) and downloaded and installed them as well. I did see the Scalars leaked: 1 message as the install was going through its tests, but other than that it looked ok. Do you think I should get the modules individually and install them one at a time?