---
name: "Badger::Data::Facet::Text::Whitespace"
section: "3pm"
platform: "linux"
package: "libbadger-perl"
version: "0.16-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Badger::Data::Facet::Text::Whitespace"
---

# Badger::Data::Facet::Text::Whitespace(3pm)

validation facet for whitespace

## NAME

Badger::Data::Facet::Text::Whitespace - validation facet for whitespace

## DESCRIPTION

This module implements a validation facets for munging whitespace on text values.

## METHODS

This module implement the following methods in addition to those inherited from the Badger::Data::Facet::Text, Badger::Data::Facet and Badger::Base base classes.

### validate($text\_ref, $type)

This method performs whitespace handling on the text passed by reference as the first argument.

If the pre-defined `"action"` is `"preserve"` then the text will be unmodified.

If the `"action"` is `"fold"` then all whitespace characters in the text (carriage returns, newlines, tabs) will be converted to spaces.

If the `"action"` is `"collapse"` then all whitespace characters will first be converted to spaces as per `"fold"`.  Any leading and trailing whitespace is then removed and any sequences of multiple spaces are collapsed to a single space.

## AUTHOR

Andy Wardley \<http://wardley.org/\>

## 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

Badger::Base, Badger::Data::Facet, Badger::Data::Facet::Text.
