The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Object::By::Typeglob - minimalistic constructors for typeglob based objects

SYNOPSIS

        package some_package;
        use parent qw(Object::By::Typeglob);

        sub _constructor {
                my ($this, ...) = @_;
                ...
                return;
        }

        package main;
        use some_package;
        some_package->constructor(...);

DESCRIPTION

Object::By::Typeglob provides generic constructors for OO programming, which are tailored to an actual class via a method called _constructor. A generic constructor creates a Symbol::geniosym reference from various sources, blesses, tailors, locks, and finally returns it.

METHOD REFERENCE (API)

The design goal was a simple and robust API with a straightforward implementation, respecting all limitations of Perl 5.

$class->constructor or class->constructor

A generic constructor for objects of the class. If the method _constructor is defined, calls _constructor and forwards any arguments to it.

$class->prototype_constructor or class->prototype_constructor

Prototype means, the object only carries a class and a new Symbol::geniosym.

$old_object->sibling_constructor

Takes the class of $old_object to create an object of the same class. Otherwise works like class->constructor.

For a way to use partial class names for object construction, see wild_construct from Package::Aspect::Wild_Class.

KNOWN BUGS AND LIMITATIONS

There are no tests.

This module has been developed for the specific needs of FReDI and the Mica Environment. It is used by Mica, HTTP::Fools_Gold, Package::Aspect, Text::Placeholder and Object::Episode.

AUTHOR

Winfried Trumper <pub+perl(a)wt.tuxomania.net>

COPYRIGHT AND LICENSE

Copyright (C) 2011,2012 Winfried Trumper

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