The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

Data::Validation::Filters - Filter data values

Synopsis

   use Data::Validation::Filters;

   %config = ( method => $method, %{ $self->filters->{ $id } || {} } );

   $filter_ref = Data::Validation::Filters->new_from_method( %config );

   $value = $filter_ref->filter_value( $value );

Description

Applies a single filter to a data value and returns it's possibly changed value

Configuration and Environment

Defines the following attributes:

method

Name of the constraint to apply. Required

pattern

Used by "isMathchingRegex" as the pattern to match the supplied value against

replace

The replacement value used in regular expression search and replace operations

Subroutines/Methods

new_from_method

A class method which implements a factory pattern using the method attribute to select the subclass

filter

Calls either a builtin method or an external one to filter the data value

filterEscapeHTML

Replaces &<>" with their &xxx; equivalents

filterLowerCase

Lower cases the data value

filterNonNumeric

Removes all non numeric characters

filterReplaceRegex

Matches the regular expression pattern and substitutes the replace string

filterTitleCase

Like "filterUCFirst" but applied to every word in the string

filterTrimBoth

Remove all leading and trailing whitespace

filterUpperCase

Upper cases the data value

filterUCFirst

Upper cases the first character of the data value

filterWhiteSpace

Removes all whitespace

filterZeroLength

Returns undef if value is zero length

Diagnostics

None

Dependencies

Moo
Unexpected

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

There are no known bugs in this module. Please report problems to http://rt.cpan.org/NoAuth/Bugs.html?Dist=Data-Validation. Patches are welcome

Acknowledgements

Larry Wall - For the Perl programming language

Author

Peter Flanigan, <pjfl@cpan.org>

License and Copyright

Copyright (c) 2016 Peter Flanigan. All rights reserved

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

This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE