NAME

Poz::Types::scalar - Scalar type handling for Poz framework

SYNOPSIS

use Poz::Types::scalar;

my $scalar_type = Poz::Types::scalar->new();
$scalar_type->default('default_value');
$scalar_type->nullable();
$scalar_type->optional();

DESCRIPTION

Poz::Types::scalar provides methods to handle scalar types within the Poz framework. It allows setting default values, marking values as nullable or optional, and coercing values.

METHODS

coerce

$scalar_type->coerce($value);

Returns the given value without modification. This method is used to coerce values into the desired type.

default

$scalar_type->default($default_value);

Sets a default value for the scalar type. If the value is undefined, the default value will be used. The default value can be a scalar or a code reference.

nullable

$scalar_type->nullable();

Marks the scalar type as nullable. If the value is undefined, it will short-circuit and return without further processing.

optional

$scalar_type->optional();

Marks the scalar type as optional. If the value is undefined, it will short-circuit and return without further processing.

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>