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