Class-MakeMethods
view release on metacpan or search on metacpan
MakeMethods.pm view on Meta::CPAN
=head2 Perl Docs
See L<perlboot> for a quick introduction to objects for beginners.
For an extensive discussion of various approaches to class
construction, see L<perltoot> and L<perltootc> (called L<perltootc>
in the most recent versions of Perl).
See L<perlref/"Making References">, point 4 for more information
on closures. (FWIW, I think there's a big opportunity for a "perlfunt"
podfile bundled with Perl in the tradition of "perlboot" and
"perltoot", exploring the utility of function references, callbacks,
closures, and continuations... There are a bunch of useful references
available, but not a good overview of how they all interact in a
Perlish way.)
=head1 BUGS AND SUPPORT
=head2 Release Status
This module has been used in a variety of production systems and
MakeMethods/Composite/Inheritable.pm view on Meta::CPAN
);
########################################################################
=head2 hook - Overrideable array of subroutines
A hook method is called from the outside as a normal method. However, internally, it contains an array of subroutine references, each of which are called in turn to produce the method's results.
Subroutines may be added to the hook's array by calling it with a blessed subroutine reference, as shown below. Subroutines may be added on a class-wide basis or on an individual object.
You might want to use this type of method to provide an easy way for callbacks to be registered.
package MyClass;
use Class::MakeMethods::Composite::Inheritable ( 'hook' => 'init' );
MyClass->init( Class::MakeMethods::Composite::Inheritable->Hook( sub {
my $callee = shift;
warn "Init...";
} );
my $obj = MyClass->new;
( run in 0.426 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )