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