The Perl and Raku Conference 2025: Greenville, South Carolina - June 27-29 Learn more

NAME

Data::Type::Filter - cleans values before normally subjecting to facets

SYNOPSIS

...
sub _filters : method
{
return ( [ 'strip', '\s' ], [ 'chomp' ], [ 'lc' ] )
}

EXAMPLE

package Data::Type::Filter::chomp;
our @ISA = ( 'Data::Type::Filter::Interface' );
our $VERSION = '0.01.25';
sub desc : method { 'chomps' }
sub info : method { 'chomps' }
sub filter : method
{
my $this = shift;
chomp $Data::Type::value;
}

FILTERS

Data::Type::Filter::chomp

Chomps (as perl chomp()).

Data::Type::Filter::lc

Lower cases (as perl lc()).

Data::Type::Filter::uc

Upper cases (as perl uc()).

Data::Type::Filter::strip( what )

A simple s/what// operation as

$Data::Type::value =~ s/$what//go;

Data::Type::Filter::collapse( what )

Collapses any arbitrary repeats of what to a single.

CONTACT

Sourceforge http://sf.net/projects/datatype is hosting a project dedicated to this module. And I enjoy receiving your comments/suggestion/reports also via http://rt.cpan.org or http://testers.cpan.org.

AUTHOR

Murat Uenalan, <muenalan@cpan.org>