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_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: | Working Unit |
# | 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_label; | ||
12 | require 5.001; | ||
13 | |||
14 | sub new { | ||
15 | my $class=shift; | ||
16 | $self={}; | ||
17 | bless $self, $class; | ||
18 | $self->{db}=""; | ||
19 | return $self; | ||
20 | } | ||
21 | |||
22 | sub setbase { | ||
23 | my $self=shift; | ||
24 | my $varhash=shift; | ||
25 | |||
26 | if ( exists $$varhash{'base'} ) { | ||
27 | $self->{db}=$$varhash{'base'}; | ||
28 | } | ||
29 | } | ||
30 | |||
31 | sub unsetbase { | ||
32 | my $self=shift; | ||
33 | $self->{db}=""; | ||
34 | } | ||
35 | |||
36 | sub get { | ||
37 | my $self=shift; | ||
38 | my $label=shift; | ||
39 | my $filename=shift; | ||
40 | my $returnval=""; | ||
41 | |||
42 | my $urlfile; | ||
43 | |||
44 | open ( LOOKUP, "<$self->{db}" ) | ||
45 | || die "URLhandler: Unable to open DataBase $self->{db} $!"; | ||
46 | while ( <LOOKUP> ) { | ||
47 | next if /^#/; | ||
48 | if ( $_=~s/^$label\:// ) { | ||
49 | $returnval = urlhandler($_,$filename); | ||
50 | } | ||
51 | } | ||
52 | close LOOKUP; | ||
53 | if ( $returnval ne "" ) { | ||
54 | return $returnval; | ||
55 | } | ||
56 | ($proj,$ver)=split /:/, $label; | ||
57 | print "Error : Unknown project name or version (".$proj." ".$ver.")\n"; | ||
58 | carp; | ||
59 | } |