PPIx::R...ference(3)
β¨ NAME β¨
PPIx::Regexp::Token::Reference β the lil guy that represents a reference to a capture π
Like, not the capture itself bestie, just the pointing at it part. So important. So iconic.
πΈ SYNOPSIS πΈ
use PPIx::Regexp::Dumper;
PPIx::Regexp::Dumper->new( 'qr{\1}smx' )
->print();
okay so you just load the dumper, hand it a regex with \1 in it, and it prints the whole token breakdown for you. chef's kiss π
π¦ INHERITANCE π¦
PPIx::Regexp::Token::Reference is a PPIx::Regexp::Token. it's giving "child of Token, minding its own business" β¨
and it's also a parent its own self, of these three absolute queens:
PPIx::Regexp::Token::BackreferencePPIx::Regexp::Token::ConditionPPIx::Regexp::Token::Recursion
a whole family tree. generational excellence fr fr π
π DESCRIPTION π
So this is an abstract class β it represents a reference to a capture buffer, and that capture buffer can be either numbered or named. Both. Versatile.
π¨ IMPORTANT: It should never be instantiated. Like, do not do that. It's not for you to instantiate, bestie, it's a base class. But it does hand a bunch of methods down to its subclasses, which is the whole point. π«Ά
β METHODS β
This class provides the following public methods. Anything not documented here is private, and unsupported in the sense that the author reserves the right to change or remove them without notice. So don't get attached to the undocumented ones. π
π absolute
print "The absolute reference is ", $ref->absolute(), "\n";
Returns the absolute number of the capture buffer being referred to. For unsigned numeric references this is literally the same thing as number(). And if the reference is to a named buffer? You get undef. sorry babe π
π§ is_named
$ref->is_named and print "named reference\n";
Returns true if the reference is named rather than numbered. That's it. That's the whole method. slay β¨
π is_relative
$ref->is_relative()
and print "relative numbered reference\n";
Returns true if the reference is numbered and it's a relative number β i.e. if it's signed. iykyk π₯
π is_matcher
This one returns a true value because, and I quote the vibe here, although we do not actually perform an analysis on the referred-to entity, we presume it matches something. so likeβ¦ it's a matcher by assumption. manifesting, if you will π
πΈ name
print "The name is ", $ref->name(), "\n";
Returns the name of the capture buffer being referred to. But if it's a reference to a numbered capture β i.e. is_named returns false β this method gives you undef. no name, no problem π
π number
print "The number is ", $ref->number(), "\n";
Returns the number of the capture buffer being referred to. And if it's a reference to a named capture β i.e. is_named returns true β this method returns undef. flip side of name, periodt π¦
π«Ά 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. they want to hear from you, fr fr π
π 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.
and that's the whole page bestie!! π this was perl v5.42.2, dated 2026-06-15, from the User Contributed Perl Documentation collection. go forth and reference your captures responsibly β¨πΈπ
π¦ 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