1 |
williamc |
1.1 |
#
|
2 |
|
|
# ActiveConfig.pm
|
3 |
|
|
#
|
4 |
|
|
# Originally Written by Christopher Williams
|
5 |
|
|
#
|
6 |
|
|
# Description
|
7 |
|
|
#
|
8 |
|
|
# Interface
|
9 |
|
|
# ---------
|
10 |
|
|
# new(directory) : A new ActiveConfig object
|
11 |
|
|
# cache() : Return the cache
|
12 |
|
|
# store(object,@keys) :
|
13 |
|
|
# find (@keys) :
|
14 |
|
|
|
15 |
|
|
package ActiveDoc::ActiveConfig;
|
16 |
|
|
require 5.004;
|
17 |
|
|
use URL::URLcache;
|
18 |
|
|
use ObjectUtilities::ObjectStore;
|
19 |
|
|
|
20 |
|
|
sub new {
|
21 |
|
|
my $class=shift;
|
22 |
|
|
$self={};
|
23 |
|
|
bless $self, $class;
|
24 |
|
|
$self->init(@_);
|
25 |
|
|
return $self;
|
26 |
|
|
}
|
27 |
|
|
|
28 |
|
|
sub init {
|
29 |
|
|
my $self=shift;
|
30 |
|
|
my $dir=shift;
|
31 |
|
|
|
32 |
|
|
$self->{objectstore}=ObjectUtilities::ObjectStore->
|
33 |
|
|
new($dir."/ObjectStore", $self);
|
34 |
|
|
$self->{cache}=URL::URLcache->new($dir."/cache");
|
35 |
|
|
}
|
36 |
|
|
|
37 |
|
|
sub cache {
|
38 |
|
|
my $self=shift;
|
39 |
|
|
return $self->{cache};
|
40 |
|
|
}
|
41 |
|
|
|
42 |
|
|
sub AUTOLOAD { # Call any method in the ObjectStore directly
|
43 |
|
|
my $self=shift;
|
44 |
|
|
my $call;
|
45 |
|
|
|
46 |
|
|
# dont propogate a destroy method
|
47 |
|
|
return if $AUTOLOAD=~/::DESTROY$/;
|
48 |
|
|
|
49 |
|
|
($call=$AUTOLOAD)=~s/^.*:://;
|
50 |
|
|
return $self->{objectstore}->$call(@_);
|
51 |
|
|
}
|