Hi all,

I'm trying to create a handler to use on Apache 2 mod_perl server but I keep getting the error:

[Wed Jun 17 14:32:53 2009] [error] access to /Users/adeola/projects/ craftsmen/trunk/html/foo.html failed for 127.0.0.1, reason: file error - : not found

Not sure what I'm doing wrong. I have attached the module. Any help/ hints would be appreciated?

Thanks,
Adeola.

package DCL::TT2Handler;

use strict;
use warnings::register;

use Apache2::Const qw( :common );
use Template qw( :template );
use vars qw( $TT $ROOTDIR );
use Data::Dump qw( pp );

sub handler {
    my $r = shift;

    $ROOTDIR ||= '/Users/adeola/projects/craftsmen/trunk';
    my $config = {
        INCLUDE_PATH => "${ROOTDIR}/lib:${ROOTDIR}/html",
        INTERPOLATE  => 1,
        DEFAULT      => 'default.html',
        # PRE_PROCESS  => 'config.tt',
        # WRAPPER      => 'wrapper.tt',
        OUTPUT       => $r,
    };

    $TT ||= Template->new( $config );

    warn "DEBUGGING: ", pp( $TT );

    my $params = {
        uri => $r->uri,
        cgi => CGI->new,
    };

    ( my $file = $r->path_info ) =~ s[^/][];

    $r->content_type('text/html');
    # $r->send_http_header;

    $TT->process( $file, $params )
      || return fail( $r, SERVER_ERROR, $TT->error() );

    return OK;
}

sub fail {
    my ( $r, $status, $message ) = @_;
    $r->log_reason( $message, $r->filename );
    return $status;
}

1;

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

Reply via email to