PPIx::R...en::Code(3)
π NAME π
PPIx::Regexp::Token::Code β the class that reps a lil chunk of Perl code snuggled up inside a regular expression. π«Ά
β¨ SYNOPSIS β¨
use PPIx::Regexp::Dumper;
PPIx::Regexp::Dumper->new(
'qr{(?{print "hello sailor\n"})}smx')->print;
πΈ INHERITANCE πΈ
PPIx::Regexp::Token::Code is a PPIx::Regexp::Token. It's giving "yes, that's the family tree, bestie." π³
And PPIx::Regexp::Token::Code is the parent of PPIx::Regexp::Token::Interpolation β so it's a mom too. π
π¦ DESCRIPTION π¦
Okay so this class is the vibe for a chunk of Perl code that's been embedded inside a regular expression. Specifically? It shows up when you parse stuff like
(?{ code })
(??{ code })
or when you're on the replacement side of an s///e. π₯
Technically, interpolations are also code, but they parse differently, so they end up in a whole different token. Different token, different era, iykyk. π
β οΈ This token may not appear inside a regex set (i.e.(?[ ... ]). If it does get found there, it becomes aPPIx::Regexp::Token::Unknown. So don't do that. π«
π METHODS π
This class provides the following public methods. Methods that aren't 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. π)
π is_matcher
This method returns undef because a static analysis can not in general tell whether an interpolated value matches anything. It literally cannot know. Mystery is the whole point. β¨
π ppi
This convenience method returns the PPI::Document representing the content. This document should be considered read only. π«βοΈ
Note that if the location of the invocant is available, the PPI document will have stuff prefixed to it to make the location of the tokens in the new document consistent with the location. This "stuff" will include at least a #line directive, and maybe leading white space. That's it, that's the stuff. π
π«Ά 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 wants the bug reports, 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. (No promises, bestie, that's the deal. π)
And that's a wrap!! π This gem of a page came out of perl v5.42.2, dated 2026-06-15, and it lives in the User Contributed Perl Documentation corner of the manual. Slay, go write some regex code blocks. πβ¨π¦
π¦ 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