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 |
|
|
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); |
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(); |
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()); |
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 |
|
} |