Fix for 5.18 and 5.20
[dbsrgits/DBIx-Class-Journal.git] / lib / DBIx / Class / Journal / EvalWrap.pm
CommitLineData
8dc58fe2 1package DBIx::Class::Journal::EvalWrap;
2use base qw(DBIx::Class::Journal);
3
4use strict;
5use warnings;
6
e0f76f46 7foreach my $method (qw(journal_log_update journal_log_insert journal_log_delete)) {
8dc58fe2 8 local $@;
9 eval "sub $method " . ' {
10 my ( $self, @args ) = @_;
11 local $@;
12 eval { $self->next::method(@args) };
13 warn $@ if $@;
14 }; 1' || warn $@;
15}
16
17__PACKAGE__
18
19__END__
20
21=pod
22
23=head1 NAME
24
25DBIx::Class::Journal::EvalWrap - Wrap all journal ops with an eval { }
26
27=head1 SYNOPSIS
28
29 __PACKAGE__->journal_component("Journal::EvalWrap");
30
31=head1 DESCRIPTION
32
33This component is a wrapper for the row methods in L<DBIx:Class::Journal> that
34aides in retrofitting a schema for journaling, by wrapping all the journal CRUD
35operations with a C<local $@; eval { ... }}.
36
37This is desirable if you'd rather lose journal data than create runtime errors
38when retrofitting existing code.
39
40Use with caution.
41
42=cut
43
44