1PPIx::EditorTools::RenaUmseePracCkoangter(i3b)uted PerlPDPoIcxu:m:eEndtiattoiroTnools::RenamePackage(3)
2
3
4

NAME

6       PPIx::EditorTools::RenamePackage - Change the package name
7

SYNOPSIS

9           my $munged = PPIx::EditorTools::RenamePackage->new->rename(
10               code        => "package TestPackage;\nuse strict;\nBEGIN {
11               $^W = 1;
12       }\n1;\n",
13               replacement => 'NewPackage'
14           );
15
16           my $new_code_as_string = $munged->code;
17           my $package_ppi_element = $munged->element;
18

DESCRIPTION

20       This module uses PPI to change the package name of code.
21

METHODS

23       new()
24           Constructor. Generally shouldn't be called with any arguments.
25
26       rename( ppi => PPI::Document $ppi, replacement => Str ) =item rename(
27       code => Str $code, replacement => Str )
28           Accepts either a "PPI::Document" to process or a string containing
29           the code (which will be converted into a "PPI::Document") to
30           process.  Replaces the package name with that supplied in the
31           "replacement" parameter and returns a
32           "PPIx::EditorTools::ReturnObject" with the new code available via
33           the "ppi" or "code" accessors, as a "PPI::Document" or "string",
34           respectively.
35
36           Croaks with a "package name not found" exception if unable to find
37           the package name.
38

SEE ALSO

40       This class inherits from "PPIx::EditorTools".  Also see
41       App::EditorTools, Padre, and PPI.
42

AUTHOR

44       Mark Grimes, <mgrimes@cpan.org>
45
47       Copyright (C) 2009 by Mark Grimes
48
49       This library is free software; you can redistribute it and/or modify it
50       under the same terms as Perl itself, either Perl version 5.8.2 or, at
51       your option, any later version of Perl 5 you may have available.
52
53
54
55perl v5.12.0                      2009-09-19PPIx::EditorTools::RenamePackage(3)
Impressum