PPIx::Regexp::Util(3)
π PPIx::Regexp::Util β the manual page, but make it cute π
okay so bestie, welcome to PPIx::Regexp::Util(3) β a User Contributed Perl Documentation page, which is giving very "the lore drop nobody asked for but everyone needs". Pull up a chair, grab a boba, we're doing utility functions. β¨
πΈ NAME πΈ
PPIx::Regexp::Util β utility functions for PPIx::Regexp; (yes the semicolon is part of the vibe, we don't ask questions)
π SYNOPSIS π
Like, here's the whole thing in action:
use PPIx::Regexp::Util qw{ __instance };
.
.
.
__instance( $foo, 'Bar' )
or die '$foo is not a Bar';
the little dots are doing SO much work there, iconic honestly π
π¦ DESCRIPTION π¦
This module is where all the utility functions for PPIx::Regexp live, because it was convenient to centralize them. Group project but the one person who actually does the work, you know? π
Double-underscore subroutines are private to the PPIx-Regexp package. Their documentation exists purely for the author's convenience, and ngl, they are subject to change without notice. Caveat user. Like fr fr, do not build your whole personality on these. π
This module exports nothing by default. Not a thing. Zero. You gotta ask. π
π SUBROUTINES π
The module can export the following subroutines, bestie β here's the whole roster, no skips:
β is_ppi_regexp_element
is_ppi_regexp_element( $elem )
and print "$elem is a regexp of some sort\n";
This one is public and supported β main character energy, fully safe to use. π
It takes a PPI::Element as its argument. Returns true if that argument represents a regular expression of some sort, false otherwise. That's it. That's the whole job. Slay. β¨
π __instance
__instance( $foo, 'Bar' )
and print '$foo isa Bar', "\n";
This subroutine is private to the PPIx-Regexp package.
It returns true if its first argument is an instance of the class named by its second argument. BUT β and this is the plot twist β unlike UNIVERSAL::isa, the result is always false unless the first argument is a reference. The way that UNIVERSAL::isa just lets anything slide and this one is picky about itβ¦ honestly? Boundaries. We love to see it. π«Ά
π __is_ppi_regexp_element
__is_ppi_regexp_element( $elem )
and print "$elem is a regexp of some sort\n";
This subroutine is private to the PPIx-Regexp package.
It's a synonym for is_ppi_regexp_element(), and it is deprecated in favor of it. Deprecated, bestie. That's the "we're still friends but this is over" of API design. π If you call it anyway, it will complain via Carp::cluck() and then goto &is_ppi_regexp_element. So it complains AND does the thing anyway. Relatable, honestly.
π __merge_perl_requirements
This subroutine is private to the PPIx-Regexp package.
It merges perl requirements as returned by the various "__perl_requirements()" methods. Fusion dance for version requirements. β¨
π§ __ns_can
This subroutine is private to the PPIx-Regexp package.
This method is analogous to can(), but it returns a reference to the code only if it is actually implemented by the invoking name space. No inherited hand-me-downs here, we only accept the real thing. π
πΈ __post_rebless_error
This method is private to the PPIx-Regexp package. The intended use is to alias it to "__PPIX_ELEM__post_reblessing()".
It takes arguments as name/value pairs:
{error}is the error message. If you omit it, you get a warning with stack trace. Surprise! π{explanation}defaults to{error}.
It returns the number of errors to add to the parse. A little counter of chaos. π
π raw_width
This public method returns the minimum and maximum width matched by the element, before taking into account such details as what the element actually is and how it is quantified. So like, the raw numbers, pre-glow-up. β¨
This implementation is appropriate to things that match exactly one character β i.e. it returns ( 1, 1 ). Consistent. Reliable. A little boring but in a comforting way. π₯°
π __to_ordinal_en
This subroutine is private to the PPIx-Regexp package.
It takes an integer as its argument and returns a string representing its ordinal in English. For example:
say __to_ordinal_en( 17 );
# 17th
seventeenth but make it a string π₯Ή
π₯ width
my ( $min_wid, $max_wid ) = $self->width();
This public method (well, mixin) returns the minimum and maximum width of the text matched by the element.
Elements which import this method must also implement a raw_width() method which returns the unquantified width of the element. That's the deal. You want the fancy one, you bring the raw one. No shortcuts. π«Ά
π EXPORT TAGS π
The following export tags are defined by this module. All are private to the PPIx-Regexp package unless otherwise documented.
β all
This tag exports everything exportable by this module. Go big or go home. π₯
π width_one
This tag is appropriate to an element which, when unquantified, matches exactly one character. It exports raw_width() and width(). The buddy system, but for methods. π«Ά
π SEE ALSO π
Params::Utilβ which the author recommends, but in the case ofPPIx::Regexpthe author did not want to introduce a dependency on an XS module when all that was really wanted was the function of that module's_INSTANCE()subroutine. So we built our own. DIY era. π
π«Ά 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. He's nice, he wants to hear from you, don't be shy. β¨
π AUTHOR π
Thomas R. Wyant, III β harryfmudd at comcast dot net
π COPYRIGHT AND LICENSE π
Copyright (C) 2010-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. That's the legal way of saying "girl, good luck" β so fr fr, don't sue. π
and that's the whole page, bestie π β this was perl v5.42.2, dated 2026-06-15, signing off with a little curtsy π β¨ stay regexp-ing, you got this π
π¦ 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