ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/ActiveDoc/Activate.pm
(Generate patch)

Comparing COMP/SCRAM/src/ActiveDoc/Activate.pm (file contents):
Revision 1.1 by williamc, Mon Aug 28 07:04:42 2000 UTC vs.
Revision 1.1.2.1 by williamc, Mon Aug 28 07:04:42 2000 UTC

# Line 0 | Line 1
1 + #
2 + # Easy Setup of cache etc for ActiveDoc enactivation
3 + #
4 + # Author : C.Williams
5 + #
6 + # Interface
7 + # ---------
8 + # new(location)         : Create a new activeation area at location
9 + # activatedoc($url)     : Return the object corresponding to the activedoc
10 + #                         provided by the url
11 + # get(url)              : download url and return the filename
12 + #                         of the processed doc
13 +
14 + package ActiveDoc::Activate;
15 + use ActiveDoc::ActiveDoc;
16 + use ActiveDoc::ActiveStore;
17 + use Utilities::Verbose;
18 +
19 + @ISA=qw(Utilities::Verbose);
20 +
21 +
22 + sub new {
23 +        my $class=shift;
24 +        my $self={};
25 +        bless $self, $class;
26 +
27 +        # -- initiate cgi work area
28 +        $self->{workarea}=shift;
29 +        $self->_initarea($self->{workarea});
30 +        return $self;
31 + }
32 +
33 + sub _initarea {
34 +        my $self=shift;
35 +        my $dir=shift;
36 +        $self->{dbstore}=ActiveDoc::ActiveStore->new($dir);
37 +        $self->{ad}=ActiveDoc::ActiveDoc->new($self->{dbstore});
38 + }
39 +
40 + sub get {
41 +        my $self=shift;
42 +        my $url=shift;
43 +        $self->verbose("Attempt to get $url");
44 +        my $file;
45 +        # We dont want it messaging
46 +        if ( eval { $file=$self->{ad}->getfile($url)->ProcessedFile() } ) {
47 +          return ($file, $@);
48 +        }
49 +        else {
50 +          return (undef, $@);
51 +        }
52 + }
53 +
54 + sub activatedoc {
55 +        my $self=shift;
56 +        my $url=shift;
57 +
58 +        my $obj;
59 +        $self->verbose("Attempting activation of $url");
60 +        if ( eval { $obj=$self->{ad}->activatedoc($url) } ) {
61 +          return ($obj, $@);
62 +        }
63 +        else {
64 +          return (undef, $@);
65 +        }
66 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines