This is my first time to post to a mailing list and
I'm also a newbie in template-toolkit and mod_perl2.

I'm trying to run a modPerl2 handler that was written in the 
book:practical-mod_perl
Executing from the command prompt using Perl is ok but,when I 
try to run it in ModPerl2, rendering fails and in the error_log it says

[error] access to / failed for 127.1.1.1, reason: file error - test.html: not 
found

SELINUX isn't running , the directory permission is 0755 , and the
file permission is 0664. 
I havn't changed the httpd.conf that much.
wondering why the error message said accessing failed to / instead of test.html 
...

-----------------------httpd.conf
-----------

<VirtualHost *:80>

ServerAdmin me.com
PerlModule mod_perl2
PerlModule Template
PerlRequire /home/userr/Apache2/startup.pl
PerlModule Hello
# Options ExecCGI
<Location />
 SetHandler perl-script
 PerlResponseHandler Hello
</Location>

</VirtualHost>


-------------------------Apache2/startup.pl
#!/usr/local/bin/perl
use strict;
use warnings;
use lib qw(/home/userr/Apache2/lib);

1;

---------------------------Apache2/lib/Hello.pm
package Hello;
use strict;
use warnings;

use Apache2::RequestRec;
use Apache2::RequestIO;
use Apache2::Const -compile => qw (SERVER_ERROR  OK);
use Apache2::Log;

use Template;
use vars qw( $TT );

sub handler : method {
        my ($class , $r) = @_;

        # create or reuse existing Template object
        $TT ||= Template->new({
                INCLUDE_PATH => '/home/userr/Apache2/templates',
        }) || die $Template::Error;
        my $data = {
                uri => $r->uri,
                copyright => '&copy; 2002 Andy Wardley',
                weblinks => [
                {
                        url => 'http://perl.apache.org/',
                        title => 'Apache/mod_perl',
                },
                {
                        url => 'http://tt2.org/',
                        title => 'Template Toolkit',
                },
                ],
                # ...and so on...
        };
        
        $r->content_type('text/html');
        $r->rflush;
        #my $file = $r->uri;
        #$r->print( $file ); #prints /

       $TT->process('test.html', $data, $r) || do {
                $r->log_reason($TT->error( ));
                 return Apache2::Const::SERVER_ERROR;
        };
        

        #$r->print('Hello from Mod_perl');
        return Apache2::Const::OK;
}

1;

-------------------------
I found a similar question in the archive here:
http://www.mail-archive.com/[email protected]/msg10133.html
http://www.mail-archive.com/[email protected]/msg24458.html
and a similar Q&A about selinux here:
http://stackoverflow.com/questions/1416520/why-cant-my-catalyst-application-read-my-template-toolkit-files
but didn't help

_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates

Reply via email to