Exporter-Tiny

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

my %dynamic_config;
do {
	my $prereq_type = 'recommends';

	if ( $ENV{CI}
	and defined $ENV{GITHUB_REPOSITORY}
	and $ENV{GITHUB_REPOSITORY} eq 'tobyink/p5-exporter-tiny' ) {
		$prereq_type = 'requires';
	}

	if ( $] ge 5.011002 and $] lt 5.037002 ) {
		$meta->{prereqs}{runtime}{$prereq_type}{'Lexical::Var'} = '0.010';
	}

	# idk, this should be automatic or summint? put it in explicitly.
	$meta->{prereqs}{runtime}{requires}{'Test::More'} = '0.47'
		if $] lt 5.006002;

};

my %WriteMakefileArgs = (
	ABSTRACT   => $meta->{abstract},
	AUTHOR     => ($EUMM >= 6.5702 ? $meta->{author} : $meta->{author}[0]),
	DISTNAME   => $meta->{name},
	VERSION    => $meta->{version},
	EXE_FILES  => [ map $_->{file}, values %{ $meta->{x_provides_scripts} || {} } ],
	NAME       => do { my $n = $meta->{name}; $n =~ s/-/::/g; $n },

lib/Exporter/Tiny.pm  view on Meta::CPAN


use 5.006001;
use strict;
use warnings; no warnings qw(void once uninitialized numeric redefine);

our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION   = '1.006002';
our @EXPORT_OK = qw< mkopt mkopt_hash _croak _carp >;

BEGIN {
	*_HAS_NATIVE_LEXICAL_SUB = ( $] ge '5.037002' )
		? sub () { !!1 }
		: sub () { !!0 };
	*_HAS_MODULE_LEXICAL_SUB = ( $] ge '5.011002' and eval('require Lexical::Sub') )
		? sub () { !!1 }
		: sub () { !!0 };
};

sub _croak ($;@) { require Carp; my $fmt = shift; @_ = sprintf($fmt, @_); goto \&Carp::croak }
sub _carp  ($;@) { require Carp; my $fmt = shift; @_ = sprintf($fmt, @_); goto \&Carp::carp }

my $_process_optlist = sub
{
	my $class = shift;

lib/Exporter/Tiny.pm  view on Meta::CPAN

		$class->_exporter_uninstall_sub($_, $wanted->[1], $global_opts)
			for keys %symbols;
	}
}

# Returns a coderef suitable to be used as a sub installer for lexical imports.
#
sub _exporter_lexical_installer {
	_HAS_NATIVE_LEXICAL_SUB and return sub {
		my ( $sigilname, $sym ) = @{ $_[1] };
		no warnings ( $] ge '5.037002' ? 'experimental::builtin' : () );
		builtin::export_lexically( $sigilname, $sym );
	};
	_HAS_MODULE_LEXICAL_SUB and return sub {
		my ( $sigilname, $sym ) = @{ $_[1] };
		( $sigilname =~ /^\w/ )
			? 'Lexical::Sub'->import( $sigilname, $sym )
			: 'Lexical::Var'->import( $sigilname, $sym );
	};
	_croak( 'Lexical export requires Perl 5.37.2+ for native support, or Perl 5.11.2+ with the Lexical::Sub module' );
}



( run in 0.918 second using v1.01-cache-2.11-cpan-cc502c75498 )