App-Midgen

 view release on metacpan or  search on metacpan

lib/App/Midgen/Role/Output/EUMM.pm  view on Meta::CPAN

package App::Midgen::Role::Output::EUMM;

use constant {
	BLANK  => q{ },
	NONE   => q{},
	THREE  => q{   },
	SIX    => q{      },
	NINE   => q{         },
	TWELVE => q{            },
};

use Moo::Role;
requires qw( verbose );

# 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 );    # Avoids reg-ex performance penalty
local $OUTPUT_AUTOFLUSH = 1;

use Term::ANSIColor qw( :constants colored );
use File::Spec;

#######
# header_eumm
#######
sub header_eumm {
	my $self = shift;
	my $package_name = shift || NONE;

	if ($package_name ne NONE) {

		print "\nuse strict;\n";
		print "use warnings;\n";
		print "use ExtUtils::MakeMaker 6.68;\n\n";

		print "WriteMakefile(\n";
		print THREE. "'NAME' => '$package_name',\n";
		$package_name =~ s{::}{/}g;
		print THREE. "'VERSION_FROM' => 'lib/$package_name.pm',\n";
		print THREE. "'ABSTRACT_FROM' => 'lib/$package_name.pm',\n";

		print BRIGHT_BLACK;
		print THREE. "'AUTHOR' => '...',\n";
		print THREE. "'LICENSE' => 'perl',\n";
		print CLEAR;
## 6.64 f***** RT#85406
		print THREE. "'BUILD_REQUIRES' => {\n";
		print SIX. "'ExtUtils::MakeMaker' => '6.68',\n";
		print THREE. "},\n";
		print THREE. "'CONFIGURE_REQUIRES' => {\n";
		print SIX. "'ExtUtils::MakeMaker' => '6.68',\n";
		print THREE. "},\n";
	}

	return;
}
#######
# body_eumm
#######
sub body_eumm {
	my $self         = shift;
	my $title        = shift;
	my $required_ref = shift || return;

	return if not %{$required_ref};

	my $pm_length = 0;
	foreach my $module_name (sort keys %{$required_ref}) {
		if (length $module_name > $pm_length) {
			$pm_length = length $module_name;
		}
	}

	print THREE. "'MIN_PERL_VERSION' => '$App::Midgen::Min_Version',\n"
		if $title eq 'RuntimeRequires';

#	return if not %{$required_ref} and $title =~ m{(?:requires)\z};



( run in 0.825 second using v1.01-cache-2.11-cpan-d8267643d1d )