#!/usr/bin/env perl
BEGIN {
$ENV
{MOJO_NO_IPV6} =
$ENV
{MOJO_POLL} = 1 }
plugin
'CountryDropDown'
, {
lang
=>
'DE'
};
app->
log
->level(
'debug'
);
get
'/de'
=>
sub
{
my
$self
=
shift
;
my
$country
=
$self
->code2country(
'DE'
);
$self
->render(
text
=>
$country
);
};
get
'/en'
=>
sub
{
my
$self
=
shift
;
my
$country
=
$self
->code2country(
'DE'
,
'en'
);
$self
->render(
text
=>
$country
);
};
get
'/conf'
=>
sub
{
my
$self
=
shift
;
$self
->countrysf_conf( {
lang
=>
'fr'
} );
my
$country
=
$self
->code2country(
'DE'
);
$self
->render(
text
=>
$country
);
};
my
$t
= Test::Mojo->new;
$t
->get_ok(
'/de'
)->status_is(200)->content_is(
'Deutschland'
);
$t
->get_ok(
'/en'
)->status_is(200)->content_is(
'Germany'
);
$t
->get_ok(
'/conf'
)->status_is(200)->content_is(
'Allemagne'
);