Apache2-DirBasedHandler-TT

 view release on metacpan or  search on metacpan

lib/Apache2/DirBasedHandler/TT.pm  view on Meta::CPAN

      my ($r,$uri_args,$args) = @_;
      $$args{'vars'}{'blurb'} = qq[this is \$location/super and all it's contents];

      return $self->process_template(
          $r,
          $$args{'tt'},
          $$args{'vars'},
          qq[blurb.tmpl],
          qq[text/plain; charset=utf-8],
      );
  }

  sub super_dooper_page {
      my $self = shift;
      my ($r,$uri_args,$args) = @_;
      $$args{'vars'}{'blurb'} = qq[this is \$location/super/dooper and all it's contents];

      return $self->process_template(
          $r,
          $$args{'tt'},
          $$args{'vars'},
          qq[blurb.tmpl],
          qq[text/plain; charset=utf-8],
      );
  }

  1;

=head1 DESCRIPTION

Apache2::DirBasedHandler::TT, is an subclass of Apache2::DirBasedHandler with modified
to allow easy use of Template Toolkit templates for content generation.

=head2 init

C<init> calls get_tt to get the template object, and stuffs it into the hash it gets back
from the super class.

=head2 get_tt

C<get_tt> returns a Template Toolkit object, and a hash reference of variables which
will be passed into the TT process call.  You should really override this function with 
to create the Template object appropriate to your environment.

=head2 process_template

C<process_template> is a helper function to generate a page based using the
template object, variables, and template passed in.  It sets the content_type
of the response to the value of the fifth argument.

=head1 DEPENDENCIES

This module requires modperl 2 (http://perl.apache.org), and
libapreq (http://httpd.apache.org/apreq/) which must be installed seperately.
It also depends on Apache2::DirBasedHandler

=head1 INCOMPATIBILITIES

There are no known incompatibilities for this module.

=head1 BUGS AND LIMITATIONS

There are no known bugs in this module.  Please report any problems through

http://rt.cpan.org/Public/Dist/Display.html?Name=Apache2-DirBasedHandler-TT

=head1 AUTHOR

Adam Prime (adam.prime@utoronto.ca)

=head1 LICENSE AND COPYRIGHT

Copyright (c) 2008 by Adam Prime (adam.prime@utoronto.ca).  All rights
reserved.  This program is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.  See L<perlartistic>.

This module is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.



( run in 3.164 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )