--- /dev/null
+#!/usr/bin/perl
+
+package DBIx::Class::Journal::EvalWrap;
+use base qw(DBIx::Class::Journal);
+
+use strict;
+use warnings;
+
+foreach my $method qw(journal_log_update journal_log_insert journal_log_delete) {
+ local $@;
+ eval "sub $method " . ' {
+ my ( $self, @args ) = @_;
+ local $@;
+ eval { $self->next::method(@args) };
+ warn $@ if $@;
+ }; 1' || warn $@;
+}
+
+__PACKAGE__
+
+__END__
+
+=pod
+
+=head1 NAME
+
+DBIx::Class::Journal::EvalWrap - Wrap all journal ops with an eval { }
+
+=head1 SYNOPSIS
+
+ __PACKAGE__->journal_component("Journal::EvalWrap");
+
+=head1 DESCRIPTION
+
+This component is a wrapper for the row methods in L<DBIx:Class::Journal> that
+aides in retrofitting a schema for journaling, by wrapping all the journal CRUD
+operations with a C<local $@; eval { ... }}.
+
+This is desirable if you'd rather lose journal data than create runtime errors
+when retrofitting existing code.
+
+Use with caution.
+
+=cut
+
+
__PACKAGE__->mk_classdata('journal_sources'); ## [ source names ]
__PACKAGE__->mk_classdata('journal_user'); ## [ class, field for user id ]
__PACKAGE__->mk_classdata('_journal_schema'); ## schema object for journal
+__PACKAGE__->mk_classdata('journal_component');
__PACKAGE__->mk_classdata('journal_nested_changesets');
use strict;
$self->_journal_schema($journal_schema);
+ my $comp = $self->journal_component || "Journal";
## Create auditlog+history per table
my %j_sources = map { $_ => 1 } $self->journal_sources
{
next unless($j_sources{$s_name});
$self->create_journal_for($s_name);
- $self->class($s_name)->load_components('Journal');
+ $self->class($s_name)->load_components($comp);
# print STDERR "$s_name :", $self->class($s_name), "\n";
}
__PACKAGE__->load_components(qw/+DBIx::Class::Schema::Journal/);
+__PACKAGE__->journal_component("Journal::EvalWrap");
+
no warnings qw/qw/;
DBICTest::Schema->load_classes(
qw/