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