Al Newkirk > Bubblegum > Bubblegum::Constraints

Download:
Bubblegum-0.45.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.45   Source  

NAME ^

Bubblegum::Constraints - Type and Constraints Library for Bubblegum

VERSION ^

version 0.45

SYNOPSIS ^

    package Server;

    use Bubblegum::Class;
    use Bubblegum::Constraints 'typeof_arrayref';

    has 'ifaces' => (
        is       => 'ro',
        isa      => typeof_arrayref,
        required => 1
    );

DESCRIPTION ^

Bubblegum::Constraints is the standard type-checking library for Bubblegum applications with a focus on minimalism and data integrity. This library derives its type validation from Types::Standard, the Type::Tiny standard library. Note: This is an early release available for testing and feedback and as such is subject to change.

By default, no functions are exported when using this package, all functionality desired will need to be explicitly requested, and because many functions belong to a particular group of functions there are export tags which can be used to export sets of functions by group name. Any function can also be exported individually. The following are a list of functions and groups currently available:

-all

The all export group exports all functions from the "-types", "-typesof", "-isas", and "-nots" export groups.

-isas

The isas export group exports all functions which have the isa_ prefix. These functions take a single argument and perform non-fatal type checking and return true or false. The following is a list of functions exported by this group:

isa_aref

    isa_aref '...';

The isa_aref function validates that the argument is an array reference. If the argument is not an array reference, the function will return false.

isa_arrayref

    isa_arrayref '...';

The isa_arrayref function validates that the argument is an array reference. If the argument is not an array reference, the function will return false.

isa_bool

    isa_bool '...';

The isa_bool function validates that the argument is a boolean value. If the argument is not a boolean value, the function will return false.

isa_boolean

    isa_boolean '...';

The isa_boolean function validates that the argument is a boolean value. If the argument is not a boolean value, the function will return false.

isa_class

    isa_class '...';

The isa_class function validates that the argument is a class name. If the argument is not a class name, the function will return false.

isa_classname

    isa_classname '...';

The isa_classname function validates that the argument is a class name. If the argument is not a class name, the function will return false.

isa_coderef

    isa_coderef '...';

The isa_coderef function validates that the argument is a code reference. If the argument is not a code reference, the function will return false.

isa_cref

    isa_cref '...';

The isa_cref function validates that the argument is a code reference. If the argument is not a code reference, the function will return false.

isa_def

    isa_def '...';

The isa_def function validates that the argument is a defined value. If the argument is not a defined value, the function will return false.

isa_defined

    isa_defined '...';

The isa_defined function validates that the argument is a defined value. If the argument is not a defined value, the function will return false.

isa_fh

    isa_fh '...';

The isa_fh function validates that the argument is a file handle. If the argument is not a file handle, the function will return false.

isa_filehandle

    isa_filehandle '...';

The isa_filehandle function validates that the argument is a file handle. If the argument is not a file handle, the function will return false.

isa_glob

    isa_glob '...';

The isa_glob function validates that the argument is a glob reference. If the argument is not a glob reference, the function will return false.

isa_globref

    isa_globref '...';

The isa_globref function validates that the argument is a glob reference. If the argument is not a glob reference, the function will return false.

isa_hashref

    isa_hashref '...';

The isa_hashref function validates that the argument is a hash reference. If the argument is not a hash reference, the function will return false.

isa_href

    isa_href '...';

The isa_href function validates that the argument is a hash reference. If the argument is not a hash reference, the function will return false.

isa_int

    isa_int '...';

The isa_int function validates that the argument is an integer. If the argument is not an integer, the function will return false.

isa_integer

    isa_integer '...';

The isa_integer function validates that the argument is an integer. If the argument is not an integer, the function will return false.

isa_num

    isa_num '...';

The isa_num function validates that the argument is a number. If the argument is not a number, the function will return false.

isa_number

    isa_number '...';

The isa_number function validates that the argument is a number. If the argument is not a number, the function will return false.

isa_obj

    isa_obj '...';

The isa_obj function validates that the argument is an object. If the argument is not an object, the function will return false.

isa_object

    isa_object '...';

The isa_object function validates that the argument is an object. If the argument is not an object, the function will return false.

isa_ref

    isa_ref '...';

The isa_ref function validates that the argument is a reference. If the argument is not a reference, the function will return false.

isa_reference

    isa_reference '...';

The isa_reference function validates that the argument is a reference. If the argument is not a reference, the function will return false.

isa_regexpref

    isa_regexpref '...';

The isa_regexpref function validates that the argument is a regular expression reference. If the argument is not a regular expression reference, the function will return false.

isa_rref

    isa_rref '...';

