logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Badger::Data::Type - base class for data types

Author

       Andy Wardley <http://wardley.org/>

Configuration Options

name
       An optional name for the data type.

   namespace
       An optional namespace for the data type.

   base
       An optional base data type.

   facets
       An optional list of validation facets.

Description

       This module implements a base class for data types.

Methods

       The following methods are defined in addition to those inherited from the Badger::Base base class.

   init()
       This is aliased to the init_type() method.

   init_type($config)
       This is the initialisation method for a data type.  It is called automatically when a data type object is
       created via the new() method inherited from the Badger::Base base class.

   name()
       Returns the name of the data type as specified via the name configuration option.  If no name was
       specified then an automatically generated name is returned based on the class name with the
       "Badger::Data::Type" prefix removed and all "::" sequences replaced with periods, e.g. a data type
       "Badger::Data::Type::Foo::Bar" would yield a name of "Foo.Bar".

   namespace()
       Returns the namespace for the data type, or "undef" is none is defined.

   base()
       Returns the base data type, or "undef" is none is defined.

   facets()
       Returns a reference to a list of validation facets defined for the data type.

   simple()
       This constant method always returns the value 0.  Subclasses representing simple data types should re-
       define this to return the value 1.

   complex()
       This constant method always returns the value 0.  Subclasses representing complex data types should re-
       define this to return the value 1.

   constrain($facet,@args)
       Applies a new validation facet to the data type.

   validate($value_ref)
       Validates the value passed by reference as the first argument.  It calls the "validate()" method of each
       of the validation facets in turn.

Name

       Badger::Data::Type - base class for data types

See Also

       Badger::Base

perl v5.36.0                                       2023-08-28                            Badger::Data::Type(3pm)

See Also