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.15 by williamc, Fri Aug 4 07:47:43 2000 UTC vs.
Revision 1.15.2.7 by williamc, Mon Aug 28 07:03:29 2000 UTC

# Line 5 | 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(urlstring) : set a base url 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 + # expandurl(urlstring) : return the base expanded URLclass of the given string
12   #
13   # ----------------------------------------------------------------------
14  
# Line 69 | Line 70 | sub download {
70          my $type=$url->type();
71          $urltypehandler=$self->_typehandler($type);
72          $url->merge($self->currentbase($type));
73 +        #print "Attempting download of ".$url->url()."\n";
74  
75          # Generate a location name if not provided
76 <        $nocache=1;
76 >        my $nocache=1;
77          if ( @_ ) {
78             $location=shift;
79             $nocache=0; # dont cache if downloaded to an external location
# Line 86 | Line 88 | sub download {
88          }
89  
90          # now register it in the cache if successful
91 <        if ( $file && $nocache) {
92 <          $self->{cache}->store($url->url(), $location);
93 <        }
94 <        return ($url->url(), $file);
91 >        if ( $file ne "" ) {
92 >         if ( $file && $nocache) {
93 >          #$self->{cache}->store($url->url(), $location);
94 >          $self->{cache}->store($url->url(), $file);
95 >         }
96 >        }
97 >        return ($url->url(), $file, $urltypehandler->error());
98 > }
99 >
100 > sub expandurl {
101 >        my $self=shift;
102 >        my $urlstring=shift;
103 >
104 >        my $url=URL::URLclass->new($urlstring);
105 >        my $type=$url->type();
106 >        $url->merge($self->currentbase($type));
107 >        return $url;
108   }
109  
110   sub setbase {
# Line 101 | Line 116 | sub setbase {
116          $self->checktype($type);
117          # make a new base-url object
118          push @{$self->{"basestack"}{$type}}, $base;
119 +        return $base;
120   }
121  
122   sub unsetbase {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines