- Perl 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| dist | ||
| lib/Object | ||
| LICENSE | ||
| Makefile.PL | ||
| README.md | ||
NAME
Object::Callback - Wrapper to allow callback to a method on an object
VERSION
version 1.0
SYNOPSIS
use Object::Callback;
use Simple::Log;
use Funky::Log;
my (@listeners);
push @listeners,
Object::Callback( 'object' => Simple::Log->new( 'file' => '/tmp/junk' ),
'method' => 'logline' ),
Object::Callback( 'object' => Funky::Log->new( 'style' => 'purple with spots' ),
'method' => 'jam_this_somewhere' );
while(<>)
{
$line = $_;
chomp $line;
map { $_->callback( $line ); } @listeners;
}
DESCRIPTION
Object::Callback is a simple helper to allow callback to a method on a specific object.
Taking a reference to an object method does not provide the capability to indicate which object this reference should be applied to. Basic perl callback simply handles the code reference and no associated context. To allow for the grouping of both the required object and the method we create an Object::Callback object which contains the required information in a single composite.
COMPATIBILITY
- Object::Callback requires Class::Accessorize::All.
AUTHOR
Bernard Quatermass toolsmith@quatermass.co.uk
COPYRIGHT AND LICENSE
This software is copyright (c) 2025 by Bernard Quatermass.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.