Carrot

 view release on metacpan or  search on metacpan

lib/Carrot.pm  view on Meta::CPAN


sub individuality
# /type function
# /effect "Wrapper to the homonymous method of the meta provider"
# //parameters
# //returns
#	::Meta::Monad::Phase::Run
{
	return($meta_provider->individuality(caller));
}

#NOTE: caller(0) doesn't give information about the calling block.
#	This information can only be obtained by a search through caller(1..N).
#	That is costly and not even guaranteed to work.
#	Ideally [caller(0)]->[11] would be BEGIN, UNITCHECK or ''.
#	caller(1) assumes nobody tries eval {$meta_monad = Carrot:meta_monad}.
sub expressiveness
# /type function
# /effect "Selector for methods of the meta provider"
# //parameters
# //returns
#	::Meta::Monad
{
	my $caller1 = [caller(1)]; # skew due to information mangling
	my $block_name = $caller1->[RDX_CALLER_SUB_NAME];
	if (substr($block_name, -7) eq '::BEGIN')
	{
		return($meta_provider->modularity(caller));

	} elsif ($block_name eq '')
	{
		return($meta_provider->individuality(caller));

	} else {
		die("Don't know how to handle block '$block_name'.");
	}

}

sub main
# /type function
# /effect "Returns the script file name containing the main routine."
# //parameters
#	meta_provider
# //returns
{
	unless (defined($carrot_main))
	{
		die("No --carrot-main=... given.");
	}

	return($carrot_main);
}

sub import
# /type function
# /effect "Issues a warning only."
# //parameters
# //returns
{
#	return if((caller)[RDX_CALLER_LINE] == 0); # perl -MCarrot
	warn($translated_errors->message_text('require_preferred', []));
}

# =--------------------------------------------------------------------------= #

	return(PERL_FILE_LOADED);
}
# //revision_control
#	version 1.1.309
#	branch main
#	maturity alpha
# /license MPL-2.0 (Mozilla Public License v2.0)
# /copyright "(C) 2009-2014 Winfried Trümper <win@carrot-programming.org>"



( run in 3.591 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )