Badger...tespace(3pm)
π Badger::Data::Facet::Text::Whitespace π
okay bestie so this is a 3pm page, meaning it's User Contributed Perl Documentation, and it's literally called Badger::Data::Facet::Text::Whitespace β say that five times fast, I dare you π«Ά
β¨ NAME β¨
Badger::Data::Facet::Text::Whitespace β a validation facet for whitespace. yes really, that's the whole job. and it slays at it. π
πΈ DESCRIPTION πΈ
So this module implements a validation facet β but for munging whitespace on text values. not validating your outfit, validating your spaces. iconic behaviour honestly. β¨
π¦ METHODS π¦
This module implements the following methods in addition to those it inherits from the base classes:
Badger::Data::Facet::TextBadger::Data::FacetBadger::Base
like it's got its own moves but it also got the family inheritance, periodt. π
π validate($text_ref, $type) π
This one does the whitespace handling on the text you pass in by reference as the first argument. (yes, by reference, don't @ me, that's just how it is bestie π)
Here's the vibe check on what happens, depending on the pre-defined "action":
"preserve"β the text is left unmodified. untouched. pristine. main character energy, no notes. π"fold"β all whitespace characters in the text (that's carriage returns, newlines, tabs) get converted to spaces. every single one. folded like laundry. π§Ί"collapse"β okay so first it does everything"fold"does (all whitespace β spaces), and then it removes any leading and trailing whitespace, and then it collapses any sequences of multiple spaces down to a single space. glow-up complete. β¨π¦
ngl, "collapse" is doing the absolute most and I respect it.
π AUTHOR π
Andy Wardley <http://wardley.org/> β thank you for your service, king π«Ά
π COPYRIGHT π
Copyright (C) 2001-2012 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
π SEE ALSO π
go read these next, bestie, they're the whole friend group:
Badger::BaseBadger::Data::FacetBadger::Data::Facet::Text
perl v5.36.0 Β· 2023-08-28 β that's the version and the date this page was born, and that's a wrap fr fr π β¨ π π¦
π¦ where this page comes from
- debian trixie: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms