DBICx::Hooks - Provide hooks into DBIx::Class create()/update()/delete()
version 0.003
## 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 });
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.
Source
Action
See DBICx::Hooks::Registry for extra details on the dbic_hooks_registry() function.
dbic_hooks_registry()
Pedro Melo <melo@simplicidade.org>
This software is Copyright (c) 2011 by Pedro Melo.
This is free software, licensed under:
The Artistic License 2.0
To install DBICx::Hooks, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBICx::Hooks
CPAN shell
perl -MCPAN -e shell install DBICx::Hooks
For more information on module installation, please visit the detailed CPAN module installation guide.