NAME
Poz::Types::null - Null type validation for Poz::Types
SYNOPSIS
use Poz qw/z/;
my $null_validator = z->null;
$null_validator->parse(undef); # returns undef
$null_validator->parse(1); # returns error message
my $array_with_null_or_number = z->array(z->union(z->null, z->number));
$array_with_null_or_number->parse([undef, 1]); # returns [undef, 1]
$array_with_null_or_number->parse([1, 2]); # returns [1, 2]
$array_with_null_or_number->parse([undef, "a"]); # returns error message
DESCRIPTION
This module provides a null type validator for Poz::Types. It can be used to validate that a value is undef
.
METHODS
rule
my $error = $null_validator->rule($value);
Validates the given value. Returns an error message if the value is not undef
, otherwise returns undef
.
LICENSE
Copyright (C) ytnobody.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
AUTHOR
ytnobody <ytnobody@gmail.com>