NAME

Validator::Custom::Trim - Space triming;

VERSION

Version 0.0503

SYNOPSIS

use Validator::Custom::Trim;

my $data = {
    key1  => ' 123 ',
    key2  => "  \n a \r\n b\nc  \t",
    key3  => '  abc  ',
    key4  => '  def  '
};

my $rule = [
  key1 => [
      ['trim']           # ' 123 ' -> '123'
  ],
  key2  => [
      ['trim_collapse']  # "  \n a \r\n b\nc  \t" -> 'a b c'
  ],
  key3      => [
      ['trim_lead']      # '  abc  ' -> 'abc   '
  ],
  key4     => [
      ['trim_trail']     # '  def  ' -> '   def'
  ]
];

my $vc = Validator::Custom::Trim->new;
my $result = $vc->validate($data, $rule);
my $trimed = $result->data->{'key1'};

METHODS

This module is subclass of Validator::Custom. All methods of Validator::Custom is available.

CONSTRAINTS

trim

trim leading and trailing white space

trim_lead

trim leading white space

trim_trail

trim trailing white space

trim_collapse

Trim leading and trailing white space, and collapse all whitespace characters into a single space.

AUTHOR

Yuki Kimoto, <kimoto.yuki at gmail.com>

SEE ALSO

Validator::Custom

COPYRIGHT & LICENSE

Copyright 2009 Yuki Kimoto, all rights reserved.

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