| 1 | package Mojolicious::Plugin::VHost; | ||||||||||||
| 2 | 1 | ▶ | use Mojo::Base 'Mojolicious::Plugin'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 3 | |||||||||||||
| 4 | 1 | our $VERSION = '0.04'; | |||||||||||
| 5 | |||||||||||||
| 6 | 1 | ▶ | sub register { | ||||||||||
|
Subroutine
register: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 7 | 1 | my ($plugin, $app) = @_; | |||||||||||
| 8 | |||||||||||||
| 9 | 1 | my %defaults = ( | |||||||||||
| 10 | routes => $app->routes->namespaces, | ||||||||||||
| 11 | static => $app->static->paths, | ||||||||||||
| 12 | templates => $app->renderer->paths, | ||||||||||||
| 13 | ); | ||||||||||||
| 14 | |||||||||||||
| 15 | $app->hook( | ||||||||||||
| 16 | 1 | ▶ | before_dispatch => sub { | ||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
| |||||||||||||
| 17 | 1 | my $c = shift; | |||||||||||
| 18 | |||||||||||||
| 19 | 1 | my $host = $c->tx->req->headers->host; | |||||||||||
| 20 | |||||||||||||
| 21 | 1 | ▶ | my $hosts = $c->app->config('VHost') || {}; | ||||||||||
|
Condition50%1/2
$c->app->config('VHost') || {}
MC/DC0%0/1
$c->app->config('VHost') || {}
$c->app->config('VHost')
Truth table50%1/2
A
A= $c->app->config('VHost')
| |||||||||||||
| 22 | 1 | ▶ | my %conf = ( %defaults, %{$hosts->{$host} || {}} ); | ||||||||||
|
Condition50%1/2
$hosts->{$host} || {}
MC/DC0%0/1
$hosts->{$host} || {}
$hosts->{$host}
Truth table50%1/2
A
A= $hosts->{$host}
| |||||||||||||
| 23 | |||||||||||||
| 24 | 1 | my $app = $c->app; | |||||||||||
| 25 | 1 | $app->routes->namespaces($conf{routes}); | |||||||||||
| 26 | 1 | $app->static->paths($conf{static}); | |||||||||||
| 27 | 1 | $app->renderer->paths($conf{templates}); | |||||||||||
| 28 | } | ||||||||||||
| 29 | 1 | ); | |||||||||||
| 30 | } | ||||||||||||
| 31 | |||||||||||||
| 32 | 1 | 1; | |||||||||||
| 33 | __END__ | ||||||||||||