Revision: | 1.3 |
Committed: | Mon Jan 24 17:36:58 2000 UTC (25 years, 3 months ago) by williamc |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | v102p1, V1_0_1, V1_0_0, V1_pre0, SCRAM_V1, SCRAMV1_IMPORT, 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, V0_18_2, BuildSystemProto1, V0_18_1, V0_18_0, V0_18_0model, V0_17_1, V0_18_0alpha, V0_17_0, V0_16_4, V0_16_3, V0_16_2, V0_16_1, V0_16_0, V0_15_1, V0_15_0, ProtoEnd, V0_15_0beta |
Branch point for: | V1_pre1, SCRAM_V1_BRANCH, V0_19_4_B, V0_17branch, V0_16branch, V0_15branch, HPWbranch |
Changes since 1.2: | +2 -2 lines |
Log Message: | New TestClass namespace |
# | Content |
---|---|
1 | # |
2 | # testObject.pm |
3 | # |
4 | # Originally Written by Christopher Williams |
5 | # |
6 | # Description |
7 | # ----------- |
8 | # Persistent testObject used in the ObjectStore unit test |
9 | # |
10 | # Interface |
11 | # --------- |
12 | # new(name) : A new testObject object |
13 | # store(filhandle) : store to filehandle |
14 | # restore(filehandle) : restore from filehandle |
15 | # name() : return the name it was initialised with |
16 | |
17 | package ObjectUtilities::test::testObject; |
18 | use ObjectUtilities::StorableObject; |
19 | require 5.004; |
20 | @ISA=qw(ObjectUtilities::StorableObject); |
21 | |
22 | sub new { |
23 | my $class=shift; |
24 | my $name=shift; |
25 | $self={}; |
26 | $self->{name}=$name; |
27 | bless $self, $class; |
28 | return $self; |
29 | } |
30 | |
31 | sub name { |
32 | my $self=shift; |
33 | return $self->{name}; |
34 | } |
35 | |
36 | sub store { |
37 | my $self=shift; |
38 | my $location=shift; |
39 | my $fh=$self->openfile(">".$location); |
40 | |
41 | print $fh $self->{name}; |
42 | $fh->close(); |
43 | } |
44 | |
45 | sub restore { |
46 | my $self=shift; |
47 | my $location=shift; |
48 | my $fh=$self->openfile("<".$location); |
49 | |
50 | $self->{name}=<$fh>; |
51 | close $fh; |
52 | } |