Revision: | 1.1 |
Committed: | Fri Oct 1 09:54:08 1999 UTC (25 years, 7 months ago) by williamc |
Content type: | text/plain |
Branch: | MAIN |
CVS Tags: | V1_1_7, V1_1_6, V1_1_5, V1_2_0-cand3, V1_2_0-cand2, V1_2_0-cand1, V1_1_4, V1_1_3, V1_1_2, V1_1_0_reltag8, V1_1_0_reltag7, V1_1_0_reltag6, V1_1_1, V1_1_0_reltag5, V1_1_0_reltag4, V1_1_0_reltag3, V1_1_0_reltag2, V1_1_0_reltag1, V1_1_0_reltag, V1_0_3-p4, V1_1_0_cand3, V1_1_0_cand2, V1_1_0_cand1, HEAD_SM_071214, forV1_1_0, v103_xml_071106, V1_0_3-p3, V1_0_3-p2, V1_1_0, v110p1, V110p6, V110p5, V110p4, V110p3, before110xmlBRmerge, V110p2, V110p1, V1_0_4p1, V1_0_3-p1, V1_0_3, 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: | forBinLess_SCRAM, HEAD_BRANCH_SM_071214, v200branch, v103_with_xml, v103_branch, V1_pre1, SCRAM_V1_BRANCH, V0_19_4_B, HPWbranch |
Log Message: | Use file directly - no copying |
# | User | Rev | Content |
---|---|---|---|
1 | williamc | 1.1 | # |
2 | # standard url interface for local file - direct use no copying to cache | ||
3 | # | ||
4 | # Interface | ||
5 | # --------- | ||
6 | # new() : | ||
7 | # setbase() : | ||
8 | # unsetbase() : | ||
9 | # get(url, destination) : | ||
10 | |||
11 | package URL::URL_filed; | ||
12 | require 5.001; | ||
13 | use File::Copy; | ||
14 | use URL::URL_base; | ||
15 | @ISA=qw(URL::URL_base); | ||
16 | |||
17 | sub new { | ||
18 | my $class=shift; | ||
19 | $self={}; | ||
20 | bless $self, $class; | ||
21 | $self->{path}=""; | ||
22 | return $self; | ||
23 | } | ||
24 | |||
25 | sub setbase { | ||
26 | my $self=shift; | ||
27 | my $varhash=shift; | ||
28 | |||
29 | if ( exists $$varhash{'base'} ) { | ||
30 | $self->{path}=$$varhash{'base'}; | ||
31 | } | ||
32 | } | ||
33 | |||
34 | sub unsetbase { | ||
35 | my $self=shift; | ||
36 | $self->{path}=""; | ||
37 | } | ||
38 | |||
39 | sub get { | ||
40 | my $self=shift; | ||
41 | my $file=shift; | ||
42 | my $dir=shift; # Were not copying anything so this is irrelevant | ||
43 | |||
44 | my $rv=""; | ||
45 | my $urlfile=$file; | ||
46 | |||
47 | if ( $file!~/^\// ) { | ||
48 | $urlfile=$self->{path}."/".$file; | ||
49 | } | ||
50 | if ( -e "$urlfile" ) { | ||
51 | $rv=$urlfile; | ||
52 | } | ||
53 | return $rv; | ||
54 | } |