blib/lib/Mojolicious/Plugin/VHost.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond 50.0% 2 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 3 / 3 Podpod 100% 1 / 1 totaltotal 85.1% 23 / 27 CC 3 SCAR 8.0
CC
3
Cov
90%
__ANON__
3.0
register
1.0
BEGIN
1.0
CRAP 2.2
↑ Summary
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') || {}
l!l
10
MC/DC0%0/1
$c->app->config('VHost') || {}
$c->app->config('VHost')
Truth table50%1/2
A
A= $c->app->config('VHost')
Aresult
11
00
22 1 ▶ my %conf = ( %defaults, %{$hosts->{$host} || {}} );
Condition50%1/2
$hosts->{$host} || {}
l!l
01
MC/DC0%0/1
$hosts->{$host} || {}
$hosts->{$host}
Truth table50%1/2
A
A= $hosts->{$host}
Aresult
11
00
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__
↑ Summary