line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Puppet::Storage ; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
600
|
use Carp ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
66
|
|
4
|
1
|
|
|
1
|
|
5
|
use AutoLoader 'AUTOLOAD' ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
35
|
use strict ; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
32
|
|
7
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION %ClassData) ; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
110
|
|
8
|
|
|
|
|
|
|
$VERSION = sprintf "%d.%03d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
%ClassData = (dbHash => undef, keyRoot => undef ); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# translucent attribute (See Tom Christiansen's perltootc page) |
13
|
|
|
|
|
|
|
# creates accessor methods for all keys of ClassData. |
14
|
|
|
|
|
|
|
for my $datum (keys %ClassData) |
15
|
|
|
|
|
|
|
{ |
16
|
1
|
|
|
1
|
|
7
|
no strict "refs"; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
536
|
|
17
|
|
|
|
|
|
|
*$datum = sub |
18
|
|
|
|
|
|
|
{ |
19
|
0
|
|
|
0
|
|
|
my $self = shift ; |
20
|
0
|
|
0
|
|
|
|
my $class = ref($self) || $self ; |
21
|
0
|
0
|
|
|
|
|
unless (ref($self)) |
22
|
|
|
|
|
|
|
{ |
23
|
0
|
0
|
|
|
|
|
$ClassData{$datum} = shift if @_ ; |
24
|
0
|
|
|
|
|
|
return $ClassData{$datum} ; |
25
|
|
|
|
|
|
|
} |
26
|
0
|
0
|
|
|
|
|
$self->{$datum} = shift if @_ ; |
27
|
0
|
0
|
|
|
|
|
return defined $self->{$datum} ? $self->{$datum} : $ClassData{$datum}; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub new |
32
|
|
|
|
|
|
|
{ |
33
|
0
|
|
|
0
|
1
|
|
my $type = shift ; |
34
|
0
|
|
|
|
|
|
my $self = {} ; |
35
|
0
|
|
|
|
|
|
my %args = @_ ; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
bless $self,$type ; |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
local $_ ; |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
|
|
|
croak("You must pass a name to Puppet::Storage") |
42
|
|
|
|
|
|
|
unless defined $args{name}; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
$self->{name}=$args{name} ; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
foreach (qw/dbHash keyRoot/) |
47
|
|
|
|
|
|
|
{ |
48
|
0
|
|
|
|
|
|
$self->{$_} = delete $args{$_} ; |
49
|
0
|
0
|
|
|
|
|
croak "You must define $_ to Puppet::Storage $self->{name}" |
50
|
|
|
|
|
|
|
unless defined $self->$_() ; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$self->{myDbKey} = $self->keyRoot.";".$self->{name} ; |
54
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
|
return $self; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
__END__ |