Acme-PPIx-MetaSyntactic
view release on metacpan or search on metacpan
NAME
Acme::PPIx::MetaSyntactic - rename functions and variables in a
PPI::Document using Acme::MetaSyntactic
SYNOPSIS
my $acme = "Acme::PPIx::MetaSyntactic"->new(document => \<<'END');
use v5.010;
use constant PLACE => "World";
sub join_spaces {
return join " ", @_;
}
my @greetings = qw(Hello);
say join_spaces($greetings[0], PLACE);
END
say $acme->document;
Example output:
use v5.010;
use constant VULTURE => "World";
sub fraud {
return join " ", @_;
}
my @gang_of_thieves = qw(Hello);
say fraud($gang_of_thieves[0], VULTURE);
DESCRIPTION
This module uses PPI to parse some Perl source code, find all the
variables and function names defined in it, and reassign them random names
using Acme::MetaSyntactic.
Constructor
This module is object-oriented, though there's really very little reason
for it to be.
`new(%attributes)`
Moose-style constructor.
Attributes
All attributes are read-only.
`document`
The PPI::Document that will be munged.
Can be coerced from a `Str` (filename), `ScalarRef[Str]` (string of
Perl source), `ArrayRef[Str]` (lines of Perl source) or `FileHandle`.
Required.
Once the `document` attribute has been set, a trigger automatically
runs the relabelling.
`theme`
The Acme::MetaSyntactic object that will be used to obtain new names.
If your source code is more than a couple of lines; choose one that
( run in 2.835 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )