App-Midgen
view release on metacpan or search on metacpan
lib/App/Midgen/Role/Output/Infile.pm view on Meta::CPAN
package App::Midgen::Role::Output::Infile;
use constant {
BLANK => q{ },
NONE => q{},
THREE => 3,
EIGHT => 8,
NINE => 9,
TEN => 10
};
use Moo::Role;
requires qw( core dual_life debug );
use Try::Tiny;
# Load time and dependencies negate execution time
# use namespace::clean -except => 'meta';
our $VERSION = '0.34';
$VERSION = eval $VERSION; ## no critic
use English qw( -no_match_vars );
local $OUTPUT_AUTOFLUSH = 1;
use Term::ANSIColor qw( :constants colored );
use Data::Printer {caller_info => 1,};
use File::Spec;
#######
# header_infile
#######
sub header_infile {
my $self = shift;
print qq{\n};
return;
}
#######
# body_infile
#######
sub body_infile {
my $self = shift;
return;
}
#######
# footer_infile
#######
sub footer_infile {
my $self = shift;
p $self->{modules} if $self->debug;
# Let's work out our padding
my $pm_length = 0;
my $dir_length = 0;
foreach my $module_name (sort keys %{$self->{modules}}) {
if (length $module_name > $pm_length) {
$pm_length = length $module_name;
}
try {
foreach my $foundin (sort @{$self->{modules}{$module_name}{infiles}}) {
if (length $foundin->[0] > $dir_length) {
$dir_length = length $foundin->[0];
}
}
};
}
print " "
. "-" x $pm_length
. "-" x EIGHT
. "-" x TEN
. "-" x $dir_length
. "-" x TEN . "\n";
printf " | %-*s | %-*s | %-*s | %-*s |\n", $pm_length, 'Module', EIGHT,
'Version ', EIGHT, 'Installed', $dir_length, 'Found in';
print " "
( run in 0.902 second using v1.01-cache-2.11-cpan-5837b0d9d2c )