Audit-DBI
view release on metacpan or search on metacpan
lib/Audit/DBI.pm view on Meta::CPAN
package Audit::DBI;
use strict;
use warnings;
use Carp;
use Data::Validate::Type;
use Storable;
use Try::Tiny;
use Audit::DBI::Event;
use Audit::DBI::Utils;
=head1 NAME
Audit::DBI - Audit data changes in your code and store searchable log records in a database.
=head1 VERSION
Version 1.9.0
=cut
our $VERSION = '1.9.0';
=head1 SYNOPSIS
use Audit::DBI;
# Create the audit object.
my $audit = Audit::DBI->new(
database_handle => $dbh,
);
# Create the necessary tables.
$audit->create_tables();
# Record an audit event.
$audit->record(
event => $event,
subject_type => $subject_type,
subject_id => $subject_id,
event_time => $event_time,
diff => [ $old_structure, $new_structure ],
search_data => \%search_data,
information => \%information,
affected_account_id => $account_id,
file => $file,
line => $line,
);
# Search audit events.
my $audit_events = $audit->review(
[ search criteria ]
);
To see an example of a search interface for audit events recorded by
L<Audit::DBI>, check the C<examples/> directory of L<Audit::DBI::TT2>.
=head1 FORCE OBJECT STRINGIFICATION
When data structures are dumped (for diffs or to store information), it is
sometimes desirable to turn some of the objects into strings, for two reasons:
=over 4
( run in 3.394 seconds using v1.01-cache-2.11-cpan-5a3173703d6 )