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.11 by williamc, Wed Nov 17 19:14:38 1999 UTC vs.
Revision 1.12 by williamc, Wed Mar 1 11:28:53 2000 UTC

# Line 59 | Line 59 | sub get {
59          $url->expandurl($self->currentbase($type));
60          my $fullurl=$url->url();
61  
62 <        my $location=$self->{cache}->file($fullurl);
63 <        if ( $location ne "" ) {
64 <          $file=$self->{cache}->file($location);
65 <          #print " Already defined file --".$location." -- ".$file."\n";
66 <        }
67 <        else {
62 >        $file=$self->{cache}->file($fullurl);
63 >        if ( $file eq "" ) {
64            ($fullurl,$file)=$self->download($origurl, @_);
65          }
66          return ($fullurl, $file);
# Line 74 | Line 70 | sub download {
70          my $self=shift;
71          my $origurl=shift;
72  
77        print "downloading $origurl\n";
73          # Process the URL string
74          my $url=URL::URLclass->new($origurl);
75          my $type=$url->type();
# Line 82 | Line 77 | sub download {
77          $url->expandurl($self->currentbase($type));
78  
79          # Generate a location name if not provided
80 +        $nocache=1;
81          if ( @_ ) {
82             $location=shift;
83 +           $nocache=0; # dont cache if downloaded to an external location
84          }
85          else {
86             $location=$self->{cache}->filename($url->url());
# Line 95 | Line 92 | sub download {
92          }
93  
94          # now register it in the cache if successful
95 <        if ( $file ) {
95 >        if ( $file && $nocache) {
96            $self->{cache}->store($url->url(), $location);
100          $self->{cache}->store($location, $file);
97          }
98          return ($url->url(), $file);
99   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines