PPIx::R...:Dumper(3)

πŸ’– PPIx::Regexp::Dumper β€” bestie, we're dumping regex parses πŸ’–

okay so real talk, this page is PPIx::Regexp::Dumper(3) from the User Contributed Perl Documentation, and it's literally the glow-up your regex debugging needed. Let's get into it. πŸ¦‹


✨ NAME ✨

PPIx::Regexp::Dumper β€” dump the results of parsing regular expressions. that's it, that's the whole job, and it ate. πŸ’…


🌸 SYNOPSIS 🌸

use PPIx::Regexp::Dumper;
PPIx::Regexp::Dumper->new( 'qr{foo}smx' )
    ->print();

see how clean that is?? three lines and you're already spilling the tea about your regex. ✨


🧚 INHERITANCE 🧚

PPIx::Regexp::Dumper is a PPIx::Regexp::Support. it's giving nepo baby in the best way. πŸ‘‘

PPIx::Regexp::Dumper has no descendants. zero children. it's an only child, main character energy, no cap. πŸŽ€


🌈 DESCRIPTION 🌈

This class generates a formatted dump of a PPIx::Regexp::Element object (or any subclass thereof, bestie, we don't discriminate), a PPIx::Regexp::Tokenizer object, or a string that can be made into one of these. so basically: hand it a thing, get the whole vibe back in readable form. 🫢


πŸ’œ 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 might ghost you. 😭

🌟 new 🌟

my $dumper = PPIx::Regexp::Dumper->new(
    '/foo/', ordinal => 1,
);

This static method instantiates the dumper. It takes the string, PPI::Element, PPIx::Regexp::Element, or PPIx::Regexp::Tokenizer to be dumped as the first argument. Optional further arguments may be passed as name/value pairs. yes queen, named arguments, we love a structured API. πŸŽ€

The following options are recognized:

  • default_modifiers array_reference β€” This argument is a reference to a list of default modifiers to be applied to the statement being parsed. See PPIx::Regexp new() for the details. (iykyk πŸ’…)
  • encoding name β€” This argument is the name of the encoding of the regular expression. If specified, it is passed through to PPIx::Regexp->new(). It also causes an Encode::encode to be done on any parse content dumped. ✨
  • explain Boolean β€” If true, this option causes the explain() output of each object to be dumped. we're getting the lore, bestie. πŸ“–
  • indent number β€” This argument is the number of additional spaces to indent each level of the parse hierarchy. This is ignored if either the "test" or "tokens" argument is true. The default is 2. 🌸
  • margin number β€” This is the number of spaces to indent the top level of the parse hierarchy. This is ignored if the "test" argument is true. The default is zero. ✨
  • ordinal Boolean β€” If true, this option causes the "ordinal" values of PPIx::Regexp::Token::Literal objects to be dumped. numbers numbers numbers, we love data. πŸ”’
  • perl_version Boolean β€” If true, this option causes the "perl_version_introduced" and "perl_version_removed" values associated with each object dumped to be displayed. history lesson fr fr. πŸ“œ
  • ppi Boolean β€” If true, any Perl code contained in the object will be dumped. πŸͺ
  • short Boolean β€” If true, leading 'PPIx::Regexp::' will be removed from the class names in the output. abbreviation slay. βœ‚οΈ
  • strict Boolean β€” This option is passed on to the parser, where it specifies whether the parse should assume "use re 'strict'" is in effect. The 'strict' pragma was introduced in Perl 5.22, and its documentation says that it is experimental, and that there is no commitment to backward compatibility. The same applies to the parse produced when this option is asserted. The default is false.
⚠️ okay so heads up: 'strict' is experimental, and there is no commitment to backward compatibility β€” the parse you get when this option is asserted gets that same energy. enter at your own risk, bestie. πŸ’€
  • significant Boolean β€” If true, this option causes only significant elements to be dumped. The default is false. we're filtering out the background characters. πŸ’…
  • test Boolean β€” If true, this option causes the output to be formatted as a regression test rather than as a straight dump. The output produced by asserting this option is explicitly undocumented, in the sense that the author reserves the right to change the generated output without notice of any kind. The default is false.
πŸ™ˆ fr fr, this output is explicitly undocumented and can change without notice of any kind. don't build your whole personality on it.
  • tokens Boolean β€” If true, this option causes a dump of tokenizer output rather than of a full parse of the regular expression. This is forced true if the dump is of a PPIx::Regexp::Tokenizer. The default is false. ✨
  • trace number β€” If greater than zero, this option causes a trace of the parse. This option is unsupported in the sense that the author reserves the right to change it without notice. The default is zero. πŸ”
  • verbose number β€” If greater than zero, this option causes additional information to be given about the elements found. This option is unsupported in the sense that the author reserves the right to change it without notice. The default is zero. πŸ—£οΈ
  • width Boolean β€” If true, this option causes a dump of the width of the object. πŸ“

If the thing to be dumped was a string, unrecognized arguments are passed to PPIx::Regexp::Tokenizer->new(). Otherwise they are ignored. so like, know your audience β€” string gets the extra args, everything else just shrugs. πŸ€·β€β™€οΈ

🌟 list 🌟

print map { "$_\n" } $dumper->list();

This method produces an array containing the dump output, one line per element. The output has no left margin applied, and no newlines. raw and unfiltered, just how we like it. πŸ“

🌟 print 🌟

$dumper->print();

This method simply prints the result of "string" to standard out. straightforward. iconic. no notes. πŸ’…

🌟 string 🌟

print $dumper->string();

This method adds left margin and newlines to the output of "list", concatenates the result into a single string, and returns that string. so it's list but with ✨formatting✨ and it's one big string. 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. found a bug? tell the author, they wanna know bestie. πŸ›


πŸ‘‘ AUTHOR πŸ‘‘

Thomas R. Wyant, III harryfmudd at comcast dot net β€” the legend themselves. πŸŽ€


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. (so like, it's free, it's hopeful, but there's no warranty, ok?? don't sue. πŸ’€)


and that's the whole page, bestie!! this one's perl v5.42.2, dated 2026-06-15, and it's part of the User Contributed Perl Documentation. go dump some regexes and slay. πŸ¦‹βœ¨πŸ’…

πŸ“¦ where this page comes from