
Data::Verifier::Filters - Filters for values

version 0.56

use Data::Verifier;
my $dv = Data::Verifier->new(profile => {
name => {
type => 'Str',
filters => [ qw(collapse trim) ]
}
});
$dv->verify({ name => ' foo bar '});
$dv->get_value('name'); # 'foo bar'

Adding a custom filter may be done by providing a coderef as one of the filters:
# Remove all whitespace
my $sub = sub { my ($val) = @_; $val =~ s/\s//g; $val }
$dv->verify({
name => {
type => 'Str'
filters => [ $sub ]
}
});
$dv->get_value('name'); # No whitespace!

Collapses all consecutive whitespace into a single space
Removes all whitespace.
Converts the value to lowercase.
Removes leading and trailing whitespace
Converts the value to uppercase.

Cory G Watson <gphat@cpan.org>

This software is copyright (c) 2013 by Cold Hard Code, LLC.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.