Acme-PPIx-MetaSyntactic

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

  "x_provides_scripts" => { "perl-metasyntactic" => { file => "bin/perl-metasyntactic" } },
};

my %dynamic_config;

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 },
	test       => { TESTS => "t/*.t" },
	%dynamic_config,
);

$WriteMakefileArgs{LICENSE} = $meta->{license}[0] if $EUMM >= 6.3001;

sub deps
{
	my %r;

Makefile.PL  view on Meta::CPAN

	$WriteMakefileArgs{PREREQ_PM}          ||= deps('runtime', 'build', 'test');	
}
else
{
	$WriteMakefileArgs{PREREQ_PM}          ||= deps('configure', 'build', 'test', 'runtime');	
}

{
	my ($minperl) = reverse sort(
		grep defined && /^[0-9]+(\.[0-9]+)?$/,
		map $meta->{prereqs}{$_}{requires}{perl},
		qw( configure build runtime )
	);
	
	if (defined($minperl))
	{
		die "Installing $meta->{name} requires Perl >= $minperl"
			unless $] >= $minperl;
		
		$WriteMakefileArgs{MIN_PERL_VERSION} ||= $minperl
			if $EUMM >= 6.48;

README  view on Meta::CPAN

    `local_subs`
        HashRef where the keys are the names of subs which are considered
        locally defined (i.e. not Perl built-ins, and not imported) and thus
        available for relabelling. Values are expected to all be "1".

        Can be coerced from `ArrayRef[Str]`.

        Defaults to a list built by scanning the `document` with PPI.

    `names`
        HashRef mapping old names to new names. This will be populated by the
        relabelling process, but you may supply some initial values.

        Defaults to empty hashref.

    `already_used`
        HashRef keeping track of names already used in remapping, to avoid
        renaming two variables the same thing.

        Defaults to a hashref populated from `names`.

        This attribute cannot be provided to the constructor.

BUGS
    Please report any bugs to
    <http://rt.cpan.org/Dist/Display.html?Queue=Acme-PPIx-MetaSyntactic>.

lib/Acme/PPIx/MetaSyntactic.pm  view on Meta::CPAN

use Acme::MetaSyntactic;
use PPIx::Utils qw( is_perl_builtin is_function_call );
use PPI;

use Types::Standard -types;

my $Document      = (InstanceOf["PPI::Document"])->plus_coercions(
	ScalarRef[Str], q { "PPI::Document"->new($_) },
	Str,            q { "PPI::Document"->new($_) },
	FileHandle,     q { do { local $/; my $c = <$_>; "PPI::Document"->new(\$c) } },
	ArrayRef[Str],  q { do { my $c = join "\n", map { chomp(my $l = $_); $l } @$_; "PPI::Document"->new(\$c) } },
);

my $MetaSyntactic = (InstanceOf["Acme::MetaSyntactic"])->plus_coercions(
	Str,            q { "Acme::MetaSyntactic"->new($_) },
);

my $TruthTable    = (Map[Str, Bool])->plus_coercions(
	ArrayRef[Str],  q { +{ map +($_, 1), @$_ } },
);

has document => (
	is       => "ro",
	isa      => $Document,
	coerce   => 1,
	required => 1,
);

has theme => (

lib/Acme/PPIx/MetaSyntactic.pm  view on Meta::CPAN

sub _build_names
{
	my $self = shift;
	return +{};
}

sub _build_already_used
{
	my $self = shift;
	return +{
		map +($_, 1), values %{ $self->names },
	};
}

sub BUILD
{
	my $self = shift;
	$self->_relabel_subs;
	$self->_relabel_variables;
	return;
}

lib/Acme/PPIx/MetaSyntactic.pm  view on Meta::CPAN

HashRef where the keys are the names of subs which are considered locally
defined (i.e. not Perl built-ins, and not imported) and thus available for
relabelling. Values are expected to all be C<< "1" >>.

Can be coerced from C<< ArrayRef[Str] >>.

Defaults to a list built by scanning the C<document> with PPI.

=item C<< names >>

HashRef mapping old names to new names. This will be populated by the
relabelling process, but you may supply some initial values. 

Defaults to empty hashref.

=item C<< already_used >>

HashRef keeping track of names already used in remapping, to avoid renaming
two variables the same thing.

Defaults to a hashref populated from C<names>.

This attribute cannot be provided to the constructor.

=back

=head1 BUGS



( run in 2.014 seconds using v1.01-cache-2.11-cpan-49f99fa48dc )