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.13 by williamc, Wed Mar 29 09:48:33 2000 UTC

# Line 40 | Line 40 | sub init {
40          use URL::URL_cvs;
41          use URL::URL_cvsfile;
42          use URL::URL_file;
43 +        use URL::URL_test;
44          use URL::URL_filed;
45          $self->{urlmodules}={
46                          'cvsfile' => 'URL::URL_cvsfile',
47                          'cvs' => 'URL::URL_cvs',
48                          'file' => 'URL::URL_file',
49 <                        'filed' => 'URL::URL_filed'
49 >                        'filed' => 'URL::URL_filed',
50 >                        'test' => 'URL::URL_test'
51                  };
52   }
53  
# Line 59 | Line 61 | sub get {
61          $url->expandurl($self->currentbase($type));
62          my $fullurl=$url->url();
63  
64 <        my $location=$self->{cache}->file($fullurl);
65 <        if ( $location ne "" ) {
64 <          $file=$self->{cache}->file($location);
65 <          #print " Already defined file --".$location." -- ".$file."\n";
66 <        }
67 <        else {
64 >        $file=$self->{cache}->file($fullurl);
65 >        if ( $file eq "" ) {
66            ($fullurl,$file)=$self->download($origurl, @_);
67          }
68          return ($fullurl, $file);
# Line 74 | Line 72 | sub download {
72          my $self=shift;
73          my $origurl=shift;
74  
77        print "downloading $origurl\n";
75          # Process the URL string
76          my $url=URL::URLclass->new($origurl);
77          my $type=$url->type();
# Line 82 | Line 79 | sub download {
79          $url->expandurl($self->currentbase($type));
80  
81          # Generate a location name if not provided
82 +        $nocache=1;
83          if ( @_ ) {
84             $location=shift;
85 +           $nocache=0; # dont cache if downloaded to an external location
86          }
87          else {
88             $location=$self->{cache}->filename($url->url());
# Line 95 | Line 94 | sub download {
94          }
95  
96          # now register it in the cache if successful
97 <        if ( $file ) {
97 >        if ( $file && $nocache) {
98            $self->{cache}->store($url->url(), $location);
100          $self->{cache}->store($location, $file);
99          }
100          return ($url->url(), $file);
101   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines