[Catalyst-commits] r6688 - in branches: .
templated_conversion/Catalyst-View-MicroMason/lib/Catalyst/View
jrockway at dev.catalyst.perl.org
jrockway at dev.catalyst.perl.org
Sat Aug 18 22:42:01 GMT 2007
Author: jrockway
Date: 2007-08-18 22:42:01 +0100 (Sat, 18 Aug 2007)
New Revision: 6688
Modified:
branches/
branches/templated_conversion/Catalyst-View-MicroMason/lib/Catalyst/View/MicroMason.pm
Log:
r28481 at foo: jon | 2007-08-18 16:06:23 -0500
improve POD (and coverage)
Property changes on: branches
___________________________________________________________________
Name: svk:merge
- d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst-branches:28479
+ d7608cd0-831c-0410-93c0-e5b306c3c028:/local/Catalyst-branches:28481
Modified: branches/templated_conversion/Catalyst-View-MicroMason/lib/Catalyst/View/MicroMason.pm
===================================================================
--- branches/templated_conversion/Catalyst-View-MicroMason/lib/Catalyst/View/MicroMason.pm 2007-08-18 21:23:44 UTC (rev 6687)
+++ branches/templated_conversion/Catalyst-View-MicroMason/lib/Catalyst/View/MicroMason.pm 2007-08-18 21:42:01 UTC (rev 6688)
@@ -5,8 +5,9 @@
use Text::MicroMason;
use Class::C3;
-our $VERSION = '0.04';
+our $VERSION = '0.04_99';
+# template_root is the old way of saying INCLUDE_PATH. don't use it.
__PACKAGE__->mk_accessors(qw(_template Mixins template_root));
=head1 NAME
@@ -15,39 +16,46 @@
=head1 SYNOPSIS
- # use the helper
+Use the helper:
+
script/create.pl view MicroMason MicroMason
+To create a simple View subclass:
+
# lib/MyApp/View/MicroMason.pm
package MyApp::View::MicroMason;
-
use base 'Catalyst::View::MicroMason';
+ 1;
- __PACKAGE__->config(
+And configure it in your app's config:
+
+ MyApp->config->{View::MicroMason} = {
# -Filters : to use |h and |u
# -ExecuteCache : to cache template output
# -CompileCache : to cache the templates
Mixins => [qw( -Filters -CompileCache )],
- template_root => '/path/to/comp_root'
- );
+ INCLUDE_PATH => '/path/to/comp_root'
+ };
+
+In an 'end' action:
- 1;
-
- # In an 'end' action
+ $c->view('MicroMason')->template('foo.mc');
$c->forward('MyApp::View::MicroMason');
+Or perhaps:
+
+ my $output = $c->view('MicroMason')->render('foo.mc');
+
=head1 DESCRIPTION
Want to use a MicroMason component in your views? No problem!
Catalyst::View::MicroMason comes to the rescue.
-=head1 CAVEATS
+=head1 METHODS
-You have to define C<template_root>. If C<template_root> is not directly
-defined within C<config>, the value comes from C<config->{root}>. If you don't
-define it at all, MicroMason is going to use the root of your system.
+=head2 new
-=head1 METHODS
+Create an instance; should be called from C<COMPONENT>, not by you.
=cut
@@ -112,10 +120,9 @@
# Set the URL base, context and name of the app as global Mason vars
# $base, $c and $name
- $self->_template->set_globals(
- '$base' => $self->context->req->base,
- $c_name => $self->context,
- '$name' => $self->context->config->{name},
+ $self->_template->set_globals( '$base' => $self->context->req->base,
+ $c_name => $self->context,
+ '$name' => $self->context->config->{name},
);
delete $stash->{$self->{CATALYST_VAR}};
@@ -133,7 +140,7 @@
=head1 AUTHOR
-Jonas Alves C<jgda at cpan.org>
+Jonas Alves C<< <jgda at cpan.org> >>
=head1 MAINTAINER
More information about the Catalyst-commits
mailing list