PPIx::...ackage(3pm)
π PPIx::EditorTools::RenamePackage β change the package name π
okay bestie, welcome to the PPIx::...ackage page, from the User Contributed Perl Documentation corner of the manual universe π¦ this one is PPIx::EditorTools::RenamePackage and it does exactly one thing but it does it so well, no cap.
β¨ NAME β¨
PPIx::EditorTools::RenamePackage β change the package name π
πΈ VERSION πΈ
version 0.21
π SYNOPSIS π
my $munged = PPIx::EditorTools::RenamePackage->new->rename(
code => <<'END_CODE',
package TestPackage;
use strict;
BEGIN { $^W = 1; }
1;
END_CODE
replacement => 'NewPackage'
);
my $new_code_as_string = $munged->code;
my $package_ppi_element = $munged->element;
like. look at her. she's glowing β¨
π¦ DESCRIPTION π¦
This module uses PPI to change the package name of code. that's the whole vibe. it reads your code, it finds the package name, it swaps it out. iconic behaviour fr fr π
π METHODS π
new()
Constructor. Generally shouldn't be called with any arguments. like, she's lowkey self-sufficient, just let her cook π
rename( ppi => PPI::Document $ppi, replacement => Str )
rename( code => Str $code, replacement => Str )
She accepts either a PPI::Document to process or a string containing the code (which will be converted into a PPI::Document) to process. So you can hand her the fancy object or just yeet her a string, both are valid, she's flexible like that π§
She replaces the package name with whatever you supplied in the replacement parameter, and returns a PPIx::EditorTools::ReturnObject with the new code available via the ppi or code accessors β as a PPI::Document or a string, respectively. pick your fighter π
β οΈ She croaks with a package name not found exception if she's unable to find the package name. so like, if there's no package in there? she WILL be dramatic about it. that's the deal. π
π SEE ALSO π
This class inherits from PPIx::EditorTools. Also peep App::EditorTools, Padre, and PPI β the whole friend group honestly π«Ά
π AUTHORS π
- Steffen Mueller
smueller@cpan.org - Mark Grimes
mgrimes@cpan.org - Ahmad M. Zawawi <ahmad.zawawi@gmail.com>
- Gabor Szabo <gabor@szabgab.com>
- Yanick Champoux <yanick@cpan.org>`
the collective. the squad. the main characters β¨
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2017, 2014, 2012 by The Padre development team as listed in Padre.pm.. (yes bestie there are two periods, that's canon, don't @ me π)
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, legally speaking π
and that's the page!! this little cutie came to you courtesy of perl v5.34.0 on 2022-06-17, and honestly? she ate. periodt. πβ¨
π¦ where this page comes from
- debian bookworm: libppix-editortools-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libppix-editortools-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libppix-editortools-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libppix-editortools-perl 0.21-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms