line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::ViewBuilder; |
2
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
346233
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
2
|
|
|
|
|
6865
|
|
|
2
|
|
|
|
|
10
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub register { |
7
|
1
|
|
|
1
|
1
|
31
|
my ( $self, $app, $conf ) = @_; |
8
|
1
|
|
|
|
|
1
|
push @{ $app->renderer->classes }, __PACKAGE__; |
|
1
|
|
|
|
|
18
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
$app->helper( |
11
|
|
|
|
|
|
|
add_view => sub { |
12
|
2
|
|
|
2
|
|
1988
|
shift; |
13
|
2
|
|
|
|
|
3
|
push( @{ $app->{views}->{ +shift() } }, shift ); |
|
2
|
|
|
|
|
12
|
|
14
|
|
|
|
|
|
|
} |
15
|
1
|
|
|
|
|
28
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$app->helper( |
18
|
|
|
|
|
|
|
pluggable_view => sub { |
19
|
2
|
|
|
2
|
|
52831
|
my $c=shift; |
20
|
2
|
50
|
|
|
|
7
|
die "No view defined" unless defined $_[0]; |
21
|
2
|
|
|
|
|
3
|
my $output; |
22
|
2
|
|
|
|
|
29
|
$output .= ref $_ eq 'CODE' ? $_->( $c, $app,@_ ) : $app->$_($c,@_) |
23
|
2
|
100
|
|
|
|
4
|
for ( @{ $app->{views}->{ +shift() } } ); |
24
|
2
|
|
|
|
|
4454
|
return $output; |
25
|
|
|
|
|
|
|
} |
26
|
1
|
|
|
|
|
62
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |