View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Michael Aquilina > Data-Pensieve-0.03a > Data::Pensieve



Annotate this POD


New  1
Open  0
View/Report Bugs
Module Version: 0.03   Source  


Data::Pensieve - Simple tool for interacting with revisioned data


    use Data::Pensieve;
    my $pensieve = Data::Pensieve->new(
        revision_rs      => $c->model('DB::Revision'),
        revision_data_rs => $c->model('DB::RevisionData'),
        definitions      => {
            lolcats => [ qw/name saying picture/ ],
        lolcats => 1,
            # data
            name    => 'lazy lolcat',
            saying  => 'i cannot brian today. i have the dumb',
            picture => 'lazycat.png',
            # change metadata
            modified_by => 'waffle wizard',

    # oops! a typo! time to denote a change.
        lolcats => 1,
            # data
            saying => 'i cannot brain today. i have the dumb',
            # change metadata
            modified_by => 'assistant regional manager',
    my @revisions = $pensieve->get_revisions(lolcats => 1);
    my ($rev1, $rev2) = @revisions;

    my $comparison = $pensieve->compare_revisions($rev1, $rev2);
    # {
    #   saying => [
    #       'i cannot brian today. i have the dumb',
    #       'i cannot brain today. i have the dumb'
    #   ]
    # }


"I use the Pensieve. One simply siphons the excess thoughts from one's mind, pours them into the basin, and examines them at one's leisure. It becomes easier to spot patterns and links, you understand, when they are in this form." - Albus Dumbledore

In the world of Harry Potter, a Pensieve is a magical device that allows a wizard to store and review his or her thoughts. Data::Pensieve serves a similar purpose for Perl applications, allowing you to easily record revision histories and analyze differences between revisions.

Data::Pensieve uses a DBIx::Class backend to store revision data.



Returns a new Data::Pensieve object. Takes the following required parameters.


Given a grouping, item, hash reference of data, and optional hash reference of metadata related to this change, stores a change.


Given a grouping and item number, returns all associated revisions.


Given a grouping and item number, returns the last revision.


Given two Data::Pensieve::Revision objects, returns a hash reference, keyed by column name, containing array references of the prior and current version of all changed data between the two provided revisions.


Same as compare_revisions(), but returns a diff between the two values instead of an array reference.


Data::Pensieve is intended as a quick & dirty, plug & play way to easily manage revisioned data.

If you're looking to do something more substantial, you probably want to consider journaling your data at the database level -- check out DBIx::Class::AuditLog or DBIx::Class::Journal.


Carp, DateTime, DateTime::Format::MySQL, DBIx::Class, List::Util, List::MoreUtils, Moose, Storable, Text::Diff


Michael Aquilina <>

Developed for Grant Street Group's Testafy (

syntax highlighting: