NAME

Raisin::Types::Base - Base class for Raisin::Types.

SYNOPSIS

package Raisin::Types::Integer;
use base 'Raisin::Types::Base';

sub check {
    my ($self, $v) = @_;
    length($v) <= 10 ? 1 : 0
}
sub in {
    my ($self, $v) = @_; # REF
    $$v = sprintf 'INT:%d', $$v;
}

package main;

# validate 10.1
use Raisin::Types::Integer;

warn Raisin::Types::Integer->new(1234) ? 'valid' : 'invalid';
warn Raisin::Types::Integer->new(10.1) ? 'valid' : 'invalid';

DESCRIPTION

Base class for each Raisin type.

Contains two base methods: check and in.

METHODS

name

Return type's name.

By default will be returned last string after after ::. If you want customize variable name you can redefine name subroutine.

sub name { 'FancyTypeName' }

check

Check value.

in

Modify value here.