The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Syccess::Validator::Length - A validator to check the length of the value in chars

VERSION

version 0.104

SYNOPSIS

  Syccess->new(
    fields => [
      pin => [ length => 4 ],
      username => [ length => {
        min => 3,
        max => 12,
        message => 'Username must be between %s and %s characters.'
      } ],
      tweet => [ length => { max => 140 } ],
    ],
  );

DESCRIPTION

This validator allows to check for the amount of characters in the value. The default error message depends on the parameter given. The default functionality is using the parameter as the required length for the value. Longer or shorter would be denied. This can't be combined with "min" or "max".

ATTRIBUTES

min

Given this parameter, allows to define a minimum length for the value. This can be combined with "max".

max

Given this parameter, allows to define a maximum length for the value. This can be combined with "min".

message

This contains the error message or the format for the error message generation. See "validator_message" in Syccess::Error.

SUPPORT

IRC

  Join irc.perl.org and msg Getty

Repository

  http://github.com/Getty/p5-syccess
  Pull request and additional contributors are welcome

Issue Tracker

  http://github.com/Getty/p5-syccess/issues

AUTHOR

Torsten Raudssus <torsten@raudss.us>

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Torsten Raudssus.

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