ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/SCRAM/src/URL/URLhandler.pm
(Generate patch)

Comparing COMP/SCRAM/src/URL/URLhandler.pm (file contents):
Revision 1.13 by williamc, Wed Mar 29 09:48:33 2000 UTC vs.
Revision 1.15.2.2 by williamc, Fri Aug 4 12:57:47 2000 UTC

# Line 1 | Line 1
1 # url handler -> returns the location of the file
1   # Interface
2   # ---------
3   # new(cache)       : A new urlhandler with a defined default cahce directory
# Line 6 | Line 5
5   # get(url,[location]) : download from the specified url to cache or location
6   #                       return the full url path name incl. any base expansion
7   #                       and the filename downloaded to
8 < # setbase(type,variablehash) : set the url defaults for a specific url type
10 < #                              arguments are dependent on type
8 > # setbase(urlstring) : set a base url type - return the url object
9   # unsetbase(type)  : deactivate a previously set base
10   # currentbase(type) : return the current base for the given type
11   #
# Line 18 | Line 16 | require 5.004;
16   use Utilities::AddDir;
17   use URL::URLcache;
18   use URL::URLclass;
21 use URL::URLbase;
19   use Carp;
20  
21   sub new {
# Line 35 | Line 32 | sub init {
32          my $self=shift;
33          my $cache=shift;
34          $self->{cache}=$cache;
38        $self->{dummybase}=URL::URLbase->new({});
35          $self->{cachestore}=$self->{cache}->filestore();
36          use URL::URL_cvs;
41        use URL::URL_cvsfile;
37          use URL::URL_file;
38          use URL::URL_test;
44        use URL::URL_filed;
39          $self->{urlmodules}={
46                        'cvsfile' => 'URL::URL_cvsfile',
40                          'cvs' => 'URL::URL_cvs',
41                          'file' => 'URL::URL_file',
49                        'filed' => 'URL::URL_filed',
42                          'test' => 'URL::URL_test'
43                  };
44   }
# Line 58 | Line 50 | sub get {
50  
51          my $url=URL::URLclass->new($origurl);
52          my $type=$url->type();
53 <        $url->expandurl($self->currentbase($type));
53 >        $url->merge($self->currentbase($type));
54          my $fullurl=$url->url();
55  
56          $file=$self->{cache}->file($fullurl);
# Line 76 | Line 68 | sub download {
68          my $url=URL::URLclass->new($origurl);
69          my $type=$url->type();
70          $urltypehandler=$self->_typehandler($type);
71 <        $url->expandurl($self->currentbase($type));
71 >        $url->merge($self->currentbase($type));
72  
73          # Generate a location name if not provided
74          $nocache=1;
# Line 102 | Line 94 | sub download {
94  
95   sub setbase {
96          my $self=shift;
97 <        my $type=shift;
106 <        my @args=@_;
107 <        my $oref;
97 >        my $partialurl=shift;
98  
99 +        my $base=URL::URLclass->new($partialurl);
100 +        my $type=$base->type();
101          $self->checktype($type);
102 <        # make a new base object
111 <        my $base=URL::URLbase->new(@_);
102 >        # make a new base-url object
103          push @{$self->{"basestack"}{$type}}, $base;
104 +        return $base;
105   }
106  
107   sub unsetbase {
# Line 141 | Line 133 | sub currentbase {
133            $rv=${$self->{basestack}{$type}}[$#{$self->{basestack}{$type}}];
134          }
135          else {
136 <          $rv=$self->{dummybase};
136 >          $rv=undef;
137          }
138          return $rv;
139   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines