Thanks for the explanation. Following your answer, I changed my config from:
template => {
package => 'TemplateToolkit',
file => 'search.tt',
to:
template => {
package => 'SWISH::TemplateToolkit',
file => 'search.tt',
and it worked. The old .swishcgi.conf seems to use the earlier configuration. Thanks again.
-----Original Message-----
From: moseley@hank.org [mailto:moseley@hank.org]
Sent: Friday, August 29, 2003 1:57 PM
To: Roubart Capcap
Cc: Multiple recipients of list
Subject: Re: [SWISH-E] Template Toolkit
On Fri, Aug 29, 2003 at 01:23:49PM -0700, Roubart Capcap wrote:
> I noticed this difference between the swish-e-2.2.3-win32.exe and
> swish-e-2.4.0-pr1-2003-8-18.exe while I was trying the 2.4 version to
> work. The TemplateToolkit.pm on the former only has "package
> TemplateToolkit;" while the other has "package
> SWISH::TemplateToolkit;". My config file has "unshift @INC,
> 'C:/Search/modules';" If I run my search.pl I get this error:
>
> Can't locate object method "show_template" via package
> "TemplateToolkit" at C:\Search\search.pl line 756.
>
> Even if I put the modules in C:\Search\modules\SWISH and then even if
> I changed the config to "unshift @INC, 'C:/Search/modules/SWISH';" I
> still get the error.
That won't work. See below.
> The only time I was able to make it work was to
> change the TemplateToolkit.pm to"package TemplateToolkit;". Is this
> the correct way to solve this?
The package at the top of the module must match the "package" setting in
the swish.cgi config file.
template => {
package => 'SWISH::TemplateToolkit',
file => 'search.tt',
options => {
INCLUDE_PATH => '/home/moseley/swish-e/example',
#PRE_PROCESS => 'config',
},
},
So in that case TemplateToolkit.pm should be:
package SWISH::TemplateToolkit;
It doesn't have to be in the SWISH:: namespace, but the package must
match in the config and the top of the module.
Where the file TemplateToolkit is installed doesn't matter as long as
the @INC array is set. If @INC = ('c:\some\path') then the module would
be installed in c:\some\path\SWISH\TemplateToolkit.pm.
You could have:
template => {
package => 'My::Own:Special:Place::TemplateToolkit',
and then it would be in <prefix>\My\Own\Special\Place\Template.pm and
then set
use lib '<prefix>';
where <prefix> is any path you like.
Does that make any sense?
I typically say "use lib" instead of "unshift @INC", but since the
modules are loaded at run time it doesn't really make any difference.
--
Bill Moseley
moseley@hank.org
Received on Fri Aug 29 21:12:45 2003