blib/lib/Clustericious/Command/configdebug.pm

filter: Statementstmt 39.6% 21 / 53 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 75.0% 6 / 8 Podpod 100% 1 / 1 totaltotal 37.3% 28 / 75 CC 7 SCAR 26.2
CC
7
Cov
32%
__ANON__
30.0
run
12.0
BEGIN
1.0
CRAP 13.7
« blib/lib/Clustericious/Log/CommandLine.pm ↑ Summary blib/lib/Clustericious/Command/generate/client.pm »
1 package Clustericious::Command::configdebug;
2
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Mojo::Base 'Clustericious::Command';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Clustericious::Config;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use YAML::XS qw( Dump );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # ABSTRACT: Debug a clustericious configuration file
11 1 our $VERSION = '1.29'; # VERSION
12  
13  
14 1 has description => <<EOT;
15 Print the various stages of the clustericious app configuration file
16 EOT
17  
18 1 has usage => <<EOT;
19 usage $0: configdebug
20 Print the various stages of the clustericious app configuration file
21 EOT
22  
23 sub run
24 0 ▶{
Subroutine run: not called CC=3 SCAR=24.8
Pod documented
25 0 my($self, $name) = @_;
26 0 ▶ my $app_name = $name // ref($self->app);
Condition0%0/2
$name // ref $self->app
l!l
00
MC/DC0%0/1
$name // ref $self->app
$name
Truth table0%0/2
A
A= $name
Aresult
11
00
27  
28 0 $ENV{MOJO_TEMPLATE_DEBUG} = 1;
29  
30 0 my $exit = 0;
31  
32 0 eval {
33 0 ▶ my $config = Clustericious::Config->new($app_name, sub {
Subroutine __ANON__: not called CC=5 SCAR=34.0
34 0 my $type = shift;
35  
36 0 ▶ if($type eq 'pre_rendered')
Branch: 3 branches
BranchTrueFalseTotal
if ($type eq 'pre_rendered') { } 0 0 0
elsif ($type eq 'rendered') { } 0 0 0
elsif ($type eq 'not_found') { } 0 0 0
37 {
38 0 my($src) = @_;
39 0 my $data;
40 0 ▶ if(ref $src)
Branch: 1 branch
BranchTrueFalseTotal
if (ref $src) { } 0 0 0
41 {
42 0 say "[SCALAR :: template]";
43 0 $data = $$src;
44 }
45 else
46 {
47 0 say "[$src :: template]";
48 0 open my $fh, '<', $src;
49 0 local $/;
50 0 $data = <$fh>;
51 0 close $fh;
52 }
53 0 chomp $data;
54 0 say $data;
55 }
56 elsif($type eq 'rendered')
57 {
58 0 my($file, $content) = @_;
59 0 say "[$file :: interpreted]";
60 0 chomp $content;
61 0 say $content;
62 }
63 elsif($type eq 'not_found')
64 {
65 0 say STDERR "ERROR: unable to find $_[0]";
66 0 $exit = 2;
67 }
68 0 });
69  
70 0 say "[merged]";
71 0 print Dump({ %$config });
72  
73 };
74
75 0 ▶ if(my $error = $@)
Branch: 1 branch
BranchTrueFalseTotal
if (my $error = $@) 0 0 0
76 {
77 0 say STDERR "ERROR: in syntax: $error";
78 0 $exit = 2;
79 }
80  
81 0 exit $exit;
82 };
83  
84 1 1;
85  
86 __END__
« blib/lib/Clustericious/Log/CommandLine.pm ↑ Summary blib/lib/Clustericious/Command/generate/client.pm »