ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/Utilities/Architecture.pm
Revision: 1.1
Committed: Fri Dec 17 10:23:15 1999 UTC (25 years, 5 months ago) by williamc
Content type: text/plain
Branch: MAIN
CVS Tags: V0_19_7, V0_19_6, V0_19_6p1, V0_19_5, SFATEST, V0_19_4, V0_19_4_pre3, V0_19_4_pre2, V0_19_4_pre1, V0_19_3, V0_19_2, V0_19_1, V0_19_0, V0_18_5, V0_18_4, V_18_3_TEST, VO_18_3, V0_18_2, V0_18_1, ProtoEnd
Branch point for: SCRAM_V1_BRANCH, V0_19_4_B
Log Message:
*** empty log message ***

File Contents

# Content
1 #
2 # Provide machine/architecture information services
3 # simply set the architecture variable based on uname
4 #
5 # ---------
6 # Interface
7 # ---------
8 # new() : new object - will autoinitialise to architecture
9 # getarch() : return the current (assumed) architecture
10 # archfile($filename,$base) : Will check various relevant architecture specific
11 # dirs in search for an architecture specific $file
12 # starting from base
13
14 package Architecture;
15 require 5.001;
16
17 sub new {
18 my $class=shift;
19 $self={};
20 bless $self, $class;
21 $self->_initarch();
22 return $self;
23 }
24
25 sub getarch {
26 my $self=shift;
27 return $self->{arch};
28 }
29
30 sub archfile {
31 my $self=shift;
32 my $filename=shift;
33 my $base=shift;
34
35 my $archdir;
36
37 foreach $dir ( @{$self->{archdirs}} ) {
38 $archdir=$base."/".$dir."/".$filename;
39 if ( -f $archdir ) {
40 return $self->{archdir};
41 }
42 }
43 }
44
45 # ------------ Support Routines ---------------------------------
46
47 sub _initarch {
48 my $self=shift;
49
50 $self->{realarch}=$;
51 # Seperate Variables means we can pretend to be other architectures
52 $self->{arch}=$self->{realarch};
53
54 # get the hostname
55 use Sys::Hostname;
56 $self->{host}=hostname();
57
58 # Architecture directory search path
59 @{$self->{archdirs}}=( $self->{arch}."/".$self->{host}, "$self->{arch}" );
60 }