The isa_rref function validates that the argument is a regular expression reference. If the argument is not a regular expression reference, the function will return false.

isa_scalarref

    isa_scalarref '...';

The isa_scalarref function validates that the argument is a scalar reference. If the argument is not a scalar reference, the function will return false.

isa_sref

    isa_sref '...';

The isa_sref function validates that the argument is a scalar reference. If the argument is not a scalar reference, the function will return false.

isa_str

    isa_str '...';

The isa_str function validates that the argument is a string. If the argument is not a string, the function will return false.

isa_string

    isa_string '...';

The isa_string function validates that the argument is a string. If the argument is not a string, the function will return false.

isa_nil

    isa_nil '...';

The isa_nil function validates that the argument is an undefined value. If the argument is not an undefined value, the function will return false.

isa_null

    isa_null '...';

The isa_null function validates that the argument is an undefined value. If the argument is not an undefined value, the function will return false.

isa_undef

    isa_undef '...';

The isa_undef function validates that the argument is an undefined value. If the argument is not an undefined value, the function will return false.

isa_undefined

    isa_undefined '...';

The isa_undefined function validates that the argument is an undefined value. If the argument is not an undefined value, the function will return false.

isa_val

    isa_val '...';

The isa_val function validates that the argument is a value. If the argument is not a value, the function will return false.

isa_value

    isa_value '...';

The isa_value function validates that the argument is a value. If the argument is not a value, the function will return false.

-nots

The nots export group exports all functions which have the not_ prefix. These functions take a single argument and perform non-fatal negated type checking and return true or false. The following is a list of functions exported by this group:

not_aref

    not_aref '...';

The not_aref function validates that the argument is NOT an array reference. If the argument is an array reference, the function will return false.

not_arrayref

    not_arrayref '...';

The not_arrayref function validates that the argument is NOT an array reference. If the argument is an array reference, the function will return false.

not_bool

    not_bool '...';

The not_bool function validates that the argument is NOT a boolean value. If the argument is a boolean value, the function will return false.

not_boolean

    not_boolean '...';

The not_boolean function validates that the argument is NOT a boolean value. If the argument is a boolean value, the function will return false.

not_class

    not_class '...';

The not_class function validates that the argument is NOT a class name. If the argument is a class name, the function will return false.

not_classname

    not_classname '...';

The not_classname function validates that the argument is NOT a class name. If the argument is a class name, the function will return false.

not_coderef

    not_coderef '...';

The not_coderef function validates that the argument is NOT a code reference. If the argument is a code reference, the function will return false.

not_cref

    not_cref '...';

The not_cref function validates that the argument is NOT a code reference. If the argument is a code reference, the function will return false.

not_def

    not_def '...';

The not_def function validates that the argument is NOT a defined value. If the argument is a defined value, the function will return false.

not_defined

    not_defined '...';

The not_defined function validates that the argument is NOT a defined value. If the argument is a defined value, the function will return false.

not_fh

    not_fh '...';

The not_fh function validates that the argument is NOT a file handle. If the argument is a file handle, the function will return false.

not_filehandle

    not_filehandle '...';

The not_filehandle function validates that the argument is NOT a file handle. If the argument is a file handle, the function will return false.

not_glob

    not_glob '...';

The not_glob function validates that the argument is NOT a glob reference. If the argument is a glob reference, the function will return false.

not_globref

    not_globref '...';

The not_globref function validates that the argument is NOT a glob reference. If the argument is a glob reference, the function will return false.

not_hashref

    not_hashref '...';

The not_hashref function validates that the argument is NOT a hash reference. If the argument is a hash reference, the function will return false.

not_href

    not_href '...';

The not_href function validates that the argument is NOT a hash reference. If the argument is a hash reference, the function will return false.

not_int

    not_int '...';

The not_int function validates that the argument is NOT an integer. If the argument is an integer, the function will return false.

not_integer

    not_integer '...';

The not_integer function validates that the argument is NOT an integer. If the argument is an integer, the function will return false.

not_num

    not_num '...';

The not_num function validates that the argument is NOT a number. If the argument is a number, the function will return false.

not_number

    not_number '...';

The not_number function validates that the argument is NOT a number. If the argument is a number, the function will return false.

not_obj

    not_obj '...';

The not_obj function validates that the argument is NOT an object. If the argument is an object, the function will return false.

not_object

    not_object '...';

The not_object function validates that the argument is NOT an object. If the argument is an object, the function will return false.

not_ref

    not_ref '...';

The not_ref function validates that the argument is NOT a reference. If the argument is a reference, the function will return false.

not_reference

    not_reference '...';

