ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolCache.pm
Revision: 1.6
Committed: Tue Oct 18 14:59:26 2011 UTC (13 years, 6 months ago) by muzaffar
Content type: text/plain
Branch: MAIN
CVS Tags: V2_2_5_pre2, V2_2_5_pre1, V2_2_4, V2_2_4_pre9, V2_2_4_pre8, V2_2_4_pre7, V2_2_4_pre6, V2_2_4_pre5, V2_2_4_pre4, V2_2_4_pre3, V2_2_4_pre2, V2_2_4_pre1, HEAD
Changes since 1.5: +0 -3 lines
Log Message:
removed cvs $id statement

File Contents

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