David Warring > Elive-1.30 > Elive::Util::Type

Download:
Elive-1.30.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.01   Source   Latest Release: Elive-1.32

NAME ^

Elive::Util::Type - Type introspection class

METHODS ^

new

       $type = Elive::Util::inspect_type('Elive::Entity::Participants');
       if ($type->is_array) {
           # ...
       }

Creates an object of type Elive::Util::Type.

is_struct

    Return true, if the type is an ancestor of Elive::DAO

is_ref

    Return true if the elemental_type is a reference; including objects.

is_array

Return an elemental class if objects are substantiated as arrays.

    my $type = Elive::Util::Type->new('Elive::Entity::Participants');
    print $type->is_array;
    # prints Elive::Entity::Participant

If the class is an array, the is_struct() and is_ref() methods inquire on the properties of the element class.

elemental_type

Returns the type of the class. For arrays, returns the array element class.

union

Return the full type union. For arrays, returns the union of all possible array element classes.

    my @types = Elive::Util::Type->new(' Elive::Entity::Group::Members')->union;
    #
    # group members may contain sub-groups, user objects, or packed strings
    is(\@types, [qw(Elive::Entity::Group Str)]);
syntax highlighting: