Revision: | 1.2 |
Committed: | Tue Oct 17 13:05:55 2000 UTC (24 years, 6 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 |
Branch point for: | SCRAM_V1_BRANCH, V0_19_4_B |
Changes since 1.1: | +1 -1 lines |
Log Message: | Fixed paramupdate method |
# | Content |
---|---|
1 | # |
2 | # BuildClass.pm |
3 | # |
4 | # Originally Written by Christopher Williams |
5 | # |
6 | # Description |
7 | # |
8 | # Interface |
9 | # --------- |
10 | # new() : A new BuildClass object |
11 | # child() : return a new object that is a copy of the object |
12 | # paramupdate($hashref) : update variable hash according to provided hashref |
13 | # paramlist() : return a list of all params that have been set |
14 | # param(name) : return value of given param - undef if undefined |
15 | |
16 | package BuildSystem::BuildClass; |
17 | require 5.004; |
18 | |
19 | sub new { |
20 | my $class=shift; |
21 | my $type=ref($class) || $class; |
22 | my $self={}; |
23 | bless $self, $type; |
24 | return $self; |
25 | } |
26 | |
27 | sub child { |
28 | my $self=shift; |
29 | my $child=$self->new(); |
30 | $child->paramupdate($self->{vars}); |
31 | return $child; |
32 | } |
33 | |
34 | sub paramlist { |
35 | my $self=shift; |
36 | return (keys %{$self->{vars}}); |
37 | } |
38 | |
39 | sub param { |
40 | my $self=shift; |
41 | my $name=shift; |
42 | |
43 | my $rv=undef; |
44 | if ( exists $self->{vars}{$name} ) { |
45 | $rv=$self->{vars}{$name}; |
46 | } |
47 | return $rv; |
48 | } |
49 | |
50 | sub paramupdate { |
51 | my $self=shift; |
52 | my $hashref=shift; |
53 | |
54 | foreach $key ( keys %$hashref ) { |
55 | $self->{vars}{$key}=$$hashref{$key}; |
56 | } |
57 | } |