Hi,
First I apologise if I'm being dense, but this problem is really confusing the heck
out of me...
I've written a photo archive script using CGI::Application (ver. 3.21) and
HTML::Template (ver. 2.6), which ran fine as a standalone CGI script. Now I've ported
it across to using mod_perl, and I'm noticing a really strange intermittent problem.
Basically it seems that sometimes, especially when you request a page for the first
time for a long while, when HTML::Template opens the .tmpl file what it gets is being
somehow corrupted. This evidences itself as an error about not recognising the
TMPL_... tag - I tweaked the error message slightly to print the content of the $which
variable (which should hold the tag being parsed, it seems?) - this comes from line
2230:
HTML::Template->new() : Unknown or unmatched TMPL construct (T0B5
What it *should* be printing is the contents of the $which variable in brackets, but
it seems there are some weird control characters which trash the rest of the string
somehow (at least that's my guess). I haven't put enough trace in to be able to tell
the entire contents of the file that's being read - perhaps this is just trampling the
$which variable rather than the whole file? In case it's useful, the line as I've
amended it is:
die "HTML::Template->new() : Unknown or unmatched TMPL construct ($which
) at $fname : line $fcounter.";
I think what I'm doing should be fairly standard - I'm calling tmpl_path() of
CGI::Application in the cgiapp_prerun() method, and then the tmpl_load() method later
on - it's at this point the error occurs.
Anyway, I realise this isn't necessarily a HTML::Template problem, but I figured it
was a good place to start since presumably some of you have experience of using
HTML::Template with mod_perl, and the potential problems. My best guess is that
somehow running the script on a newly created sub-process is causing the problem, but
I can't for the life of me see how - the fact that the open succeeds, but then we get
garbage later, is what baffles me.
I've tried this with and without caching of templates - caching seemed to make the
problem happen less often, but that might have been my imagination. Also, reloading
the page a few times usually sorts the problem out, which seems vaguely consistent
with the "sub-process opening a file for the first time" problem.
Any help would be greatly appreciated, even if it's simply a more appropriate place to
redirect requests for help! Also any options to any of the code involved to produce
more helpful logs would be really handy - I'm completely new to using mod_perl so I
may well have fallen foul of some common trap!
Cheers,
- Andy
******************Legal Disclaimer**************************
"This email may contain confidential and privileged material for the sole use of the
intended recipient. Any unauthorized review, use or distribution by others is
strictly prohibited. If you have received the message in error, please advise the
sender by reply email @globespanvirata.com, and delete the message. Thank you."
************************************************************
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Html-template-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/html-template-users