line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Clustericious::Command::configdebug; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
578
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
5
|
1
|
|
|
1
|
|
15
|
use 5.010001; |
|
1
|
|
|
|
|
3
|
|
6
|
1
|
|
|
1
|
|
5
|
use Mojo::Base 'Clustericious::Command'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
11
|
|
7
|
1
|
|
|
1
|
|
153
|
use Clustericious::Config; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
8
|
1
|
|
|
1
|
|
5
|
use YAML::XS qw( Dump ); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
470
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# ABSTRACT: Debug a clustericious configuration file |
11
|
|
|
|
|
|
|
our $VERSION = '1.27'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has description => <<EOT; |
15
|
|
|
|
|
|
|
Print the various stages of the clustericious app configuration file |
16
|
|
|
|
|
|
|
EOT |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
{ |
25
|
0
|
|
|
0
|
1
|
|
my($self, $name) = @_; |
26
|
0
|
|
0
|
|
|
|
my $app_name = $name // ref($self->app); |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
$ENV{MOJO_TEMPLATE_DEBUG} = 1; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $exit = 0; |
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
eval { |
33
|
|
|
|
|
|
|
my $config = Clustericious::Config->new($app_name, sub { |
34
|
0
|
|
|
0
|
|
|
my $type = shift; |
35
|
|
|
|
|
|
|
|
36
|
0
|
0
|
|
|
|
|
if($type eq 'pre_rendered') |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
37
|
|
|
|
|
|
|
{ |
38
|
0
|
|
|
|
|
|
my($src) = @_; |
39
|
0
|
|
|
|
|
|
my $data; |
40
|
0
|
0
|
|
|
|
|
if(ref $src) |
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
|
0
|
|
|
|
|
if(my $error = $@) |
76
|
|
|
|
|
|
|
{ |
77
|
0
|
|
|
|
|
|
say STDERR "ERROR: in syntax: $error"; |
78
|
0
|
|
|
|
|
|
$exit = 2; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
exit $exit; |
82
|
|
|
|
|
|
|
}; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=pod |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=encoding UTF-8 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 NAME |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Clustericious::Command::configdebug - Debug a clustericious configuration file |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 VERSION |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
version 1.27 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 SYNOPSIS |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Given a L<YourApp> clustericious L<Clustericious::App> and C<yourapp> starter script: |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
% yourapp configdebug |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
or |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
% clustericious configdebug YourApp |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 DESCRIPTION |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
This command prints out: |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=over 4 |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The pre-processed template configuration for each configuration file used by your application. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
The post-processed template configuration for each configuration file used by your application. |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=item |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
The final merged configuration |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=back |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 SEE ALSO |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
L<Clustericious::Config>, |
133
|
|
|
|
|
|
|
L<Clustericious> |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 AUTHOR |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Original author: Brian Duggan |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Current maintainer: Graham Ollis E<lt>plicease@cpan.orgE<gt> |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
Contributors: |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Curt Tilmes |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Yanick Champoux |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This software is copyright (c) 2013 by NASA GSFC. |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
152
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=cut |