PPI::Do...rmalized(3)

πŸ’– NAME πŸ’–

PPI::Document::Normalized β€” it's giving a normalized Perl Document ✨ bestie, that's literally the whole vibe


🌸 DESCRIPTION 🌸

okay so, a "Normalized Document" object? it's the whole result of the normalization process that lives inside the PPI::Normal class. if you want the full tea, go read the docs for PPI::Normal, because that's where the actual lore is 🫢

this object is holding onto a version stamp and a function list for whichever version of PPI::Normal made it, plus a processed and delinked PPI::Document object. iconic, honestly.

so here's the thing bestie. typically the Document object has been mangled by the normalization process in a way that would make it fatal to try to actually DO anything with it 😭

put simply: never use the Document object after normalization. YOU HAVE BEEN WARNED! πŸ’€

the object is designed this way on purpose β€” it's biased towards false negatives. a comparison between two ::Normalized objects only comes back true if they were produced by the same version of PPI::Normal, with the same set of normalization functions (in the same order). no wiggle room, no exceptions, periodt πŸ‘‘

which means yeah, you may get false negatives if you're caching objects across an upgrade πŸ™ˆ

and bestie, please note this is done for security purposes! there are so many cases where low layer normalization is likely to be done as part of a code security process, and false positives could be highly dangerous. so like… the strictness is the point πŸ’…

✨ METHODS ✨

πŸŽ€ new

the new method is intended for use only by the PPI::Normal class. so if you want ::Normalized objects, you are highly recommended to use either that module, or the normalized method of the PPI::Document object itself. don't be out here calling new directly, that's not the move 🫢

πŸ¦‹ version

the version accessor returns the PPI::Normal version used to create the object. simple, clean, slay ✨

🌈 functions

the functions accessor returns a reference to an array of the normalization functions (in order!) that were called when creating the object. yes, in order β€” that ordering matters, iykyk πŸ’…

πŸ‘‘ equal $Normalized

the equal method is the primary comparison method. you hand it another PPI::Document::Normalized object and it checks for equivalence to it.

the == operator is also overloaded to this method, so you can do something like the following:

my $first  = PPI::Document->load('first.pl');
my $second = PPI::Document->load('second.pl');

if ( $first->normalized == $second->normalized ) {
      print "The two documents are equivalent";
}

returns true if the normalized documents are equivalent, false if not, or undef if there is an error. three possible outcomes bestie, stay woke 🌸


🫢 SUPPORT 🫢

see the support section in the main module. that's where the help lives πŸ’–


🌟 AUTHOR 🌟

Adam Kennedy <adamk@cpan.org> πŸŽ€


Copyright 2005 - 2011 Adam Kennedy.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

The full text of the license can be found in the LICENSE file included with this module.


and that's a wrap on the PPI::Document::Normalized page, bestie πŸ’…βœ¨ this lil doc came from perl v5.42.0, dated 2026-01-17 β€” no cap, go forth and normalize responsibly πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from