NAME

Valiant::Validator::Scalar - Validate that a value is a scalar (like a string or number)

SYNOPSIS

package Local::Test::Scalar;

use Moo;
use Valiant::Validations;

has name => (is=>'ro');

validates name => ( scalar => 1 );

ok my $object = Local::Test::Scalar->new(name=>[111,'John']);
ok $object->validate->invalid;

is_deeply +{ $object->errors->to_hash(full_messages=>1) },
{
  'name' => [
    'Name must be a string or number',
  ]
};

DESCRIPTION

Validates that the value in question is a scalar.

SHORTCUT FORM

This validator supports the follow shortcut forms:

validates attribute => ( scalar => 1, ... );

Which is the same as:

   validates attribute => (
     scalar => { },
   );

GLOBAL PARAMETERS

This validator supports all the standard shared parameters: if, unless, message, strict, allow_undef, allow_blank.

AUTHOR

John Napiorkowski email:jjnapiork@cpan.org

SEE ALSO

Valiant, Valiant::Validator, Valiant::Validator::Each.

COPYRIGHT & LICENSE

Copyright 2020, John Napiorkowski email:jjnapiork@cpan.org

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