=pod

=head1 NAME

Object::By::* - minimalistic constructors for objects

=head1 DESCRIPTION

The classes in this family provide generic constructors for OO programming, which are tailored to an actual class via a method called _init. A generic constructor creates the reference from various sources, blesses, tailors, locks, and finally returns it. A small advantage at a small price of ~50 lines of Perl code.

=head2 Background

In Perl objects are implemented as blessed references. Any reference to a data structure can become an object by bless()ing it. Counting two repeated tasks, which are provided by Object::By::Array.

The third repeated task is a lock of data structures against structure changes, but not against data changes. It makes sense for a highly dynamic language like Perl to have objects with a dynamically changing structure. But such beasts have the potential of bugs and are less often needed. If the data can change while the structure is fixed, that is enough flexibility for the standard case. Object::By::Array is about standard cases.

=head1 METHOD REFERENCE (API)

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

=over 8

=item new

The generic constructor for the classic call class->new. If the method _init is defined, calls _init and forwards any arguments to it.

=item same

A generic constructor for the call $object->new'. Otherwise works like new.

=item prototype

A generic constructor for the call $object->new'. However, this creates an empty (and potentially useless) prototype object.

=item clone

A generic constructor for the call $object->new'. However, it does not call the method _init, but copies the first level of the object's data structure. To leave no doubt: no deep copy is performed.

=back


=head1 KNOWN BUGS AND LIMITATIONS

This is the first public release.

=head1 AUTHOR

Winfried Trumper E<lt>pub+perl(a)wt.tuxomania.netE<gt>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2011 Winfried Trumper

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

=cut
