line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::ActionRole::Renderer; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
2877835
|
use strict; |
|
2
|
|
|
|
|
16
|
|
|
2
|
|
|
|
|
80
|
|
4
|
2
|
|
|
2
|
|
406
|
use Moose::Role; |
|
2
|
|
|
|
|
602375
|
|
|
2
|
|
|
|
|
22
|
|
5
|
2
|
|
|
2
|
|
17972
|
use namespace::autoclean; |
|
2
|
|
|
|
|
11984
|
|
|
2
|
|
|
|
|
21
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
around execute => sub { |
11
|
|
|
|
|
|
|
my $orig = shift; |
12
|
|
|
|
|
|
|
my $self = shift; |
13
|
|
|
|
|
|
|
my ($controller, $c) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $view = $self->attributes->{View}->[0]; |
16
|
|
|
|
|
|
|
unless ($view) { |
17
|
|
|
|
|
|
|
$view = $c->config->{default_view}; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my $renderer = sprintf "View::%s", $view; |
21
|
|
|
|
|
|
|
$c->log->debug($renderer); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $response = $self->$orig(@_); |
24
|
|
|
|
|
|
|
$c->forward($renderer); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
return $response; |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__END__ |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=encoding utf-8 |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Catalyst::ActionRole::Renderer - Rendering views for Catalyst action |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
package MyApp::Controller::Root; |
42
|
|
|
|
|
|
|
use Moose; |
43
|
|
|
|
|
|
|
use namespace::autoclean; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
BEGIN { extends 'Catalyst::Controller'; } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub lookup :Local :Does(Renderer) :View(TT) { |
48
|
|
|
|
|
|
|
my ( $self, $c ) = @_; |
49
|
|
|
|
|
|
|
$c->stash->{template} = 'helloworld.tt'; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 DESCRIPTION |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Catalyst::ActionRole::Renderer is rendering views for Catalyst action. |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
capable of declaratively rendering views. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=over 2 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item No C<$c.forward> |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item No C<sub end : ActionClass('RenderView') {}> |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=back |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=over 2 |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item L<Catalyst::Controller> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item L<Catalyst::View> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Masaaki Saito E<lt>masakyst.public@gmail.comE<gt> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Copyright 2017- Masaaki Saito |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 LICENSE |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
90
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 SEE ALSO |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=cut |