Alexis Sukrieh > Coat-0.2 > Coat::Types

Download:
Coat-0.2.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View Bugs
Report a bug
Source   Latest Release: Coat-0.334

NAME ^

Coat::Types -- Type constraints handling for Coat

DESCRIPTION ^

Attributes in Coat are bound to types with the keyword 'isa'. This lets Coat perform type-constraint validation when a value is set to an attribute of the class.

The following types are supported by Coat (based on the ones provided by Moose, those that are not available in Moose are marked 'C')

    Any
    Item
      Bool
      Undef
      Defined
        Value
          Num
            Int
              Timestamp (C)
          Str
            ClassName
        Ref
          ScalarRef
          ArrayRef
          HashRef
          CodeRef

Each of these types provides a static method called "is_valid" which takes a value and returns a boolean telling if the value given is valid according to the type.

METHODS ^

validate

This module provides a method for validating a value set to an attribute. It calls the appropriate "is_valid" method according to the type given.

If the type given is not a known type, it will be assumed this is a classname, and the value will then be checked with ClassName->is_valid.

SEE ALSO ^

See Coat for more details.

AUTHORS ^

This module was written by Alexis Sukrieh <sukria+perl@sukria.net>

COPYRIGHT AND LICENSE ^

Copyright 2007 by Alexis Sukrieh.

http://www.sukria.net/perl/coat/

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