ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/BuildSystem/ToolCache.pm
Revision: 1.4.10.2
Committed: Tue Dec 7 10:15:31 2010 UTC (14 years, 5 months ago) by muzaffar
Content type: text/plain
Branch: SCRAM_V2_0
CVS Tags: V2_2_2, V2_2_2_pre4
Changes since 1.4.10.1: +8 -1 lines
Log Message:
automatically update symlinks when a tool is setup

File Contents

# User Rev Content
1 sashby 1.2 #____________________________________________________________________
2     # File: ToolCache.pm
3     #____________________________________________________________________
4     #
5     # Author: Shaun Ashby <Shaun.Ashby@cern.ch>
6     # Update: 2003-10-28 10:14:08+0100
7 muzaffar 1.4.10.2 # Revision: $Id: ToolCache.pm,v 1.4.10.1 2008/03/13 12:54:50 muzaffar Exp $
8 sashby 1.2 #
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 muzaffar 1.4.10.1 my $class=ref($proto) || $proto;
22     my $self={};
23     $self->{SETUP}={};
24 sashby 1.2 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 muzaffar 1.4.10.1
42     sub dirty()
43     {
44     my $self = shift;
45     $self->{internal}{dirty}=1;
46     }
47 sashby 1.2
48 muzaffar 1.4.10.2 sub isdirty()
49     {
50     my $self = shift;
51     my $dirty = $self->{internal}{dirty} || 0;
52     return $dirty;
53     }
54    
55 sashby 1.2 sub writecache()
56     {
57     my $self=shift;
58 muzaffar 1.4.10.1 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 sashby 1.2 }
66    
67     1;
68