Revision: | 1.1.2.1 |
Committed: | Fri Aug 4 08:21:25 2000 UTC (24 years, 9 months ago) by williamc |
Content type: | text/plain |
Branch: | HPWbranch |
CVS Tags: | BuildSystemProto1, 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, V0_15_0beta, V0_14_0 |
Branch point for: | V0_17branch, V0_16branch, V0_15branch |
Changes since 1.1: | +0 -0 lines |
Log Message: | Add to branch |
# | User | Rev | Content |
---|---|---|---|
1 | williamc | 1.1 | # |
2 | # standard url interface for local file | ||
3 | # | ||
4 | # Interface | ||
5 | # --------- | ||
6 | # new() : | ||
7 | # setbase() : | ||
8 | # unsetbase() : | ||
9 | # get(url, destination) : | ||
10 | |||
11 | package URL_http; | ||
12 | require 5.001; | ||
13 | use LWP::Simple; | ||
14 | |||
15 | sub new { | ||
16 | my $class=shift; | ||
17 | $self={}; | ||
18 | bless $self, $class; | ||
19 | $self->{path}=""; | ||
20 | return $self; | ||
21 | } | ||
22 | |||
23 | sub setbase { | ||
24 | my $self=shift; | ||
25 | my $varhash=shift; | ||
26 | |||
27 | if ( exists $$varhash{'base'} ) { | ||
28 | $self->{path}=$$varhash{'base'}; | ||
29 | } | ||
30 | } | ||
31 | |||
32 | sub unsetbase { | ||
33 | my $self=shift; | ||
34 | $self->{path}=""; | ||
35 | } | ||
36 | |||
37 | sub get { | ||
38 | my $self=shift; | ||
39 | my $url=shift; | ||
40 | my $filename=shift; | ||
41 | |||
42 | my $urlfile; | ||
43 | |||
44 | $fullurl=$self->{path}.$url; | ||
45 | open (STORE, ">$filename") || carp "unable to open file $filename $!\n"; | ||
46 | print STORE (get 'http:'.$urlfile); | ||
47 | close STORE; | ||
48 | } |