DDG/App/Attribution.pm untested

filter: Statementstmt 0.0% 0 / 35 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 47 CC 4 SCAR 24.0
CC
4
Cov
0%
BUILD
20.0
BEGIN
2.0
BEGIN
2.0
CRAP 11.0
1 package DDG::App::Attribution;
2 our $AUTHORITY = 'cpan:DDG';
3 # ABSTRACT: Application class for reading the attributions of a package
4 $DDG::App::Attribution::VERSION = '1017';
5 use MooX qw(
6 Options
7 );
8  
9 use Module::Runtime qw( use_module );
10 use lib ();
11 use Path::Class;
12  
13 sub BUILD {
14 my ( $self ) = @_;
15 my $curdir = dir('lib')->absolute;
16 lib->import($curdir->stringify);
17 my @modules = @ARGV ? @ARGV : (); # TODO get complete list of all available modules on no args
18 for (@modules) {
19 use_module($_);
20 if ($self->html) {
21 print $_->get_attributions_html;
22 print "\n";
23 } else {
24 my @attributions = @{$_->get_attributions};
25 if (@attributions) {
26 print "\nAttributions for ".$_.":\n\n";
27 while (@attributions) {
28 my $key = shift @attributions;
29 my $value = shift @attributions;
30 print " - ".$key." (".$value.")\n";
31 }
32 } else {
33 print "\nNo attributions for ".$_."\n\n";
34 }
35 }
36 }
37 print "\n";
38 }
39  
40 option 'html' => (
41 is => 'ro',
42 default => sub { 0 },
43 negativable => 1,
44 );
45  
46 1;
47  
48 __END__