Revision: | 1.1 |
Committed: | Fri Dec 17 08:46:09 1999 UTC (25 years, 4 months ago) by williamc |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | V1_0_4p1, V1_0_2, V1_0_2_p1, 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, V_18_3_TEST, VO_18_3, V0_18_2, V0_18_1, ProtoEnd |
Branch point for: | v103_branch, V1_pre1, SCRAM_V1_BRANCH, V0_19_4_B, HPWbranch |
Log Message: | Working Unit |
# | Content |
---|---|
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 | } |