lib/Dancer/Config.pm

filter: Statementstmt 95.9% 164 / 171 Branchbran 81.2% 39 / 48 Conditioncond 44.1% 38 / 86 MC/DCmcdc 2.5% 1 / 40 Subroutinesub 94.8% 37 / 39 Podpod 0.0% 0 / 11 totaltotal 70.6% 279 / 395 CC 60 SCAR 35.3
CC
60
Cov
79%
load_default_settings
114.7
load
8.0
__ANON__
6.0
CRAP 34.0
↑ Summary blib/lib/Dancer/Template/TemplateToolkit.pm »
1 package Dancer::Config;
2 242 our $AUTHORITY = 'cpan:SUKRIA';
3 #ABSTRACT: how to configure Dancer to suit your needs
4 242 $Dancer::Config::VERSION = '1.3522';
5 242 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 242 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 242 ▶use base 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 242 ▶use vars '@EXPORT_OK';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 242 ▶use Hash::Merge::Simple;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 242 ▶use Dancer::Config::Object 'hashref_to_object';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 242 ▶use Dancer::Deprecation;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 242 ▶use Dancer::Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 242 ▶use Dancer::ModuleLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 242 ▶use Dancer::FileUtils 'path';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 242 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 242 ▶use Dancer::Exception qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 242 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 242 @EXPORT_OK = qw(setting);
22  
23 242 my $SETTINGS = {};
24  
25 # mergeable settings
26 242 my %MERGEABLE = map { ($_ => 1) } qw( plugins handlers );
27 242 my %_LOADED;
28  
29 646 ▶sub settings {$SETTINGS}
Subroutine settings: called CC=1 SCAR=0.0
Pod undocumented
30  
31 my $setters = {
32 103 ▶ logger => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
33 103 my ($setting, $value) = @_;
34 103 require Dancer::Logger;
35 103 Dancer::Logger->init($value, settings());
36 },
37 2 ▶ log_file => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
38 2 require Dancer::Logger;
39 2 Dancer::Logger->init(setting("logger"), settings());
40 },
41 96 ▶ session => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
42 96 my ($setting, $value) = @_;
43 96 require Dancer::Session;
44 96 Dancer::Session->init($value, settings());
45 },
46 254 ▶ template => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
47 254 my ($setting, $value) = @_;
48 254 require Dancer::Template;
49 254 Dancer::Template->init($value, settings());
50 },
51 2 ▶ route_cache => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
52 2 my ($setting, $value) = @_;
53 2 require Dancer::Route::Cache;
54 2 Dancer::Route::Cache->reset();
55 },
56 21 ▶ serializer => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
57 21 my ($setting, $value) = @_;
58 21 require Dancer::Serializer;
59 21 Dancer::Serializer->init($value);
60 },
61 # This setting has been deprecated in favor of global_warnings.
62 0 ▶ import_warnings => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
63 0 my ($setting, $value) = @_;
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 3 ▶ global_warnings => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
72 3 my ($setting, $value) = @_;
73 3 ▶ $^W = $value ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$value ? : 2 1 3
74 },
75 10 ▶ traces => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
76 10 my ($setting, $traces) = @_;
77 10 ▶ $Dancer::Exception::Verbose = $traces ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$traces ? : 1 9 10
78 },
79 242 };
80 242 $setters->{log_path} = $setters->{log_file};
81  
82 my $normalizers = {
83 6 ▶ charset => sub {
Subroutine __ANON__: called CC=5 SCAR=16.5
84 6 my ($setting, $charset) = @_;
85 6 ▶ length($charset || '')
Branch: 1 branch
BranchTrueFalseTotal
length($charset || "") or return $charset 6 0 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}'") 6 0 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 0 ▶ session_same_site => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
98 0 my ($setting, $same_site_setting) = @_;
99 0 ▶ if ($same_site_setting =~ m{^(strict|lax|none)$}i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($same_site_setting =~ /^(strict|lax|none)$/i) { } 0 0 0
100 0 return ucfirst lc $same_site_setting;
101 } else {
102 0 raise core_config => "Invalid session_same_site value $same_site_setting";
103 }
104 },
105 242 };
106  
107 2025 ▶sub normalize_setting {
Subroutine normalize_setting: called CC=2 SCAR=6.9
Pod undocumented
108 2025 my ($class, $setting, $value) = @_;
109  
110 $value = $normalizers->{$setting}->($setting, $value)
111 2025 ▶ if exists $normalizers->{$setting};
Branch: 1 branch
BranchTrueFalseTotal
if exists $normalizers->{$setting} 6 2019 2025
112  
113 2025 return $value;
114 }
115  
116 # public accessor for get/set
117 14126 ▶sub setting {
Subroutine setting: called CC=4 SCAR=13.9
Pod undocumented
118 14126 ▶ if (@_ == 1) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) { } 12189 1937 14126
119 12189 return _get_setting(shift @_);
120 }
121 else {
122 # can be useful for debug! Use Logger, instead?
123 1937 ▶ die "Odd number in 'set' assignment" unless scalar @_ % 2 == 0;
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @_ % 2 == 0 0 1937 1937
124  
125 1937 my $count = 0;
126 1937 ▶ while (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 1955 1932 3887
127 1955 my $setting = shift;
128 1955 my $value = shift;
129  
130 1955 _set_setting ($setting, $value);
131  
132 # At the moment, with any kind of hierarchical setter,
133 # there is no case where the same trigger will be run more
134 # than once. If/when a hierarchical setter is implemented,
135 # we should create a list of the hooks that should be run,
136 # and run them at the end of this while, only (efficiency
137 # purposes).
138 1955 _trigger_hooks($setting, $value);
139 1950 $count++
140 }
141 1932 return $count; # just to return anything, the number of items set.
142 }
143 }
144  
145 1957 ▶sub _trigger_hooks {
Subroutine _trigger_hooks: called CC=2 SCAR=6.9
146 1957 my ($setting, $value) = @_;
147  
148 1957 ▶ $setters->{$setting}->(@_) if defined $setters->{$setting};
Branch: 1 branch
BranchTrueFalseTotal
if defined $setters->{$setting} 463 1494 1957
149 }
150  
151 1956 ▶sub _set_setting {
Subroutine _set_setting: called CC=2 SCAR=7.0
152 1956 my ($setting, $value) = @_;
153  
154 1956 ▶ return unless @_ == 2;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 1956 1956
155  
156 # normalize the value if needed
157 1956 $value = Dancer::Config->normalize_setting($setting, $value);
158 1956 $SETTINGS->{$setting} = $value;
159 1956 return $value;
160 }
161  
162 12190 ▶sub _get_setting {
Subroutine _get_setting: called CC=1 SCAR=0.0
163 12190 my $setting = shift;
164  
165 12190 return $SETTINGS->{$setting};
166 }
167  
168 225 ▶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
22230
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
169  
170 17 ▶sub environment_file {
Subroutine environment_file: called CC=2 SCAR=7.0
Pod undocumented
171 17 my $env = setting('environment');
172 # XXX for compatibility reason, we duplicate the code from `init_envdir` here
173 # we don't know how if some application don't already do some weird stuff like
174 # the test in `t/15_plugins/02_config.t`.
175 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
176 17 return path($envdir, "$env.yml");
177 }
178  
179 201 ▶sub init_confdir {
Subroutine init_confdir: called CC=3 SCAR=11.1
Pod undocumented
180 201 ▶ return setting('confdir') if setting('confdir');
Branch: 1 branch
BranchTrueFalseTotal
if setting("confdir") 197 4 201
181 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
182 }
183  
184 201 ▶sub init_envdir {
Subroutine init_envdir: called CC=4 SCAR=14.2
Pod undocumented
185 201 ▶ return setting('envdir') if setting('envdir');
Branch: 1 branch
BranchTrueFalseTotal
if setting("envdir") 72 129 201
186 129 ▶ my $appdirpath = defined setting('appdir') ?
Branch: 1 branch
BranchTrueFalseTotal
defined setting('appdir') ? : 128 1 129
187 path( setting('appdir'), 'environments' ) :
188 path('environments');
189  
190 129 ▶ setting envdir => $ENV{DANCER_ENVDIR} || $appdirpath;
Condition33%1/3
$ENV{'DANCER_ENVDIR'} || $appdirpath
l!l&&r!l&&!r
01290
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
191 }
192  
193 201 ▶sub load {
Subroutine load: called CC=8 SCAR=20.8
Pod undocumented
194 201 init_confdir();
195 201 init_envdir();
196  
197 # look for the conffile
198 201 ▶ return 1 unless -f conffile;
Branch: 1 branch
BranchTrueFalseTotal
unless -f conffile() 190 11 201
199  
200 # load YAML
201 11 my $module = load_yaml_module();
202  
203 10 ▶ unless ($_LOADED{conffile()}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_LOADED{conffile()}) 5 5 10
204 5 load_settings_from_yaml(conffile, $module);
205 5 $_LOADED{conffile()}++;
206 }
207  
208 10 my $env = environment_file;
209  
210 # don't load the same env twice
211 10 ▶ unless( $_LOADED{$env} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($_LOADED{$env}) 10 0 10
212 10 ▶ if (-f $env ) {
Branch: 2 branches
BranchTrueFalseTotal
if (-f $env) { } 4 6 10
elsif (setting('require_environment')) { } 1 5 6
213 4 load_settings_from_yaml($env, $module);
214 4 $_LOADED{$env}++;
215 }
216 elsif (setting('require_environment')) {
217 # failed to load the env file, and the main config said we needed it.
218 1 confess "Could not load environment file '$env', and require_environment is set";
219 }
220 }
221  
222 9 foreach my $key (grep { $setters->{$_} } keys %$SETTINGS) {
223 28 $setters->{$key}->($key, $SETTINGS->{$key});
224 }
225 9 ▶ if ( $SETTINGS->{strict_config} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($SETTINGS->{"strict_config"}) 2 7 9
226 2 $SETTINGS = hashref_to_object($SETTINGS);
227 }
228  
229 9 return 1;
230 }
231  
232 14 ▶sub load_settings_from_yaml {
Subroutine load_settings_from_yaml: called CC=3 SCAR=11.0
Pod undocumented
233 14 my ($file, $module) = @_;
234  
235 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
236  
237 14 my $config;
238 {
239 242 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
240 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}: $@") 9 5 14
241 or confess "Unable to parse the configuration file: $file: $@";
242 }
243  
244 $SETTINGS = Hash::Merge::Simple::merge( $SETTINGS, {
245 map {
246 9 $_ => Dancer::Config->normalize_setting( $_, $config->{$_} )
247 } keys %$config
248 } );
249  
250 9 return scalar keys %$config;
251 }
252  
253 12 ▶sub load_yaml_module {
Subroutine load_yaml_module: called CC=4 SCAR=14.0
Pod undocumented
254 12 my ($module) = @_;
255  
256 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
257  
258 12 my ( $result, $error ) = Dancer::ModuleLoader->load($module);
259 12 ▶ confess "Could not load $module: $error"
Branch: 1 branch
BranchTrueFalseTotal
unless $result 1 11 12
260 unless $result;
261  
262 11 return $module;
263 }
264  
265 242 ▶sub load_default_settings {
Subroutine load_default_settings: called CC=27 SCAR=47.4
Pod undocumented
266 242 ▶ $SETTINGS->{server} ||= $ENV{DANCER_SERVER} || '0.0.0.0';
Condition40%2/5
$SETTINGS->{"server"} ||= $ENV{"DANCER_SERVER"} || "0.0.0.0"
l!l&&r!l&&!r
02420
$ENV{'DANCER_SERVER'} || '0.0.0.0'
l!l
0242
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
267 242 ▶ $SETTINGS->{port} ||= $ENV{DANCER_PORT} || '3000';
Condition40%2/5
$SETTINGS->{"port"} ||= $ENV{"DANCER_PORT"} || 3000
l!l&&r!l&&!r
02420
$ENV{'DANCER_PORT'} || '3000'
l!l
0242
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
268 242 ▶ $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
02420
$ENV{'DANCER_CONTENT_TYPE'} || 'text/html'
l!l
0242
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
269 242 ▶ $SETTINGS->{charset} ||= $ENV{DANCER_CHARSET} || '';
Condition40%2/5
$SETTINGS->{"charset"} ||= $ENV{"DANCER_CHARSET"} || ""
l!l&&r!l&&!r
00242
$ENV{'DANCER_CHARSET'} || ''
l!l
0242
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
270 242 ▶ $SETTINGS->{startup_info} ||= !$ENV{DANCER_NO_STARTUP_INFO};
Condition33%1/3
$SETTINGS->{"startup_info"} ||= !$ENV{"DANCER_NO_STARTUP_INFO"}
l!l&&r!l&&!r
02420
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
271 242 ▶ $SETTINGS->{daemon} ||= $ENV{DANCER_DAEMON} || 0;
Condition40%2/5
$SETTINGS->{"daemon"} ||= $ENV{"DANCER_DAEMON"} || 0
l!l&&r!l&&!r
00242
$ENV{'DANCER_DAEMON'} || 0
l!l
0242
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
272 242 ▶ $SETTINGS->{apphandler} ||= $ENV{DANCER_APPHANDLER} || 'Standalone';
Condition40%2/5
$SETTINGS->{"apphandler"} ||= $ENV{"DANCER_APPHANDLER"} || "Standalone"
l!l&&r!l&&!r
02420
$ENV{'DANCER_APPHANDLER'} || 'Standalone'
l!l
0242
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
273 242 ▶ $SETTINGS->{warnings} ||= $ENV{DANCER_WARNINGS} || 0;
Condition40%2/5
$SETTINGS->{"warnings"} ||= $ENV{"DANCER_WARNINGS"} || 0
l!l&&r!l&&!r
00242
$ENV{'DANCER_WARNINGS'} || 0
l!l
0242
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
274 242 ▶ $SETTINGS->{auto_reload} ||= $ENV{DANCER_AUTO_RELOAD} || 0;
Condition40%2/5
$SETTINGS->{"auto_reload"} ||= $ENV{"DANCER_AUTO_RELOAD"} || 0
l!l&&r!l&&!r
00242
$ENV{'DANCER_AUTO_RELOAD'} || 0
l!l
0242
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
275 242 ▶ $SETTINGS->{traces} ||= $ENV{DANCER_TRACES} || 0;
Condition40%2/5
$SETTINGS->{"traces"} ||= $ENV{"DANCER_TRACES"} || 0
l!l&&r!l&&!r
00242
$ENV{'DANCER_TRACES'} || 0
l!l
0242
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
276 242 ▶ $SETTINGS->{server_tokens} ||= !$ENV{DANCER_NO_SERVER_TOKENS};
Condition33%1/3
$SETTINGS->{"server_tokens"} ||= !$ENV{"DANCER_NO_SERVER_TOKENS"}
l!l&&r!l&&!r
02420
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
277 242 ▶ $SETTINGS->{logger} ||= $ENV{DANCER_LOGGER} || 'file';
Condition40%2/5
$SETTINGS->{"logger"} ||= $ENV{"DANCER_LOGGER"} || "file"
l!l&&r!l&&!r
02420
$ENV{'DANCER_LOGGER'} || 'file'
l!l
0242
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
278 $SETTINGS->{environment} ||=
279 $ENV{DANCER_ENVIRONMENT}
280 || $ENV{PLACK_ENV}
281 242 ▶ || 'development';
Condition37%3/8
$SETTINGS->{"environment"} ||= $ENV{"DANCER_ENVIRONMENT"} || $ENV{"PLACK_ENV"} || "development"
l!l&&r!l&&!r
02420
$ENV{'DANCER_ENVIRONMENT'} || $ENV{'PLACK_ENV'} || 'development'
l!l
0242
$ENV{"DANCER_ENVIRONMENT"} or $ENV{"PLACK_ENV"}
l!l&&r!l&&!r
00242
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
282  
283 242 setting $_ => {} for keys %MERGEABLE;
284 242 setting template => 'simple';
285 }
286  
287 242 load_default_settings();
288  
289 242 1;
290  
291 __END__
↑ Summary blib/lib/Dancer/Template/TemplateToolkit.pm »