On Mon, 18 Jul 2005, Michael Graham <[EMAIL PROTECTED]> wrote:
>
>> >> Trying to get CA plus some plugins working under mod_perl.
>> >> CAP-AnyTemplate (v0.07) works fine as part of regular cgi script, but
>> >> when run under mod_perl:
>> >
>> >> $self->template->config(
>> >>     Configs->AT_CONFIG,
>> >> );
>> >
>> >Do you put the call to $self->template->config inside of your
>> >application's setup or cgiapp_init methods?  Or is it outside all
>> >methods?
>> >
>> It is part of cgiapp_init(). Incidentally, AT_CONFIG is inside package
>> Configs, which I did not make clear in my original message (though
>> obvious I hope).
>
>Hmmm.. your error messages indicate the HTML::Template driver is being
>used, so it really does look like $self->template is not getting its
>config data properly (and so it is falling back to the defaults).
>
>Could you try something like the following and verify that
>Configs->AT_CONFIG contains what you think it contains at init time?
>
>    sub cgiapp_init {
>        my $self = shift;
>
>        # ... other init stuff goes here ...
>
>        my $at_config = Configs->AT_CONFIG;
>
>        use Data::Dumper;
>        print STDERR Dumper $at_config;
>
>        $self->template->config(
>            $at_config
>        );
>    }
>
>And then look at the error log.
Now this is potentially very interesting! First invocation of app after
server restart loads template OK, and Data::Dumper(Configs->AT_CONFIG)
says:

$VAR1 = {
          'default_type' => 'TemplateToolkit',
          'TemplateToolkit' => {
                                 'INTERPOLATE' => '1',
                                 'WRAPPER' => 'hilis.tmpl',
                                 'TAG_STYLE' => 'asp'
                               },
          'include_paths' => [
                               '/127.0.0.1/perl/hilis4/templates',
                               '/127.0.0.1/perl/hilis4/templates/HILIS4'
                             ]
        };

But second and subsequent invocations (ie hit browser reload button) get
error message, and Data::Dumper says:

$VAR1 = {
          'TemplateToolkit' => {
                                 'INTERPOLATE' => '1',
                                 'WRAPPER' => 'hilis.tmpl',
                                 'TAG_STYLE' => 'asp'
                               }
        };

ie part of the AT_CONFIG is missing (default_type and include_paths).
That could explain why it is defaulting to HTML::Template and cannot
then find a template file. But what is causing this behaviour?

>I tried duplicating your setup here and it does seem to work for me.
>Here's what I did:
I will try your setup tomorrow when I have a little time, but I don't
recognise your PerlHandler code so maybe I have not set Apache/mod_perl
up correctly? There is no mention of my module in httpd.conf or
perl.conf, I just invoke the application via the browser, and Apache
knows to run applications from the /127.0.0.1/perl/ directory using
'PerlResponseHandler ModPerl::Registry' (mod_perl 1.99). Perhaps this is
the problem?
-- 
Richard Jones
Leeds, UK
mailto:[EMAIL PROTECTED]

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/[email protected]/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to