The not_reference function validates that the argument is NOT a reference. If the argument is a reference, the function will return false.

not_regexpref

    not_regexpref '...';

The not_regexpref function validates that the argument is NOT a regular expression reference. If the argument is a regular expression reference, the function will return false.

not_rref

    not_rref '...';

The not_rref function validates that the argument is NOT a regular expression reference. If the argument is a regular expression reference, the function will return false.

not_scalarref

    not_scalarref '...';

The not_scalarref function validates that the argument is NOT a scalar reference. If the argument is a scalar reference, the function will return false.

not_sref

    not_sref '...';

The not_sref function validates that the argument is NOT a scalar reference. If the argument is a scalar reference, the function will return false.

not_str

    not_str '...';

The not_str function validates that the argument is NOT a string. If the argument is a string, the function will return false.

not_string

    not_string '...';

The not_string function validates that the argument is NOT a string. If the argument is a string, the function will return false.

not_nil

    not_nil '...';

The not_nil function validates that the argument is NOT an undefined value. If the argument is an undefined value, the function will return false.

not_null

    not_null '...';

The not_null function validates that the argument is NOT an undefined value. If the argument is an undefined value, the function will return false.

not_undef

    not_undef '...';

The not_undef function validates that the argument is NOT an undefined value. If the argument is an undefined value, the function will return false.

not_undefined

    not_undefined '...';

The not_undefined function validates that the argument is NOT an undefined value. If the argument is an undefined value, the function will return false.

not_val

    not_val '...';

The not_val function validates that the argument is NOT a value. If the argument is a value, the function will return false.

not_value

    not_value '...';

The not_value function validates that the argument is NOT a value. If the argument is a value, the function will return false.

-types

The types export group exports all functions which have the type_ prefix. These functions take a single argument/expression and perform fatal type checking operation returning the argument/expression if successful. The follow is a list of functions exported by this group:

type_aref

    type_aref '...';

The type_aref function asserts that the argument is an array reference. If the argument is not an array reference, the function will cause the program to die.

type_arrayref

    type_arrayref '...';

The type_arrayref function asserts that the argument is an array reference. If the argument is not an array reference, the function will cause the program to die.

type_bool

    type_bool '...';

The type_bool function asserts that the argument is a boolean value. If the argument is not a boolean value, the function will cause the program to die.

type_boolean

    type_boolean '...';

The type_boolean function asserts that the argument is a boolean value. If the argument is not a boolean value, the function will cause the program to die.

type_class

    type_class '...';

The type_class function asserts that the argument is a class name. If the argument is not a class name, the function will cause the program to die.

type_classname

    type_classname '...';

The type_classname function asserts that the argument is a class name. If the argument is not a class name, the function will cause the program to die.

type_coderef

    type_coderef '...';

The type_coderef function asserts that the argument is a code reference. If the argument is not a code reference, the function will cause the program to die.

type_cref

    type_cref '...';

The type_cref function asserts that the argument is a code reference. If the argument is not a code reference, the function will cause the program to die.

type_def

    type_def '...';

The type_def function asserts that the argument is a defined value. If the argument is not a defined value, the function will cause the program to die.

type_defined

    type_defined '...';

The type_defined function asserts that the argument is a defined value. If the argument is not a defined value, the function will cause the program to die.

type_fh

    type_fh '...';

The type_fh function asserts that the argument is a file handle. If the argument is not a file handle, the function will cause the program to die.

type_filehandle

    type_filehandle '...';

The type_filehandle function asserts that the argument is a file handle. If the argument is not a file handle, the function will cause the program to die.

type_glob

    type_glob '...';

The type_glob function asserts that the argument is a glob reference. If the argument is not a glob reference, the function will cause the program to die.

type_globref

    type_globref '...';

The type_globref function asserts that the argument is a glob reference. If the argument is not a glob reference, the function will cause the program to die.

type_hashref

    type_hashref '...';

The type_hashref function asserts that the argument is a hash reference. If the argument is not a hash reference, the function will cause the program to die.

type_href

    type_href '...';

The type_href function asserts that the argument is a hash reference. If the argument is not a hash reference, the function will cause the program to die.

type_int

    type_int '...';

The type_int function asserts that the argument is an integer. If the argument is not an integer, the function will cause the program to die.

type_integer

    type_integer '...';

The type_integer function asserts that the argument is an integer. If the argument is not an integer, the function will cause the program to die.

type_num

    type_num '...';

The type_num function asserts that the argument is a number. If the argument is not a number, the function will cause the program to die.

type_number

    type_number '...';

The type_number function asserts that the argument is a number. If the argument is not a number, the function will cause the program to die.

type_obj

    type_obj '...';

