DBIx::Class::Journal::EvalWrap - Wrap all journal ops with an eval { }


DBIx-Class-Journal documentation Contained in the DBIx-Class-Journal distribution.

Index


Code Index:

NAME

Top

DBIx::Class::Journal::EvalWrap - Wrap all journal ops with an eval { }

SYNOPSIS

Top

    __PACKAGE__->journal_component("Journal::EvalWrap");

DESCRIPTION

Top

This component is a wrapper for the row methods in DBIx:Class::Journal that aides in retrofitting a schema for journaling, by wrapping all the journal CRUD operations with a local $@; eval { ... }}.

This is desirable if you'd rather lose journal data than create runtime errors when retrofitting existing code.

Use with caution.


DBIx-Class-Journal documentation Contained in the DBIx-Class-Journal distribution.

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__