NAME
DBICx::Hooks - Provide hooks into DBIx::Class create()/update()/delete()
VERSION
version 0.003
SYNOPSIS
## On your DBIx::Class sources
package Schema::Result::SourceName;
use parent 'DBIx::Class::Core';
__PACKAGE__->load_components('+DBICx::Hooks');
## Somewhere on your code
use DBICx::Hooks::Registry;
dbic_hooks_registry('Schema::Result::SourceName', 'create', sub {
my ($new_row) = @_;
## your bussiness logic goes here
});
dbic_hooks_registry('Schema::Result::SourceName', 'update', sub {
my ($updated_row) = @_;
## your bussiness logic goes here
});
DESCRIPTION
This modules provides a way to hook into the create(), update(), and delete() calls on your sources.
This can be used to trigger bussiness processes after one of this operations.
You register callbacks (even multiple callbacks) with a pair Source
/Action
. Each callback receives a single parameter, the row object just created/updated/just deleted.
See DBICx::Hooks::Registry for extra details on the dbic_hooks_registry()
function.
AUTHOR
Pedro Melo <melo@simplicidade.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2011 by Pedro Melo.
This is free software, licensed under:
The Artistic License 2.0