Class-Accessor-Complex
view release on metacpan or search on metacpan
A string or array reference, naming the methods that will be
forwarded directly to the object in the slot.
Array Reference
As for "String", for each member of the array. Also works if each
member is a hash reference (see "Fob" above).
String
The name of the instance attribute (slot).
For each slot "x", with forwarding methods "y()" and "z()", the
following methods are created:
"x" A get/set method, see "*" below.
"y" Forwarded onto the object in slot "x", which is auto-created via
"new()" if necessary. The "new()", if called, is called without
arguments.
"z" As for "y".
So, using the example above, a method, "foo()", is created, which can
get and set the value of those objects in slot "foo", which will
generally contain an object of class "Baz". Two additional methods are
created named "bar()" and "baz()" which result in a call to the "bar()"
and "baz()" methods on the "Baz" object stored in slot "foo".
Apart from the forwarding methods described above,
"mk_object_accessors()" creates methods as described below, where "*"
denotes the slot name.
"*" If the accessor is supplied with an object of an appropriate type,
will set set the slot to that value. Else, if the slot has no value,
then an object is created by calling "new()" on the appropriate
class, passing in any supplied arguments.
The stored object is then returned.
*_clear, "clear_*"
Removes the object from the accessor.
mk_forward_accessors
__PACKAGE__->mk_forward_accessors(
comp1 => 'method1',
comp2 => [ qw(method2 method3) ],
);
Takes a hash of mappings as its arguments. Each hash value is expected
to be either a string or an array reference. For each hash value an
accessor is created and forwarded to the accessor denoted by its
associated hash key.
In the example above, a call to "method1()" will be forwarded onto
"comp1()", and calls to "method2()" and "method3()" will be forwarded
onto "comp2()".
INSTALLATION
See perlmodinstall for information and options on installing Perl
modules.
BUGS AND LIMITATIONS
No bugs have been reported.
Please report any bugs or feature requests through the web interface at
<http://rt.cpan.org/Public/Dist/Display.html?Name=Class-Accessor-Complex
>.
AVAILABILITY
The latest version of this module is available from the Comprehensive
Perl Archive Network (CPAN). Visit <http://www.perl.com/CPAN/> to find a
CPAN site near you, or see
<http://search.cpan.org/dist/Class-Accessor-Complex/>.
The development version lives at
<http://github.com/hanekomu/Class-Accessor-Complex/>. Instead of sending
patches, please fork this project using the standard git and github
infrastructure.
AUTHOR
Marcel Gruenauer <marcel@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2007 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
( run in 0.814 second using v1.01-cache-2.11-cpan-39bf76dae61 )