1PPIx::EditorTools::RenaUmseePracCkoangter(i3b)uted PerlPDPoIcxu:m:eEndtiattoiroTnools::RenamePackage(3)
2
3
4
6 PPIx::EditorTools::RenamePackage - Change the package name
7
9 version 0.21
10
12 my $munged = PPIx::EditorTools::RenamePackage->new->rename(
13 code => <<'END_CODE',
14 package TestPackage;
15 use strict;
16
17 BEGIN { $^W = 1; }
18 1;
19 END_CODE
20 replacement => 'NewPackage'
21 );
22
23 my $new_code_as_string = $munged->code;
24 my $package_ppi_element = $munged->element;
25
27 This module uses PPI to change the package name of code.
28
30 new()
31 Constructor. Generally shouldn't be called with any arguments.
32
33 rename( ppi => PPI::Document $ppi, replacement => Str )
34 rename( code => Str $code, replacement => Str )
35 Accepts either a "PPI::Document" to process or a string containing
36 the code (which will be converted into a "PPI::Document") to
37 process. Replaces the package name with that supplied in the
38 "replacement" parameter and returns a
39 "PPIx::EditorTools::ReturnObject" with the new code available via
40 the "ppi" or "code" accessors, as a "PPI::Document" or "string",
41 respectively.
42
43 Croaks with a "package name not found" exception if unable to find
44 the package name.
45
47 This class inherits from "PPIx::EditorTools". Also see
48 App::EditorTools, Padre, and PPI.
49
51 • Steffen Mueller "smueller@cpan.org"
52
53 • Mark Grimes "mgrimes@cpan.org"
54
55 • Ahmad M. Zawawi <ahmad.zawawi@gmail.com>
56
57 • Gabor Szabo <gabor@szabgab.com>
58
59 • Yanick Champoux <yanick@cpan.org>
60
62 This software is copyright (c) 2017, 2014, 2012 by The Padre
63 development team as listed in Padre.pm..
64
65 This is free software; you can redistribute it and/or modify it under
66 the same terms as the Perl 5 programming language system itself.
67
68
69
70perl v5.36.0 2022-07-22PPIx::EditorTools::RenamePackage(3)