| Catalyst-Contoller-View documentation | Contained in the Catalyst-Contoller-View distribution. |
Catalyst::Controller::View - Catalyst Controller that directly delegates to View
package MyApp::Controller::View;
use strict;
use warnings;
use base 'Catalyst::Controller::View';
A Catalyst Controller that delegates to View class directly, for convienent purpose.
The default action. It sets $c-stash->{template}> to the path given by the
URI unless there is no such file under root directory.
For instance, suppose your MyApp::Controller::View class is a subclass of
Catalyst::Controller::View, when the incoming path is
/view/foo/bar.html, then $c-stash->{template}> has the value
/view/foo/bar.html if the file root/view/foo/bar.html exists.
Liu Kang-min <gugod@gugod.org>
This library is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-Contoller-View documentation | Contained in the Catalyst-Contoller-View distribution. |
package Catalyst::Controller::View; use strict; use warnings; use base 'Catalyst::Controller'; our $VERSION = 0.01;
sub default : Private { my ( $self, $c ) = @_; my $f = $c->path_to('root', @{$c->req->args}); $c->stash->{template} = $f->relative($c->path_to('root')) ."" if -f "$f"; }
1;