File Coverage

blib/lib/Catalyst/TraitFor/Controller/RenderView.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package Catalyst::TraitFor::Controller::RenderView;
2 1     1   1358 use MooseX::MethodAttributes::Role;
  0            
  0            
3             use Catalyst::Action::RenderView;
4             use namespace::autoclean;
5              
6             our $VERSION = '0.002';
7             $VERSION = eval $VERSION;
8              
9             sub end :Action {}
10              
11             after 'end' => sub {
12             my ($controller, $ctx) = @_;
13             # Yes, yes - I am evil.
14             no warnings 'redefine';
15             local *next::method = sub { };
16             use warnings 'redefine';
17             bless({}, 'FakeAction')->Catalyst::Action::RenderView::execute($controller, $ctx);
18             };
19              
20             1;
21              
22             =head1 NAME
23              
24             Catalyst::TraitFor::Controller::RenderView - Alternative to Catalyst::Action::RenderView using method modifiers.
25              
26             =head1 SYNOPSIS
27              
28             package MyApp::Controller::Root;
29             use Moose;
30             use namespace::autoclean;
31              
32             BEGIN { extends 'Catalyst::Controller' }
33             with 'Catalyst::TraitFor::Controller::RenderView;
34              
35             =head1 DESCRIPTION
36              
37             This is an experimental alternative to L<Catalyst::Action::RenderView>.
38              
39             =head1 METHODS
40              
41             =head2 end
42              
43             Provided if not present, wrapped to run the same checks
44             as L<Catalyst::Action::RenderView> after end action.
45              
46             =head1 BUGS
47              
48             The code is a B<horrible hack>, as it delegates all the work
49             to L<Catalyst::Action::RenderView>.
50              
51             How end method attributes will compose onto other classes which
52             already have an end method is unknown (they shouldn't..)
53              
54             How renaming the supplied 'end' method will work is untested at
55             the moment.
56              
57             =head1 AUTHOR
58              
59             Tomas Doran (t0m) C<< bobtfish@bobtfish.net >>.
60              
61             =head1 COPYRIGHT & LICENSE
62              
63             Copyright 2009 the above author(s).
64              
65             This sofware is free software, and is licensed under the same terms as perl itself.
66              
67             =cut