blib/lib/Mojolicious/Plugin/Fondation/Controller/Welcome.pm untested

filter: Statementstmt 0.0% 0 / 14 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 4 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 0.0% 0 / 2 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 27 CC 3 SCAR 22.5
CC
3
Cov
0%
index
12.0
BEGIN
2.0
CRAP 9.5
1 package Mojolicious::Plugin::Fondation::Controller::Welcome;
2 $Mojolicious::Plugin::Fondation::Controller::Welcome::VERSION = '0.08';
3 # ABSTRACT: Welcome page controller with language-aware template selection
4  
5 use Mojo::Base 'Mojolicious::Plugin::Fondation::Controller::Base', -signatures;
6  
7 sub index ($self) {
8 $self->render_later;
9 my $c = $self;
10 my $lang = $c->stash('i18n_lang');
11 unless ($lang) {
12 ($lang) = ($c->req->headers->accept_language // '') =~ /^([a-z]{2})/i;
13 $lang //= 'en';
14 }
15  
16 # Only 'en' and 'fr' exist; fall back to 'en' for anything else
17 $lang = 'en' unless $lang eq 'fr';
18  
19 my $has_setup = exists $c->app->fondation->registry->{'Mojolicious::Plugin::Fondation::Setup'};
20  
21 $c->render(
22 template => "welcome_$lang",
23 has_setup => $has_setup,
24 );
25 }
26  
27 1;
28  
29 __END__