koorchik / Validator-LIVR

Lightweight Perl validator supporting Language Independent Validation Rules Specification (LIVR)
https://metacpan.org/pod/Validator::LIVR
13 stars 4 forks source link

to_lc + like bug #5

Closed DanielHreben closed 10 years ago

DanielHreben commented 10 years ago
use v5.12;
use utf8;
use strict;
use warnings;

use Validator::LIVR;
use Data::Dumper;

my $rules = {
    filename   => [ 'required', 'to_lc', {'like' => qr/\.xls(x)?$/} ]
};

my $data = {
    filename => 'test.xLs'
};

my $validator    = Validator::LIVR->new( $rules );
my $cleared_data = $validator->validate( $data );

print Dumper $cleared_data;

# GOT:
# $VAR1 = {
#           'filename' => 'test.xLs'
#         };

# EXPECTED:
# $VAR1 = {
#           'filename' => 'test.xls'
#         };
koorchik commented 10 years ago

регулярное выражение нужно передавать ввиде строки для совметимости

DanielHreben commented 10 years ago

В данном случае не важно, результат не меняется.

koorchik commented 10 years ago

Fixed ( залил на CPAN )