line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Report::Generator::Command::GenReport; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
152835
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
4
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
6
|
use vars qw(@ISA $VERSION); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
83
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
App::Report::Generator::Command::GenReport - provides the command class to run report configurations. |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
This module is not intended to be used directly. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
This module provides a command class for C to find |
19
|
|
|
|
|
|
|
configuration files loadable by L and run then via |
20
|
|
|
|
|
|
|
L. |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
The configuration is searched in the configuration subdirectories |
23
|
|
|
|
|
|
|
C unless C<$ENV{APP_GENREPORT_CONFIGBASE}> is set. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
You can place the configuration at any location where configuration files |
26
|
|
|
|
|
|
|
could be expected, see L for reasonable locations. Of |
27
|
|
|
|
|
|
|
course, test reports should be placed locally for the user |
28
|
|
|
|
|
|
|
(e.g. C<$ENV{HOME}/genreport/test-report1.yaml>), reports which are |
29
|
|
|
|
|
|
|
planned to do periodically shall be placed at a location where the cron |
30
|
|
|
|
|
|
|
process could find it (C or |
31
|
|
|
|
|
|
|
C). |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
Use C<< genreport commands >> to figure out, which reports can be run. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 FUNCTIONS/METHODS |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
1
|
|
6
|
use Carp qw(croak); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
68
|
|
40
|
|
|
|
|
|
|
|
41
|
1
|
|
|
1
|
|
6
|
use File::Basename; |
|
1
|
|
|
|
|
12
|
|
|
1
|
|
|
|
|
70
|
|
42
|
1
|
|
|
1
|
|
1037
|
use File::Find::Rule; |
|
1
|
|
|
|
|
9395
|
|
|
1
|
|
|
|
|
9
|
|
43
|
1
|
|
|
1
|
|
1119
|
use Config::Any; |
|
1
|
|
|
|
|
1552
|
|
|
1
|
|
|
|
|
46
|
|
44
|
1
|
|
|
1
|
|
1133
|
use File::ConfigDir qw(0.003 config_dirs); |
|
1
|
|
|
|
|
31469
|
|
|
1
|
|
|
|
|
206
|
|
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
1
|
|
871
|
use Report::Generator; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
use App::Report::Generator-command; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
$VERSION = "0.002"; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
#sub opt_spec { |
53
|
|
|
|
|
|
|
#} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
#sub validate_args { |
56
|
|
|
|
|
|
|
#} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
my %cmdcfg; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=head2 command_names |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Finds config files using L (C), |
63
|
|
|
|
|
|
|
L (C) and L. |
64
|
|
|
|
|
|
|
The searched depth is 1 - subdirectories aren't traversed. |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub command_names |
69
|
|
|
|
|
|
|
{ |
70
|
|
|
|
|
|
|
my $self = $_[0]; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
unless (%cmdcfg) |
73
|
|
|
|
|
|
|
{ |
74
|
|
|
|
|
|
|
my $cfgapp = |
75
|
|
|
|
|
|
|
defined( $ENV{APP_GENREPORT_CONFIGBASE} ) ? $ENV{APP_GENREPORT_CONFIGBASE} : 'genreport'; |
76
|
|
|
|
|
|
|
my @cfgext = map { "*." . $_ } Config::Any->extensions(); |
77
|
|
|
|
|
|
|
my @cfgdirs = config_dirs($cfgapp); |
78
|
|
|
|
|
|
|
@cfgdirs or croak("No configuration directories"); |
79
|
|
|
|
|
|
|
# scan config directories |
80
|
|
|
|
|
|
|
my @cfgfiles = File::Find::Rule->file()->name(@cfgext)->maxdepth(1)->in(@cfgdirs); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
@cfgfiles or croak("No configuration directories"); |
83
|
|
|
|
|
|
|
# add config file base names |
84
|
|
|
|
|
|
|
foreach my $cfgfile (@cfgfiles) |
85
|
|
|
|
|
|
|
{ |
86
|
|
|
|
|
|
|
my ( $cfgbasename, undef, undef ) = fileparse( $cfgfile, qr/\.[^.]*/ ); |
87
|
|
|
|
|
|
|
$cmdcfg{ lc $cfgbasename } = $cfgfile; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
return keys %cmdcfg; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head2 set_action |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Takes the user desired action (base name of the configuration file). |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=cut |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
sub set_action |
101
|
|
|
|
|
|
|
{ |
102
|
|
|
|
|
|
|
my ( $self, $command ) = @_; |
103
|
|
|
|
|
|
|
$self->{action} = $command; |
104
|
|
|
|
|
|
|
} |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 execute |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Executes the report generation for the given report. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub execute |
113
|
|
|
|
|
|
|
{ |
114
|
|
|
|
|
|
|
my ( $self, $opt, $args ) = @_; |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
# check $actual_cmd |
117
|
|
|
|
|
|
|
my $cfgfile = $cmdcfg{ $self->{action} }; |
118
|
|
|
|
|
|
|
return Report::Generator->new( { cfg => $cfgfile } )->generate(); |
119
|
|
|
|
|
|
|
} |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 AUTHOR |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Jens Rehsack, C<< >> |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 BUGS |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Please report any bugs or feature requests to |
128
|
|
|
|
|
|
|
C, or through the web interface |
129
|
|
|
|
|
|
|
at L. |
130
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress |
131
|
|
|
|
|
|
|
on your bug as I make changes. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 SUPPORT |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
perldoc App::Report::Generator |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
You can also look for information at: |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over 4 |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
L |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
L |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * CPAN Ratings |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
L |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item * Search CPAN |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
L |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Copyright 2010 Jens Rehsack. |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
166
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
167
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
See http://dev.perl.org/licenses/ for more information. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
=cut |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
1; |