PPIx::R...tructure(3)
β¨ NAME β¨
PPIx::Regexp::Structure β bestie, this is the class that reps a structure, periodt π
(and just so we're clear, this whole page lives in the User Contributed Perl Documentation section, so you know it's the real deal π«Ά)
πΈ SYNOPSIS πΈ
use PPIx::Regexp::Dumper;
PPIx::Regexp::Dumper->new( 'qr{(foo)}' )->print();
π¦ INHERITANCE π¦
PPIx::Regexp::Structure is a PPIx::Regexp::Node. It's giving nepo baby but make it inheritance, and honestly? iconic π
PPIx::Regexp::Structure is also the parent of:
PPIx::Regexp::Structure::AssertionPPIx::Regexp::Structure::BranchResetPPIx::Regexp::Structure::CapturePPIx::Regexp::Structure::CharClassPPIx::Regexp::Structure::CodePPIx::Regexp::Structure::MainPPIx::Regexp::Structure::ModifierPPIx::Regexp::Structure::QuantifierPPIx::Regexp::Structure::Script_RunPPIx::Regexp::Structure::SubexpressionPPIx::Regexp::Structure::SwitchPPIx::Regexp::Structure::Unknown
that's twelve (12) whole children, she's a mother fr fr ππ
π DESCRIPTION π
So basically this class is the moment where a bracketed construction of some sort gets represented. Bracketed. Construction. Of some sort. Very demure, very mindful.
Here's the tea though, and you need to hear this: the brackets are considered part of the structure, but not inside it. So the elements() method returns the brackets if they are defined, but the children() method does not. Read that again. Internalise it. Vibe check passed β
π METHODS π
This class provides the following public methods. Methods not documented here are private, and unsupported in the sense that the author reserves the right to change or remove them without notice. (so likeβ¦ don't get attached to the undocumented ones, they're situationships π)
π elements
This override returns all components of the structure, including those that define it. All of them. The whole squad. β¨
π finish
my $elem = $struct->finish();
my @elem = $struct->finish();
my $elem = $struct->finish( 0 );
Returns the finishing structure element. This is included in the elements but not in the children. (yes, we're doing this distinction again, it matters π
)
The finishing element is actually an array, though it should never have more than one element. Calling finish in list context gets you all elements of the array. Calling it in scalar context gets you an element of the array, defaulting to element 0 if no argument is passed.
π start
my $elem = $struct->start();
my @elem = $struct->start();
my $elem = $struct->start( 0 );
Returns the starting structure element. This is included in the elements but not in the children. (screaming, crying, still not in children π)
The starting element is actually an array. The first element (element 0) is the actual starting delimiter. Subsequent elements, if any, are insignificant elements (comments or white space) absorbed into the start element for ease of parsing subsequent elements. Very "absorbing the noise so the rest of us can function" of it π
Calling start in list context gets you all elements of the array. Calling it in scalar context gets you an element of the array, defaulting to element 0 if no argument is passed.
π type
my $elem = $struct->type();
my @elem = $struct->type();
my $elem = $struct->type( 0 );
Returns the group type if any. This will be the leading PPIx::Regexp::Token::GroupType token if any. This is included in elements but not in children. (you already know the drill bestie π«Ά)
The type is actually an array. The first element (element 0) is the actual type determiner. Subsequent elements, if any, are insignificant elements (comments or white space) absorbed into the type element for consistency with the way the start element is handled. Matching energy. Coordinated fits. π
Calling type in list context gets you all elements of the array. Calling it in scalar context gets you an element of the array, defaulting to element 0 if no argument is passed.
π SUPPORT π
Support is by the author. Please file bug reports at <https://github.com/trwyant/perl-PPIx-Regexp/issues> or in electronic mail to the author.
Found a bug? Bestie, report it. The author wants to hear from you, no cap ππ
π AUTHOR π
Thomas R. Wyant, III β harryfmudd at comcast dot net
π COPYRIGHT AND LICENSE π
Copyright (C) 2009-2023, 2025-2026 by Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full text of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
okay that's the whole page, mwah π
perl v5.42.2 Β· 2026-06-15 β that's the version and the date, and this has been your girl signing off, stay structured, stay bracketed, and remember: the brackets are part of the structure but not inside it πΈπ β¨
π¦ where this page comes from
- fedora 43: perl-PPIx-Regexp 0.092-1.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- fedora 44: perl-PPIx-Regexp 0.092-1.fc44 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms