|
NAMEPPIx::EditorTools::IntroduceTemporaryVariable - Introduces a temporary variable using PPI VERSIONversion 0.21 SYNOPSIS my $munged = PPIx::EditorTools::IntroduceTemporaryVariable->new->introduce(
code => "use strict; BEGIN {
$^W = 1;
}\n\tmy $x = ( 1 + 10 / 12 ) * 2;\n\tmy $y = ( 3 + 10 / 12 ) * 2;\n",
start_location => [ 2, 19 ],
end_location => [ 2, 25 ],
varname => '$foo',
);
my $modified_code_as_string = $munged->code;
my $location_of_new_var_declaration = $munged->element->location;
DESCRIPTIONGiven a region of code within a statement, replaces all occurrences of that code with a temporary variable. Declares and initializes the temporary variable right above the statement that included the selected expression. METHODS
SEE ALSOThis class inherits from "PPIx::EditorTools". Also see App::EditorTools, Padre, and PPI. AUTHORS
COPYRIGHT AND LICENSEThis software is copyright (c) 2017, 2014, 2012 by The Padre development team as listed in Padre.pm.. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
|