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

NAME

Object::By::Existing_Reference - a minimalistic constructor for objects based on existing references

SYNOPSIS

        package some_package;
        use parent qw(
                Object::By::Existing_Reference
                Object::By::Array);

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

        package main;
        use some_package;

        my $reference = ...;
        some_package->constructor($reference, ...);

DESCRIPTION

Object::By::Existing_Reference provides a generic constructor for OO programming, which is tailored to an actual class via a method called _constructor. The first argument to the constructor must be an existing reference.

This class can also be used to override constructor() from classes with

METHOD REFERENCE (API)

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

$class->constructor($reference) or class->constructor($reference)

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

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.