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.14 by williamc, Thu May 18 14:57:30 2000 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines