line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::ViewBuilder; |
2
|
|
|
|
|
|
|
our $VERSION = "0.02"; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
385907
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
2
|
|
|
|
|
6808
|
|
|
2
|
|
|
|
|
11
|
|
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
|
|
2024
|
shift; |
13
|
2
|
|
|
|
|
3
|
push( @{ $app->{views}->{ +shift() } }, shift ); |
|
2
|
|
|
|
|
11
|
|
14
|
|
|
|
|
|
|
} |
15
|
1
|
|
|
|
|
27
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$app->helper( |
18
|
|
|
|
|
|
|
pluggable_view => sub { |
19
|
2
|
|
|
2
|
|
51954
|
my $c=shift; |
20
|
2
|
50
|
|
|
|
10
|
die "No view defined" unless defined $_[0]; |
21
|
2
|
|
|
|
|
2
|
my $output; |
22
|
2
|
|
|
|
|
29
|
$output .= ref $_ eq 'CODE' ? $_->( $c, $app ) : $app->$_ |
23
|
2
|
100
|
|
|
|
3
|
for ( @{ $app->{views}->{ +shift() } } ); |
24
|
2
|
|
|
|
|
4435
|
return $output; |
25
|
|
|
|
|
|
|
} |
26
|
1
|
|
|
|
|
63
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |