| Spoon-Template-Mason documentation | Contained in the Spoon-Template-Mason distribution. |
Spoon::Template::Mason - A Spoon template module that uses Mason
# in your config.yaml file template_class: Spoon::Template::Mason
So you like Spoon/Spork/Kwiki, but you want to use Mason to generate your output. This is the module for you.
Just set "template_class" in your config.yaml file to
Spoon::Template::Mason.
Support questions can be sent to me via email.
Please submit bugs to the CPAN RT system at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=spoon-template-mason or via email at bug-spoon-template-mason@rt.cpan.org.
Dave Rolsky <autarch@urth.org>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
| Spoon-Template-Mason documentation | Contained in the Spoon-Template-Mason distribution. |
package Spoon::Template::Mason; use strict; use warnings; use Spoon 0.23; use Spoon::Template '-base'; use Cwd (); use HTML::Mason::Interp; use vars qw ($VERSION); $VERSION = 0.05; field 'interp' => -init => '$self->_make_interp'; sub render { my $self = shift; my $comp = shift; $comp = "/$comp" unless $comp =~ m{^/}; my $output = ''; $self->interp->out_method(\$output); $self->interp->exec( $comp, $self->all, @_ ); return $output; } #method private make_interp => sub sub _make_interp { my $self = shift; my $params = shift || {}; my $root_name = 'root001'; my $path = $self->path; my @roots = map { [ $root_name++ => Cwd::abs_path($_) ] } ref $path ? @$path : $path; my $interp = HTML::Mason::Interp->new ( comp_root => \@roots, %$params, ); $self->interp($interp); }; 1; __END__