[Catalyst-commits] r6765 -
trunk/Catalyst-View-Mason/lib/Catalyst/View
rafl at dev.catalyst.perl.org
rafl at dev.catalyst.perl.org
Tue Aug 28 16:59:22 GMT 2007
Author: rafl
Date: 2007-08-28 16:59:22 +0100 (Tue, 28 Aug 2007)
New Revision: 6765
Modified:
trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
Log:
Update POD.
Modified: trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm
===================================================================
--- trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm 2007-08-28 15:59:18 UTC (rev 6764)
+++ trunk/Catalyst-View-Mason/lib/Catalyst/View/Mason.pm 2007-08-28 15:59:22 UTC (rev 6765)
@@ -25,9 +25,7 @@
use base 'Catalyst::View::Mason';
- __PACKAGE__->config->{DEBUG} = 'all';
- __PACKAGE__->config->{comp_root} = '/path/to/comp_root';
- __PACKAGE__->config->{data_dir} = '/path/to/data_dir';
+ __PACKAGE__->config(use_match => 0);
1;
@@ -42,34 +40,31 @@
From the Catalyst controller:
- $c->stash->{name} = 'Homer'; # Pass a scalar
- $c->stash->{extra_info} = {
- last_name => 'Simpson',
- children => [qw(Bart Lisa Maggie)]
- }; # A ref works too
+ $c->stash->{name} = 'Homer'; # Pass a scalar
+ $c->stash->{extra_info} = {
+ last_name => 'Simpson',
+ children => [qw(Bart Lisa Maggie)]
+ }; # A ref works too
From the Mason template:
- <%args>
- $name
- $extra_info
- </%args>
- <p>Your name is <strong><% $name %> <% $extra_info->{last_name} %></strong>
- <p>Your children are:
- <ul>
- % foreach my $child (@{$extra_info->{children}}) {
- <li>$child
- % }
- </ul>
+ <%args>
+ $name
+ $extra_info
+ </%args>
+ <p>Your name is <strong><% $name %> <% $extra_info->{last_name} %></strong>
+ <p>Your children are:
+ <ul>
+ % foreach my $child (@{$extra_info->{children}}) {
+ <li>$child
+ % }
+ </ul>
-=head1 CAVEATS
+=head1 METHODS
-You have to define C<comp_root> and C<data_dir>. If C<comp_root> is not
-directly defined within C<config>, the value comes from
-C<$c-E<gt>config-E<gt>{root}>. If you don't define it at all, Mason is
-going to complain :) The default C<data_dir> is C</tmp>.
+=cut
-=head1 METHODS
+=head2 new
=cut
@@ -101,10 +96,10 @@
return $self;
}
-=head3 process
+=head2 process
Renders the component specified in $c->stash->{template} or $c->request->match
-to $c->response->body.
+or $c->action (depending on the use_match setting) to $c->response->body.
Note that the component name must be absolute, or is converted to absolute
(i.e., a / is added to the beginning if it doesn't start with one).
@@ -143,8 +138,14 @@
return 1;
}
-=head3 render
+=head2 render($c, $component_path, \%args)
+Renders the given template and returns output, or a HTML::Mason::Exception
+object upon error.
+
+The template variables are set to %$args if $args is a hashref, or
+$c-E<gt>stash otherwise.
+
=cut
sub render {
@@ -182,9 +183,35 @@
=head3 config
-This allows your view subclass to pass additional settings to the
-Mason HTML::Mason::Interp->new constructor.
+This allows you to to pass additional settings to the HTML::Mason::Interp
+constructor or to set the options as below:
+=over
+
+=item C<use_match>
+
+Use C<$c-E<gt>request-E<gt>match> instead of C<$c-E<gt>action> to determine
+which template to use if <$c-E<gt>stash-E<gt>{template}> isn't set. This option
+is deprecated and exists for backward compatibility only.
+
+Currently defaults to 1.
+
+=back
+
+The default HTML::Mason::Interp config options are as follows:
+
+=over
+
+=item C<comp_root>
+
+C<$c-E<gt>config-E<gt>root>
+
+=item C<data_dir>
+
+C<File::Spec-E<gt>tmpdir>
+
+=back
+
=cut
=head1 SEE ALSO
@@ -196,6 +223,7 @@
Andres Kievsky C<ank at cpan.org>
Sebastian Riedel C<sri at cpan.org>
Marcus Ramberg
+Florian Ragwitz <rafl at debian.org>
=head1 COPYRIGHT
More information about the Catalyst-commits
mailing list