Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: Thread::Pool and Template Toolkit

by perldragon80 (Sexton)
on Aug 07, 2004 at 06:51 UTC ( [id://380869]=note: print w/replies, xml ) Need Help??

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

Version is v0.32, and I have compiled perl 5.8.5 with threading, just to set your minds at ease.

Ok, so apparently people aren't enthused with vague problem listings, and poor problem descriptions, but I thought this was the monastery....don't people go to places of faith and wisdom with the silliest of questions hoping for an answer that can't possibly be given by someone who isn't as reverant or intelligent as they would have you believe???....Anyway, I digress.

I suppose my situation isn't easily explained or easily understood, but I will try a little better next time, after reading the "how not to get chastised" help faq (for the 2nd time no less, you would think I would learn my lesson) :(...

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

Replies are listed 'Best First'.
Re^3: Thread::Pool and Template Toolkit
by Joost (Canon) on Aug 07, 2004 at 12:31 UTC
    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.

      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";

      <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/ line 209.
        ( 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

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://380869]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-07-12 21:55 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.