line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MetaStore::Item; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=head1 NAME |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
MetaStore::Item - Base class for collections. |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 SYNOPSIS |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use MetaStore::Item; |
10
|
|
|
|
|
|
|
use base qw( MetaStore::Item ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Base class for collections. |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 METHODS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
319
|
use MetaStore::Base; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use Data::Dumper; |
23
|
|
|
|
|
|
|
use strict; |
24
|
|
|
|
|
|
|
use warnings; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
our @ISA = qw( MetaStore::Base ); |
27
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
28
|
|
|
|
|
|
|
use WebDAO; |
29
|
|
|
|
|
|
|
__PACKAGE__->mk_attr( __init_rec=>undef, _attr=>undef); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _init { |
33
|
|
|
|
|
|
|
my $self = shift; |
34
|
|
|
|
|
|
|
my $ref = shift; |
35
|
|
|
|
|
|
|
$ref->{id} or die "Need id !".__PACKAGE__; |
36
|
|
|
|
|
|
|
_attr $self $ref->{attr}; |
37
|
|
|
|
|
|
|
__init_rec $self $ref; |
38
|
|
|
|
|
|
|
return $self->SUPER::_init(@_); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
#method fo init |
42
|
|
|
|
|
|
|
sub _create { |
43
|
|
|
|
|
|
|
my $self = shift; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _changed { |
47
|
|
|
|
|
|
|
my $self = shift; |
48
|
|
|
|
|
|
|
if ( my $ar = tied %{ $self->_attr } ) { |
49
|
|
|
|
|
|
|
return $ar->_changed; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
return 0; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _get_attr { |
55
|
|
|
|
|
|
|
my $self = shift; |
56
|
|
|
|
|
|
|
return $self->_attr; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 dump |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Dump object state |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=cut |
64
|
|
|
|
|
|
|
sub dump { |
65
|
|
|
|
|
|
|
my $self = shift; |
66
|
|
|
|
|
|
|
return $self->attr |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 restore () |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Restore state |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
sub restore { |
75
|
|
|
|
|
|
|
my $self= shift; |
76
|
|
|
|
|
|
|
if ( my $attr = shift ) { |
77
|
|
|
|
|
|
|
%{ $self->attr } = %{$attr} |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 attr |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Get intem attributes |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub attr { |
88
|
|
|
|
|
|
|
return $_[0]->_attr |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 id |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Get id of object |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub id { |
98
|
|
|
|
|
|
|
my $self = shift; |
99
|
|
|
|
|
|
|
return $self->__init_rec->{id}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
__END__ |