| MetaStore documentation | Contained in the MetaStore distribution. |
MetaStore::Item - Base class for collections.
use MetaStore::Item;
use base qw( MetaStore::Item );
Base class for collections.
Dump object state
Restore state
Get intem attributes
Get id of object
MetaStore, Collection::Item, README
Zahatski Aliaksandr, <zag@cpan.org>
Copyright (C) 2005-2006 by Zahatski Aliaksandr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
| MetaStore documentation | Contained in the MetaStore distribution. |
package MetaStore::Item;
use MetaStore::Base; use Data::Dumper; use strict; use warnings; our @ISA = qw( MetaStore::Base ); our $VERSION = '0.01'; __PACKAGE__->attributes qw/ __init_rec _attr/; sub _init { my $self = shift; my $ref = shift; $ref->{id} or die "Need id !".__PACKAGE__; _attr $self $ref->{attr}; __init_rec $self $ref; return $self->SUPER::_init(@_); } #method fo init sub _create { my $self = shift; } sub _changed { my $self = shift; if ( my $ar = tied %{ $self->_attr } ) { return $ar->_changed; } return 0; } sub _get_attr { my $self = shift; return $self->_attr; }
sub dump { my $self = shift; return $self->attr }
sub restore { my $self= shift; if ( my $attr = shift ) { %{ $self->attr } = %{$attr} } }
sub attr { return $_[0]->_attr }
sub id { my $self = shift; return $self->__init_rec->{id}; } 1; __END__