Author image Marvin Humphrey
and 1 contributors


Clownfish::Type::Clownfish - An object Type.


Clownfish::Type::Object supports object types for all classes. The type's specifier must match the last component of the class name -- i.e. for the class "Crustacean::Lobster" it must be "Lobster".



    my $type = Clownfish::Type::Object->new(
        specifier   => "Lobster",       # required
        parcel      => "Crustacean",    # default: the default Parcel.
        const       => undef,           # default undef
        indirection => 1,               # default 1
        incremented => 1,               # default 0
        decremented => 0,               # default 0
        nullable    => 1,               # default 0
  • specifier - Required. Must follow the rules for Clownfish::Class class name components.

  • parcel - A Clownfish::Parcel or a parcel name.

  • const - Should be true if the Type is const. Note that this refers to the object itself and not the pointer.

  • indirection - Level of indirection. Must be 1 if supplied.

  • incremented - Indicate whether the caller must take responsibility for an added refcount.

  • decremented - Indicate whether the caller must account for for a refcount decrement.

  • nullable - Indicate whether the object specified by this type may be NULL.

The Parcel's prefix will be prepended to the specifier by new().


Returns true if the Type is incremented.


Returns true if the Type is decremented.


    do_stuff() if $type->similar($other_type);

Weak checking of type which allows for covariant return types.


Copyright 2008-2011 Marvin Humphrey

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