Exporter-Almighty

 view release on metacpan or  search on metacpan

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

use 5.012;
use strict;
use warnings;

package Exporter::Almighty;

our $AUTHORITY = 'cpan:TOBYINK';
our $VERSION   = '0.001005';

use parent qw( Exporter::Tiny );

my @builtins;
BEGIN { @builtins = qw( is_bool created_as_string created_as_number ) };
use if $] lt '5.036000', 'builtins::compat' => @builtins;
use if $] ge '5.036000', 'builtin' => @builtins;
no if $] ge '5.036000', 'warnings' => qw( experimental::builtin );

use B                 qw( perlstring );
use Carp              qw( croak );
use Eval::TypeTiny    qw( eval_closure set_subname );
use Exporter::Tiny    qw( mkopt );
use Import::Into;
use Module::Runtime   qw( require_module module_notional_filename );
use Type::Registry    qw();
use Types::Common     qw(
	-sigs
	-types
	assert_Ref       is_Ref
	assert_ArrayRef  is_ArrayRef
	assert_HashRef   is_HashRef
	is_NonEmptySimpleStr
);

sub _exporter_validate_opts {
	my ( $me, $options ) = @_;
	my $into  = $options->{into};
	my $setup = $options->{setup};
	strict->import::into( $into );
	warnings->import::into( $into );
	$me->setup_for( $into, $setup );
}

# Subclasses may wish to provide a subclass of Exporter::Tiny here.
sub base_exporter {
	return 'Exporter::Tiny';
}

sub standard_package_variables {
	my ( $me, $into ) = @_;
	no strict 'refs';
	return (
		\@{"$into\::ISA"},
		\@{"$into\::EXPORT"},
		\@{"$into\::EXPORT_OK"},
		\%{"$into\::EXPORT_TAGS"},
	);
}

signature_for setup_for => (
	method  => 1,
	head    => [ NonEmptySimpleStr ],
	named   => [
		tag    => Optional[HashRef],
		also   => Optional[ArrayRef],
		enum   => Optional[HashRef[ArrayRef]],
		class  => Optional[ArrayRef],
		role   => Optional[ArrayRef],
		duck   => Optional[HashRef[ArrayRef]],
		type   => Optional[ArrayRef],
		const  => Optional[HashRef],
	],
);

sub setup_for {
	my ( $me, $into, $setup ) = @_;
	$INC{ module_notional_filename($into) } //= __FILE__;



( run in 1.326 second using v1.01-cache-2.11-cpan-8dfa8b56332 )