1PPIx::EditorTools::RenaUmseePracCkoangterFirboumtPPePadItxhP:(e:3rE)ldiDtoocruTmoeonltsa:t:iRoennamePackageFromPath(3)
2
3
4

NAME

6       PPIx::EditorTools::RenamePackageFromPath - Change the package name
7       based on the files path
8

SYNOPSIS

10           my $munged = PPIx::EditorTools::RenamePackageFromPath->new->rename(
11               code        => "package TestPackage;\nuse strict;\nBEGIN {
12               $^W = 1;
13       }\n1;\n",
14               filename => './lib/Test/Code/Path.pm',
15           );
16
17           my $new_code_as_string = $munged->code;
18           my $package_ppi_element = $munged->element;
19

DESCRIPTION

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

METHODS

24       new()
25           Constructor. Generally shouldn't be called with any arguments.
26
27       rename( ppi => PPI::Document $ppi, filename => Str ) =item rename( code
28       => Str $code, filename => Str )
29           Accepts either a "PPI::Document" to process or a string containing
30           the code (which will be converted into a "PPI::Document") to
31           process.  Replaces the package name with that supplied in the
32           "filename" parameter and returns a
33           "PPIx::EditorTools::ReturnObject" with the new code available via
34           the "ppi" or "code" accessors, as a "PPI::Document" or "string",
35           respectively.
36
37           An attempt will be made to derive the package name from the
38           filename passed as a parameter.  The filename's path will converted
39           to an absolute path and it will be searched for a "lib" directory
40           which will be assumed the start of the package name. If no "lib"
41           directory can be found in the absolute path, the relative path will
42           be used.
43
44           Croaks with a "package name not found" exception if unable to find
45           the package name.
46

SEE ALSO

48       This class inherits from "PPIx::EditorTools".  Also see
49       App::EditorTools, Padre, and PPI.
50

AUTHOR

52       Mark Grimes, <mgrimes@cpan.org>
53
55       Copyright (C) 2009 by Mark Grimes
56
57       This library is free software; you can redistribute it and/or modify it
58       under the same terms as Perl itself, either Perl version 5.8.2 or, at
59       your option, any later version of Perl 5 you may have available.
60
61
62
63perl v5.12.0                      20P0P9I-x0:9:-E1d9itorTools::RenamePackageFromPath(3)
Impressum