blib/lib/Dancer/Config.pm

filter: Statementstmt 98.2% 164 / 167 Branchbran 84.7% 39 / 46 Conditioncond 44.1% 38 / 86 MC/DCmcdc 2.5% 1 / 40 Subroutinesub 97.3% 37 / 38 Podpod 0.0% 0 / 11 totaltotal 71.9% 279 / 388 CC 59 SCAR 35.4
CC
59
Cov
81%
load_default_settings
114.7
load
8.0
__ANON__
6.0
CRAP 34.5
↑ Summary blib/lib/Dancer/Template/TemplateToolkit.pm »
1 package Dancer::Config;
2 232 our $AUTHORITY = 'cpan:SUKRIA';
3 #ABSTRACT: how to configure Dancer to suit your needs
4 232 $Dancer::Config::VERSION = '1.3513';
5 232 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 232 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 232 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 232 ▶use vars '@EXPORT_OK';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 232 ▶use Hash::Merge::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 232 ▶use Dancer::Config::Object 'hashref_to_object';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 232 ▶use Dancer::Deprecation;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 232 ▶use Dancer::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 232 ▶use Dancer::ModuleLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 232 ▶use Dancer::FileUtils 'path';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 232 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 232 ▶use Dancer::Exception qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 232 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 232 @EXPORT_OK = qw(setting);
22  
23 232 my $SETTINGS = {};
24  
25 # mergeable settings
26 232 my %MERGEABLE = map { ($_ => 1) } qw( plugins handlers );
27 232 my %_LOADED;
28  
29 631 ▶sub settings {$SETTINGS}
Subroutine settings: called CC=1 SCAR=0.0
Pod undocumented
30  
31 my $setters = {
32 logger => sub {
33 102 ▶ my ($setting, $value) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
34 102 require Dancer::Logger;
35 102 Dancer::Logger->init($value, settings());
36 },
37 log_file => sub {
38 2 ▶ require Dancer::Logger;
Subroutine __ANON__: called CC=1 SCAR=0.0
39 2 Dancer::Logger->init(setting("logger"), settings());
40 },
41 session => sub {
42 95 ▶ my ($setting, $value) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
43 95 require Dancer::Session;
44 95 Dancer::Session->init($value, settings());
45 },
46 template => sub {
47 244 ▶ my ($setting, $value) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
48 244 require Dancer::Template;
49 244 Dancer::Template->init($value, settings());
50 },
51 route_cache => sub {
52 2 ▶ my ($setting, $value) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
53 2 require Dancer::Route::Cache;
54 2 Dancer::Route::Cache->reset();
55 },
56 serializer => sub {
57 21 ▶ my ($setting, $value) = @_;
Subroutine __ANON__: called CC=1 SCAR=0.0
58 21 require Dancer::Serializer;
59 21 Dancer::Serializer->init($value);
60 },
61 # This setting has been deprecated in favor of global_warnings.
62 import_warnings => sub {
63 0 ▶ my ($setting, $value) = @_;
Subroutine __ANON__: not called CC=2 SCAR=17.9
64  
65 0 Dancer::Deprecation->deprecated(
66 message => "import_warnings has been deprecated, please use global_warnings instead."
67 );
68  
69 0 ▶ $^W = $value ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$value ? : 0 0 0
70 },
71 global_warnings => sub {
72 3 ▶ my ($setting, $value) = @_;
Subroutine __ANON__: called CC=2 SCAR=6.9
73 3 ▶ $^W = $value ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$value ? : 2 1 3
74 },
75 traces => sub {
76 10 ▶ my ($setting, $traces) = @_;
Subroutine __ANON__: called CC=2 SCAR=6.9
77 10 ▶ $Dancer::Exception::Verbose = $traces ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$traces ? : 1 9 10
78 },
79 232 };
80 232 $setters->{log_path} = $setters->{log_file};
81  
82 my $normalizers = {
83 charset => sub {
84 6 ▶ my ($setting, $charset) = @_;
Subroutine __ANON__: called CC=5 SCAR=16.5
85 6 ▶ length($charset || '')
Branch: 1 branch
BranchTrueFalseTotal
length($charset || "") or return $charset 0 6 6
Condition50%1/2
$charset || ''
l!l
60
MC/DC0%0/1
$charset || ''
$charset
Truth table50%1/2
A
A= $charset
Aresult
11
00
86 or return $charset;
87 6 my $encoding = Encode::find_encoding($charset);
88 6 ▶ defined $encoding
Branch: 1 branch
BranchTrueFalseTotal
defined $encoding or &raise("core_config", "Charset defined in configuration is wrong : couldn't identify '${charset}'") 0 6 6
89 or raise core_config => "Charset defined in configuration is wrong : couldn't identify '$charset'";
90 6 my $name = $encoding->name;
91 # Perl makes a distinction between the usual perl utf8, and the strict
92 # utf8 charset. But we don't want to make this distinction
93 6 ▶ $name eq 'utf-8-strict'
Branch: 1 branch
BranchTrueFalseTotal
$name eq "utf-8-strict" and $name = "utf-8" 3 3 6
94 and $name = 'utf-8';
95 6 return $name;
96 },
97 232 };
98  
99 sub normalize_setting {
100 1977 ▶ my ($class, $setting, $value) = @_;
Subroutine normalize_setting: called CC=2 SCAR=6.9
Pod undocumented
101  
102 $value = $normalizers->{$setting}->($setting, $value)
103 1977 ▶ if exists $normalizers->{$setting};
Branch: 1 branch
BranchTrueFalseTotal
if exists $normalizers->{$setting} 6 1971 1977
104  
105 1977 return $value;
106 }
107  
108 # public accessor for get/set
109 sub setting {
110 13899 ▶ if (@_ == 1) {
Subroutine setting: called CC=4 SCAR=13.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) { } 12010 1889 13899
111 12010 return _get_setting(shift @_);
112 }
113 else {
114 # can be useful for debug! Use Logger, instead?
115 1889 ▶ die "Odd number in 'set' assignment" unless scalar @_ % 2 == 0;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @_ % 2 == 0 0 1889 1889
116  
117 1889 my $count = 0;
118 1889 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1907 1884 3791
119 1907 my $setting = shift;
120 1907 my $value = shift;
121  
122 1907 _set_setting ($setting, $value);
123  
124 # At the moment, with any kind of hierarchical setter,
125 # there is no case where the same trigger will be run more
126 # than once. If/when a hierarchical setter is implemented,
127 # we should create a list of the hooks that should be run,
128 # and run them at the end of this while, only (efficiency
129 # purposes).
130 1907 _trigger_hooks($setting, $value);
131 1902 $count++
132 }
133 1884 return $count; # just to return anything, the number of items set.
134 }
135 }
136  
137 sub _trigger_hooks {
138 1909 ▶ my ($setting, $value) = @_;
Subroutine _trigger_hooks: called CC=2 SCAR=6.9
139  
140 1909 ▶ $setters->{$setting}->(@_) if defined $setters->{$setting};
Branch: 1 branch
BranchTrueFalseTotal
if defined $setters->{$setting} 451 1458 1909
141 }
142  
143 sub _set_setting {
144 1908 ▶ my ($setting, $value) = @_;
Subroutine _set_setting: called CC=2 SCAR=7.0
145  
146 1908 ▶ return unless @_ == 2;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 1908 1908
147  
148 # normalize the value if needed
149 1908 $value = Dancer::Config->normalize_setting($setting, $value);
150 1908 $SETTINGS->{$setting} = $value;
151 1908 return $value;
152 }
153  
154 sub _get_setting {
155 12011 ▶ my $setting = shift;
Subroutine _get_setting: called CC=1 SCAR=0.0
156  
157 12011 return $SETTINGS->{$setting};
158 }
159  
160 222 ▶sub conffile { path(setting('confdir') || setting('appdir'), 'config.yml') }
Subroutine conffile: called CC=2 SCAR=7.2
Pod undocumented
Condition66%2/3
setting('confdir') || setting('appdir')
l!l&&r!l&&!r
21930
MC/DC0%0/2
setting('confdir') || setting('appdir')
setting('confdir') setting('appdir')
Truth table66%2/3
A || B
A= setting('confdir')B= setting('appdir')
ABresult
1X1
011
000
161  
162 sub environment_file {
163 17 ▶ my $env = setting('environment');
Subroutine environment_file: called CC=2 SCAR=7.0
Pod undocumented
164 # XXX for compatibility reason, we duplicate the code from `init_envdir` here
165 # we don't know how if some application don't already do some weird stuff like
166 # the test in `t/15_plugins/02_config.t`.
167 17 ▶ my $envdir = setting('envdir') || path(setting('appdir'), 'environments');
Condition66%2/3
setting('envdir') || path(setting('appdir'), 'environments')
l!l&&r!l&&!r
1610
MC/DC0%0/2
setting('envdir') || path(setting('appdir'), 'environments')
setting('envdir') path(setting('appdir'), 'environments')
Truth table66%2/3
A || B
A= setting('envdir')B= path(setting('appdir'), 'environments')
ABresult
1X1
011
000
168 17 return path($envdir, "$env.yml");
169 }
170  
171 sub init_confdir {
172 198 ▶ return setting('confdir') if setting('confdir');
Subroutine init_confdir: called CC=3 SCAR=11.1
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if setting("confdir") 194 4 198
173 4 ▶ setting confdir => $ENV{DANCER_CONFDIR} || setting('appdir');
Condition66%2/3
$ENV{'DANCER_CONFDIR'} || setting('appdir')
l!l&&r!l&&!r
031
MC/DC50%1/2
$ENV{'DANCER_CONFDIR'} || setting('appdir')
$ENV{'DANCER_CONFDIR'} setting('appdir')
Truth table66%2/3
A || B
A= $ENV{'DANCER_CONFDIR'}B= setting('appdir')
ABresult
1X1
011
000
174 }
175  
176 sub init_envdir {
177 198 ▶ return setting('envdir') if setting('envdir');
Subroutine init_envdir: called CC=4 SCAR=14.2
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if setting("envdir") 71 127 198
178 127 ▶ my $appdirpath = defined setting('appdir') ?
Branch: 1 branch
BranchTrueFalseTotal
defined setting('appdir') ? : 126 1 127
179 path( setting('appdir'), 'environments' ) :
180 path('environments');
181  
182 127 ▶ setting envdir => $ENV{DANCER_ENVDIR} || $appdirpath;
Condition33%1/3
$ENV{'DANCER_ENVDIR'} || $appdirpath
l!l&&r!l&&!r
01270
MC/DC0%0/2
$ENV{'DANCER_ENVDIR'} || $appdirpath
$ENV{'DANCER_ENVDIR'} $appdirpath
Truth table33%1/3
A || B
A= $ENV{'DANCER_ENVDIR'}B= $appdirpath
ABresult
1X1
011
000
183 }
184  
185 sub load {
186 198 ▶ init_confdir();
Subroutine load: called CC=8 SCAR=20.8
Pod undocumented
187 198 init_envdir();
188  
189 # look for the conffile
190 198 ▶ return 1 unless -f conffile;
Branch: 1 branch
BranchTrueFalseTotal
unless -f conffile() 187 11 198
191  
192 # load YAML
193 11 my $module = load_yaml_module();
194  
195 10 ▶ unless ($_LOADED{conffile()}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_LOADED{conffile()}) 5 5 10
196 5 load_settings_from_yaml(conffile, $module);
197 5 $_LOADED{conffile()}++;
198 }
199  
200 10 my $env = environment_file;
201  
202 # don't load the same env twice
203 10 ▶ unless( $_LOADED{$env} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_LOADED{$env}) 10 0 10
204 10 ▶ if (-f $env ) {
Branch: 2 branches
BranchTrueFalseTotal
if (-f $env) { } 4 6 10
elsif (setting('require_environment')) { } 1 5 6
205 4 load_settings_from_yaml($env, $module);
206 4 $_LOADED{$env}++;
207 }
208 elsif (setting('require_environment')) {
209 # failed to load the env file, and the main config said we needed it.
210 1 confess "Could not load environment file '$env', and require_environment is set";
211 }
212 }
213  
214 9 foreach my $key (grep { $setters->{$_} } keys %$SETTINGS) {
215 28 $setters->{$key}->($key, $SETTINGS->{$key});
216 }
217 9 ▶ if ( $SETTINGS->{strict_config} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($SETTINGS->{"strict_config"}) 2 7 9
218 2 $SETTINGS = hashref_to_object($SETTINGS);
219 }
220  
221 9 return 1;
222 }
223  
224 sub load_settings_from_yaml {
225 14 ▶ my ($file, $module) = @_;
Subroutine load_settings_from_yaml: called CC=3 SCAR=11.0
Pod undocumented
226  
227 14 ▶ $module ||= load_yaml_module();
Condition66%2/3
$module ||= load_yaml_module()
l!l&&r!l&&!r
1310
MC/DC0%0/2
$module ||= load_yaml_module()
$module load_yaml_module()
Truth table66%2/3
A ||= B
A= $moduleB= load_yaml_module()
ABresult
1X1
011
000
228  
229 14 my $config;
230 {
231 232 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
232 14 ▶ $config = eval { &{ $module . '::LoadFile' }($file) }
Branch: 1 branch
BranchTrueFalseTotal
$config = eval { do { &{$module . '::LoadFile';}($file) } } or confess("Unable to parse the configuration file: ${file}: $@") 5 9 14
233 or confess "Unable to parse the configuration file: $file: $@";
234 }
235  
236 $SETTINGS = Hash::Merge::Simple::merge( $SETTINGS, {
237 map {
238 9 $_ => Dancer::Config->normalize_setting( $_, $config->{$_} )
239 } keys %$config
240 } );
241  
242 9 return scalar keys %$config;
243 }
244  
245 sub load_yaml_module {
246 12 ▶ my ($module) = @_;
Subroutine load_yaml_module: called CC=4 SCAR=14.0
Pod undocumented
247  
248 12 ▶ $module ||= $SETTINGS->{engines}{YAML}{module} || 'YAML';
Condition60%3/5
$module ||= $SETTINGS->{"engines"}{"YAML"}{"module"} || "YAML"
l!l&&r!l&&!r
0120
$SETTINGS->{'engines'}{'YAML'}{'module'} || 'YAML'
l!l
93
MC/DC0%0/2
$module ||= $SETTINGS->{"engines"}{"YAML"}{"module"} || "YAML"
$module $SETTINGS->{'engines'}{'YAML'}{'module'}
Truth table33%1/3
A ||= B
A= $moduleB= $SETTINGS->{'engines'}{'YAML'}{'module'}
ABresult
1X1
011
000
249  
250 12 my ( $result, $error ) = Dancer::ModuleLoader->load($module);
251 12 ▶ confess "Could not load $module: $error"
Branch: 1 branch
BranchTrueFalseTotal
unless $result 1 11 12
252 unless $result;
253  
254 11 return $module;
255 }
256  
257 sub load_default_settings {
258 232 ▶ $SETTINGS->{server} ||= $ENV{DANCER_SERVER} || '0.0.0.0';
Subroutine load_default_settings: called CC=27 SCAR=47.4
Pod undocumented
Condition40%2/5
$SETTINGS->{"server"} ||= $ENV{"DANCER_SERVER"} || "0.0.0.0"
l!l&&r!l&&!r
02320
$ENV{'DANCER_SERVER'} || '0.0.0.0'
l!l
0232
MC/DC0%0/2
$SETTINGS->{"server"} ||= $ENV{"DANCER_SERVER"} || "0.0.0.0"
$SETTINGS->{"server"} $ENV{'DANCER_SERVER'}
Truth table0%0/3
A ||= B
A= $SETTINGS->{"server"}B= $ENV{'DANCER_SERVER'}
ABresult
1X1
011
000
259 232 ▶ $SETTINGS->{port} ||= $ENV{DANCER_PORT} || '3000';
Condition40%2/5
$SETTINGS->{"port"} ||= $ENV{"DANCER_PORT"} || 3000
l!l&&r!l&&!r
02320
$ENV{'DANCER_PORT'} || '3000'
l!l
0232
MC/DC0%0/2
$SETTINGS->{"port"} ||= $ENV{"DANCER_PORT"} || 3000
$SETTINGS->{"port"} $ENV{'DANCER_PORT'}
Truth table0%0/3
A ||= B
A= $SETTINGS->{"port"}B= $ENV{'DANCER_PORT'}
ABresult
1X1
011
000
260 232 ▶ $SETTINGS->{content_type} ||= $ENV{DANCER_CONTENT_TYPE} || 'text/html';
Condition40%2/5
$SETTINGS->{"content_type"} ||= $ENV{"DANCER_CONTENT_TYPE"} || "text/html"
l!l&&r!l&&!r
02320
$ENV{'DANCER_CONTENT_TYPE'} || 'text/html'
l!l
0232
MC/DC0%0/2
$SETTINGS->{"content_type"} ||= $ENV{"DANCER_CONTENT_TYPE"} || "text/html"
$SETTINGS->{"content_type"} $ENV{'DANCER_CONTENT_TYPE'}
Truth table0%0/3
A ||= B
A= $SETTINGS->{"content_type"}B= $ENV{'DANCER_CONTENT_TYPE'}
ABresult
1X1
011
000
261 232 ▶ $SETTINGS->{charset} ||= $ENV{DANCER_CHARSET} || '';
Condition40%2/5
$SETTINGS->{"charset"} ||= $ENV{"DANCER_CHARSET"} || ""
l!l&&r!l&&!r
00232
$ENV{'DANCER_CHARSET'} || ''
l!l
0232
MC/DC0%0/2
$SETTINGS->{"charset"} ||= $ENV{"DANCER_CHARSET"} || ""
$SETTINGS->{"charset"} $ENV{'DANCER_CHARSET'}
Truth table33%1/3
A ||= B
A= $SETTINGS->{"charset"}B= $ENV{'DANCER_CHARSET'}
ABresult
1X1
011
000
262 232 ▶ $SETTINGS->{startup_info} ||= !$ENV{DANCER_NO_STARTUP_INFO};
Condition33%1/3
$SETTINGS->{"startup_info"} ||= !$ENV{"DANCER_NO_STARTUP_INFO"}
l!l&&r!l&&!r
02320
MC/DC0%0/2
$SETTINGS->{"startup_info"} ||= !$ENV{"DANCER_NO_STARTUP_INFO"}
$SETTINGS->{"startup_info"} !$ENV{"DANCER_NO_STARTUP_INFO"}
Truth table33%1/3
A ||= not(B)
A= $SETTINGS->{"startup_info"}B= !$ENV{"DANCER_NO_STARTUP_INFO"}
ABresult
1X1
011
000
263 232 ▶ $SETTINGS->{daemon} ||= $ENV{DANCER_DAEMON} || 0;
Condition40%2/5
$SETTINGS->{"daemon"} ||= $ENV{"DANCER_DAEMON"} || 0
l!l&&r!l&&!r
00232
$ENV{'DANCER_DAEMON'} || 0
l!l
0232
MC/DC0%0/2
$SETTINGS->{"daemon"} ||= $ENV{"DANCER_DAEMON"} || 0
$SETTINGS->{"daemon"} $ENV{'DANCER_DAEMON'}
Truth table33%1/3
A ||= B
A= $SETTINGS->{"daemon"}B= $ENV{'DANCER_DAEMON'}
ABresult
1X1
011
000
264 232 ▶ $SETTINGS->{apphandler} ||= $ENV{DANCER_APPHANDLER} || 'Standalone';
Condition40%2/5
$SETTINGS->{"apphandler"} ||= $ENV{"DANCER_APPHANDLER"} || "Standalone"
l!l&&r!l&&!r
02320
$ENV{'DANCER_APPHANDLER'} || 'Standalone'
l!l
0232
MC/DC0%0/2
$SETTINGS->{"apphandler"} ||= $ENV{"DANCER_APPHANDLER"} || "Standalone"
$SETTINGS->{"apphandler"} $ENV{'DANCER_APPHANDLER'}
Truth table0%0/3
A ||= B
A= $SETTINGS->{"apphandler"}B= $ENV{'DANCER_APPHANDLER'}
ABresult
1X1
011
000
265 232 ▶ $SETTINGS->{warnings} ||= $ENV{DANCER_WARNINGS} || 0;
Condition40%2/5
$SETTINGS->{"warnings"} ||= $ENV{"DANCER_WARNINGS"} || 0
l!l&&r!l&&!r
00232
$ENV{'DANCER_WARNINGS'} || 0
l!l
0232
MC/DC0%0/2
$SETTINGS->{"warnings"} ||= $ENV{"DANCER_WARNINGS"} || 0
$SETTINGS->{"warnings"} $ENV{'DANCER_WARNINGS'}
Truth table33%1/3
A ||= B
A= $SETTINGS->{"warnings"}B= $ENV{'DANCER_WARNINGS'}
ABresult
1X1
011
000
266 232 ▶ $SETTINGS->{auto_reload} ||= $ENV{DANCER_AUTO_RELOAD} || 0;
Condition40%2/5
$SETTINGS->{"auto_reload"} ||= $ENV{"DANCER_AUTO_RELOAD"} || 0
l!l&&r!l&&!r
00232
$ENV{'DANCER_AUTO_RELOAD'} || 0
l!l
0232
MC/DC0%0/2
$SETTINGS->{"auto_reload"} ||= $ENV{"DANCER_AUTO_RELOAD"} || 0
$SETTINGS->{"auto_reload"} $ENV{'DANCER_AUTO_RELOAD'}
Truth table33%1/3
A ||= B
A= $SETTINGS->{"auto_reload"}B= $ENV{'DANCER_AUTO_RELOAD'}
ABresult
1X1
011
000
267 232 ▶ $SETTINGS->{traces} ||= $ENV{DANCER_TRACES} || 0;
Condition40%2/5
$SETTINGS->{"traces"} ||= $ENV{"DANCER_TRACES"} || 0
l!l&&r!l&&!r
00232
$ENV{'DANCER_TRACES'} || 0
l!l
0232
MC/DC0%0/2
$SETTINGS->{"traces"} ||= $ENV{"DANCER_TRACES"} || 0
$SETTINGS->{"traces"} $ENV{'DANCER_TRACES'}
Truth table33%1/3
A ||= B
A= $SETTINGS->{"traces"}B= $ENV{'DANCER_TRACES'}
ABresult
1X1
011
000
268 232 ▶ $SETTINGS->{server_tokens} ||= !$ENV{DANCER_NO_SERVER_TOKENS};
Condition33%1/3
$SETTINGS->{"server_tokens"} ||= !$ENV{"DANCER_NO_SERVER_TOKENS"}
l!l&&r!l&&!r
02320
MC/DC0%0/2
$SETTINGS->{"server_tokens"} ||= !$ENV{"DANCER_NO_SERVER_TOKENS"}
$SETTINGS->{"server_tokens"} !$ENV{"DANCER_NO_SERVER_TOKENS"}
Truth table33%1/3
A ||= not(B)
A= $SETTINGS->{"server_tokens"}B= !$ENV{"DANCER_NO_SERVER_TOKENS"}
ABresult
1X1
011
000
269 232 ▶ $SETTINGS->{logger} ||= $ENV{DANCER_LOGGER} || 'file';
Condition40%2/5
$SETTINGS->{"logger"} ||= $ENV{"DANCER_LOGGER"} || "file"
l!l&&r!l&&!r
02320
$ENV{'DANCER_LOGGER'} || 'file'
l!l
0232
MC/DC0%0/2
$SETTINGS->{"logger"} ||= $ENV{"DANCER_LOGGER"} || "file"
$SETTINGS->{"logger"} $ENV{'DANCER_LOGGER'}
Truth table0%0/3
A ||= B
A= $SETTINGS->{"logger"}B= $ENV{'DANCER_LOGGER'}
ABresult
1X1
011
000
270 $SETTINGS->{environment} ||=
271 $ENV{DANCER_ENVIRONMENT}
272 || $ENV{PLACK_ENV}
273 232 ▶ || 'development';
Condition37%3/8
$SETTINGS->{"environment"} ||= $ENV{"DANCER_ENVIRONMENT"} || $ENV{"PLACK_ENV"} || "development"
l!l&&r!l&&!r
02320
$ENV{'DANCER_ENVIRONMENT'} || $ENV{'PLACK_ENV'} || 'development'
l!l
0232
$ENV{"DANCER_ENVIRONMENT"} or $ENV{"PLACK_ENV"}
l!l&&r!l&&!r
00232
MC/DC0%0/3
$SETTINGS->{"environment"} ||= $ENV{"DANCER_ENVIRONMENT"} || $ENV{"PLACK_ENV"} || "development"
$SETTINGS->{"environment"} $ENV{"DANCER_ENVIRONMENT"} $ENV{"PLACK_ENV"}
Truth table0%0/4
A ||= B or C
A= $SETTINGS->{"environment"}B= $ENV{"DANCER_ENVIRONMENT"}C= $ENV{"PLACK_ENV"}
ABCresult
1XX1
01X1
0011
0000
274  
275 232 setting $_ => {} for keys %MERGEABLE;
276 232 setting template => 'simple';
277 }
278  
279 232 load_default_settings();
280  
281 232 1;
282  
283 __END__
↑ Summary blib/lib/Dancer/Template/TemplateToolkit.pm »