NAME

AttributesWithHistory - An example attribute metaclass which keeps a history of changes

SYSNOPSIS

package Foo;

Foo->meta->add_attribute(AttributesWithHistory->new('foo' => (
    accessor         => 'foo',
    history_accessor => 'get_foo_history',
)));    

Foo->meta->add_attribute(AttributesWithHistory->new('bar' => (
    reader           => 'get_bar',
    writer           => 'set_bar',
    history_accessor => 'get_bar_history',
)));    

sub new  {
    my $class = shift;
    $class->meta->new_object(@_);
}

DESCRIPTION

This is an example of an attribute metaclass which keeps a record of all the values it has been assigned. It stores the history as a field in the attribute meta-object, and will autogenerate a means of accessing that history for the class which these attributes are added too.

AUTHORS

Stevan Little <stevan@iinteractive.com>

Yuval Kogman <nothingmuch@woobling.com>

COPYRIGHT AND LICENSE

Copyright 2006-2008 by Infinity Interactive, Inc.

http://www.iinteractive.com

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.