The type_obj function asserts that the argument is an object. If the argument is not an object, the function will cause the program to die.

type_object

    type_object '...';

The type_object function asserts that the argument is an object. If the argument is not an object, the function will cause the program to die.

type_ref

    type_ref '...';

The type_ref function asserts that the argument is a reference. If the argument is not a reference, the function will cause the program to die.

type_reference

    type_reference '...';

The type_reference function asserts that the argument is a reference. If the argument is not a reference, the function will cause the program to die.

type_regexpref

    type_regexpref '...';

The type_regexpref function asserts that the argument is a regular expression reference. If the argument is not a regular expression reference, the function will cause the program to die.

type_rref

    type_rref '...';

The type_rref function asserts that the argument is a regular expression reference. If the argument is not a regular expression reference, the function will cause the program to die.

type_scalarref

    type_scalarref '...';

The type_scalarref function asserts that the argument is a scalar reference. If the argument is not a scalar reference, the function will cause the program to die.

type_sref

    type_sref '...';

The type_sref function asserts that the argument is a scalar reference. If the argument is not a scalar reference, the function will cause the program to die.

type_str

    type_str '...';

The type_str function asserts that the argument is a string. If the argument is not a string, the function will cause the program to die.

type_string

    type_string '...';

The type_string function asserts that the argument is a string. If the argument is not a string, the function will cause the program to die.

type_nil

    type_nil '...';

The type_nil function asserts that the argument is an undefined value. If the argument is not an undefined value, the function will cause the program to die.

type_null

    type_null '...';

The type_null function asserts that the argument is an undefined value. If the argument is not an undefined value, the function will cause the program to die.

type_undef

    type_undef '...';

The type_undef function asserts that the argument is an undefined value. If the argument is not an undefined value, the function will cause the program to die.

type_undefined

    type_undefined '...';

The type_undefined function asserts that the argument is an undefined value. If the argument is not an undefined value, the function will cause the program to die.

type_val

    type_val '...';

The type_val function asserts that the argument is a value. If the argument is not a value, the function will cause the program to die.

type_value

    type_value '...';

The type_value function asserts that the argument is a value. If the argument is not a value, the function will cause the program to die.

-typesof

The typesof export group exports all functions which have the typeof_ prefix. These functions take no argument and return a type-validation code reference to be used with your object-system of choice. The following is a list of functions exported by this group:

typeof_aref

    typeof_aref;

The typeof_aref function returns a type constraint in the form of a code reference which asserts that the argument is an array reference. If the argument is not an array reference, the function will cause the program to die.

typeof_arrayref

    typeof_arrayref;

The typeof_arrayref function returns a type constraint in the form of a code reference which asserts that the argument is an array reference. If the argument is not an array reference, the function will cause the program to die.

typeof_bool

    typeof_bool;

The typeof_bool function returns a type constraint in the form of a code reference which asserts that the argument is a boolean value. If the argument is not a boolean value, the function will cause the program to die.

typeof_boolean

    typeof_boolean;

The typeof_boolean function returns a type constraint in the form of a code reference which asserts that the argument is a boolean value. If the argument is not a boolean value, the function will cause the program to die.

typeof_class

    typeof_class;

The typeof_class function returns a type constraint in the form of a code reference which asserts that the argument is a class name. If the argument is not a class name, the function will cause the program to die.

typeof_classname

    typeof_classname;

The typeof_classname function returns a type constraint in the form of a code reference which asserts that the argument is a class name. If the argument is not a class name, the function will cause the program to die.

typeof_coderef

    typeof_coderef;

The typeof_coderef function returns a type constraint in the form of a code reference which asserts that the argument is a code reference. If the argument is not a code reference, the function will cause the program to die.

typeof_cref

    typeof_cref;

The typeof_cref function returns a type constraint in the form of a code reference which asserts that the argument is a code reference. If the argument is not a code reference, the function will cause the program to die.

typeof_def

    typeof_def;

The typeof_def function returns a type constraint in the form of a code reference which asserts that the argument is a defined value. If the argument is not a defined value, the function will cause the program to die.

typeof_defined

    typeof_defined;

The typeof_defined function returns a type constraint in the form of a code reference which asserts that the argument is a defined value. If the argument is not a defined value, the function will cause the program to die.

typeof_fh

    typeof_fh;

The typeof_fh function returns a type constraint in the form of a code reference which asserts that the argument is a file handle. If the argument is not a file handle, the function will cause the program to die.

typeof_filehandle

    typeof_filehandle;

The typeof_filehandle function returns a type constraint in the form of a code reference which asserts that the argument is a file handle. If the argument is not a file handle, the function will cause the program to die.

