ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolCache.pm
Revision: 1.5
Committed: Fri Jan 14 17:36:42 2011 UTC (14 years, 3 months ago) by muzaffar
Content type: text/plain
Branch: MAIN
CVS Tags: V2_2_3, forV2_2_3
Changes since 1.4: +24 -131 lines
Log Message:
merged SCRAM_V2 branch in to head

File Contents

# Content
1 #____________________________________________________________________
2 # File: ToolCache.pm
3 #____________________________________________________________________
4 #
5 # Author: Shaun Ashby <Shaun.Ashby@cern.ch>
6 # Update: 2003-10-28 10:14:08+0100
7 # Revision: $Id: ToolCache.pm,v 1.4.10.2 2010/12/07 10:15:31 muzaffar Exp $
8 #
9 # Copyright: 2003 (C) Shaun Ashby
10 #
11 #--------------------------------------------------------------------
12 package BuildSystem::ToolCache;
13 require 5.004;
14
15 use Exporter;
16 @ISA=qw(Exporter);
17 #
18 sub new()
19 {
20 my $proto=shift;
21 my $class=ref($proto) || $proto;
22 my $self={};
23 $self->{SETUP}={};
24 bless $self,$class;
25 return $self;
26 }
27
28 sub setup()
29 {
30 my $self=shift;
31 return $self->{SETUP};
32 }
33
34 sub name()
35 {
36 my $self = shift;
37 # Set the name of the cache file:
38 @_ ? $self->{CACHENAME} = shift #
39 : $self->{CACHENAME};
40 }
41
42 sub dirty()
43 {
44 my $self = shift;
45 $self->{internal}{dirty}=1;
46 }
47
48 sub isdirty()
49 {
50 my $self = shift;
51 my $dirty = $self->{internal}{dirty} || 0;
52 return $dirty;
53 }
54
55 sub writecache()
56 {
57 my $self=shift;
58 if (exists $self->{internal}{dirty})
59 {
60 my $file=$self->{CACHENAME};
61 delete $self->{internal};
62 use Cache::CacheUtilities;
63 &Cache::CacheUtilities::write($self,$file);
64 }
65 }
66
67 1;
68