PPIx::...s::Node(3pm)
π NAME π
PPIx::Utilities::Node β it's literally Extensions to PPI::Node, bestie. That's the whole vibe. (iykyk, the manpage calls itself PPIx::...s::Node at the top which is just the header being extra and truncating, the real name is right here π
)
β¨ VERSION β¨
This doc describes PPIx::Utilities::Node version 1.1.0. Write it down, she's specific π
π¦ SYNOPSIS π¦
use PPIx::Utilities::Node qw< split_ppi_node_by_namespace >;
my $dom = PPI::Document->new("...");
while (
my ($namespace, $sub_doms) = each split_ppi_node_by_namespace($dom)
) {
foreach my $sub_dom ( @{$sub_doms} ) {
...
}
}
okay so that's the whole mood right there π you pull in one function, you feed it a PPI::Document, and you just... vibe through the namespaces one at a time. slay.
πΈ DESCRIPTION πΈ
It's giving a collection of functions for dealing with PPI::Nodes. That's it, that's the description, no notes π
π INTERFACE π
Nothing is exported by default. Not one thing. You have to ask for what you want, main character energy only.
π§ split_ppi_node_by_namespace($node)
Returns the sub-trees for each namespace in the node as a reference to a hash of references to arrays of PPI::Nodes. Yes, a hash of arrayrefs. She's layered. π«Ά
So say we've got this code:
#!perl
my $x = blah();
package Foo;
my $y = blah_blah();
{
say 'Whee!';
package Bar;
something();
}
thingy();
package Baz;
da_da_da();
package Foo;
foreach ( blrfl() ) {
...
}
Calling this function on a PPI::Document for the above returns a value that looks like this β and bestie, heads up, they use multi-line string literals for the actual code parts instead of PPI trees, just to make this easier to read π:
{
main => [
q<
#!perl
my $x = blah();
>,
],
Foo => [
q<
package Foo;
my $y = blah_blah();
{
say 'Whee!';
}
thingy();
>,
q<
package Foo;
foreach ( blrfl() ) {
...
}
>,
],
Bar => [
q<
package Bar;
something();
>,
],
Baz => [
q<
package Baz;
da_da_da();
>,
],
}
β οΈ IMPORTANT ONE, don't skip it: note that the return value contains copies of the original nodes, and not the original nodes themselves, due to the need to handle namespaces that are not file-scoped. (Notice how the first element for "Foo" above differs from the original code. She moved out and got her own apartment. π )
π BUGS AND LIMITATIONS π
Please report any bugs or feature requests to "bug-ppix-utilities@rt.cpan.org", or through the web interface at <http://rt.cpan.org>. Do it, the maintainers wanna hear from you fr fr π
π AUTHOR π
Elliot Shank "<perl@galumph.com>" β legend behavior, honestly. π«‘
π COPYRIGHT π
Copyright (c)2009-2010, Elliot Shank "<perl@galumph.com>".
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of this license can be found in the LICENSE file included with this module. π
and that's the page bestie!! she was generated by perl v5.36.0 on 2022-11-27, and yes the footer also calls her PPIx::...s::Node(3pm) because the header and footer are both committed to the bit β¨π¦π periodt.
π¦ where this page comes from
- debian bookworm: libppix-utilities-perl 1.001000-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libppix-utilities-perl 1.001000-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libppix-utilities-perl 1.001000-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libppix-utilities-perl 1.001000-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libppix-utilities-perl 1.001000-4 Β· 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