typeof_glob

    typeof_glob;

The typeof_glob function returns a type constraint in the form of a code reference which asserts that the argument is a glob reference. If the argument is not a glob reference, the function will cause the program to die.

typeof_globref

    typeof_globref;

The typeof_globref function returns a type constraint in the form of a code reference which asserts that the argument is a glob reference. If the argument is not a glob reference, the function will cause the program to die.

typeof_hashref

    typeof_hashref;

The typeof_hashref function returns a type constraint in the form of a code reference which asserts that the argument is a hash reference. If the argument is not a hash reference, the function will cause the program to die.

typeof_href

    typeof_href;

The typeof_href function returns a type constraint in the form of a code reference which asserts that the argument is a hash reference. If the argument is not a hash reference, the function will cause the program to die.

typeof_int

    typeof_int;

The typeof_int function returns a type constraint in the form of a code reference which asserts that the argument is an integer. If the argument is not an integer, the function will cause the program to die.

typeof_integer

    typeof_integer;

The typeof_integer function returns a type constraint in the form of a code reference which asserts that the argument is an integer. If the argument is not an integer, the function will cause the program to die.

typeof_num

    typeof_num;

The typeof_num function returns a type constraint in the form of a code reference which asserts that the argument is a number. If the argument is not a number, the function will cause the program to die.

typeof_number

    typeof_number;

The typeof_number function returns a type constraint in the form of a code reference which asserts that the argument is a number. If the argument is not a number, the function will cause the program to die.

typeof_obj

    typeof_obj;

The typeof_obj function returns a type constraint in the form of a code reference which asserts that the argument is an object. If the argument is not an object, the function will cause the program to die.

typeof_object

    typeof_object;

The typeof_object function returns a type constraint in the form of a code reference which asserts that the argument is an object. If the argument is not an object, the function will cause the program to die.

typeof_ref

    typeof_ref;

The typeof_ref function returns a type constraint in the form of a code reference which asserts that the argument is a reference. If the argument is not a reference, the function will cause the program to die.

typeof_reference

    typeof_reference;

The typeof_reference function returns a type constraint in the form of a code reference which asserts that the argument is a reference. If the argument is not a reference, the function will cause the program to die.

typeof_regexpref

    typeof_regexpref;

The typeof_regexpref function returns a type constraint in the form of a code reference which asserts that the argument is a regular expression reference. If the argument is not a regular expression reference, the function will cause the program to die.

typeof_rref

    typeof_rref;

The typeof_rref function returns a type constraint in the form of a code reference which asserts that the argument is a regular expression reference. If the argument is not a regular expression reference, the function will cause the program to die.

typeof_scalarref

    typeof_scalarref;

The typeof_scalarref function returns a type constraint in the form of a code reference which asserts that the argument is a scalar reference. If the argument is not a scalar reference, the function will cause the program to die.

typeof_sref

    typeof_sref;

The typeof_sref function returns a type constraint in the form of a code reference which asserts that the argument is a scalar reference. If the argument is not a scalar reference, the function will cause the program to die.

typeof_str

    typeof_str;

The typeof_str function returns a type constraint in the form of a code reference which asserts that the argument is a string. If the argument is not a string, the function will cause the program to die.

typeof_string

    typeof_string;

The typeof_string function returns a type constraint in the form of a code reference which asserts that the argument is a string. If the argument is not a string, the function will cause the program to die.

typeof_nil

    typeof_nil;

The typeof_nil function returns a type constraint in the form of a code reference which asserts that the argument is an undefined value. If the argument is not an undefined value, the function will cause the program to die.

typeof_null

    typeof_null;

The typeof_null function returns a type constraint in the form of a code reference which asserts that the argument is an undefined value. If the argument is not an undefined value, the function will cause the program to die.

typeof_undef

    typeof_undef;

The typeof_undef function returns a type constraint in the form of a code reference which asserts that the argument is an undefined value. If the argument is not an undefined value, the function will cause the program to die.

typeof_undefined

    typeof_undefined;

The typeof_undefined function returns a type constraint in the form of a code reference which asserts that the argument is an undefined value. If the argument is not an undefined value, the function will cause the program to die.

typeof_val

    typeof_val;

The typeof_val function returns a type constraint in the form of a code reference which asserts that the argument is a value. If the argument is not a value, the function will cause the program to die.

typeof_value

    typeof_value;

The typeof_value function returns a type constraint in the form of a code reference which asserts that the argument is a value. If the argument is not a value, the function will cause the program to die.

AUTHOR ^

Al Newkirk <anewkirk@ana.io>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2013 by Al Newkirk.

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

syntax highlighting: