| 1 | package Mojolicious::Plugin::ViewBuilder; | ||||||||||
| 2 | 2 | our $VERSION = "0.06"; | |||||||||
| 3 | |||||||||||
| 4 | 2 | ▶ | use Mojo::Base 'Mojolicious::Plugin'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | ▶ | sub register { | ||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 7 | 1 | my ( $self, $app, $conf ) = @_; | |||||||||
| 8 | 1 | push @{ $app->renderer->classes }, __PACKAGE__; | |||||||||
| 9 | |||||||||||
| 10 | $app->helper( | ||||||||||
| 11 | 2 | ▶ | add_view => sub { | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | shift; | |||||||||
| 13 | 2 | push( @{ $app->{views}->{ +shift() } }, shift ); | |||||||||
| 14 | } | ||||||||||
| 15 | 1 | ); | |||||||||
| 16 | |||||||||||
| 17 | $app->helper( | ||||||||||
| 18 | 2 | ▶ | pluggable_view => sub { | ||||||||
|
Subroutine
__ANON__: called CC=4 SCAR=13.9
| |||||||||||
| 19 | 2 | my $c=shift; | |||||||||
| 20 | 2 | ▶ | die "No view defined" unless defined $_[0]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | 2 | my $output; | |||||||||
| 22 | $output .= ref $_ eq 'CODE' ? $_->( $c, $app,@_ ) : $app->$_($c,@_) | ||||||||||
| 23 | 2 | ▶ | for ( @{ $app->{views}->{ +shift() } } ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 2 | return $output; | |||||||||
| 25 | } | ||||||||||
| 26 | 1 | ); | |||||||||
| 27 | |||||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 2 | 1; | |||||||||
| 31 | |||||||||||
| 32 | __END__ | ||||||||||