1 |
< |
# url handler -> returns the location of the file |
2 |
< |
# |
3 |
< |
# Interface |
1 |
> |
# url handler -> returns the location of thefilu Interface |
2 |
|
# --------- |
3 |
|
# new() : |
4 |
|
# new(cachedir) : A new urlhandler with a defined default cahce directory |
5 |
|
# get(url) : download from the specified url to the default cache |
6 |
|
# get(url,dirlocation) : download to the specified directory |
7 |
|
# setbase(type,variablehash) : set the url defaults for a specific url type |
8 |
< |
# arguments are dependent on type |
8 |
> |
# arguments are dependenton type |
9 |
|
# unsetbase(type) : deactivate a previously set base |
10 |
|
# setcache(dir) : set the default cache location |
11 |
|
# |
14 |
|
# can pass a file name for the item to be stored as |
15 |
|
# if not then stores in a default cache. |
16 |
|
|
17 |
< |
package URLhandler; |
17 |
> |
package URL::URLhandler; |
18 |
|
require 5.004; |
19 |
|
use Utilities::AddDir; |
20 |
|
use URL::URL_base; |
37 |
|
AddDir::adddir($cache); |
38 |
|
$self->{cache}=$cache; |
39 |
|
use URL::URL_cvs; |
40 |
+ |
use URL::URL_cvsfile; |
41 |
|
use URL::URL_file; |
42 |
|
$self->{urlmodules}={ |
43 |
< |
'cvs' => 'URL_cvs', |
44 |
< |
'file' => 'URL_file' |
43 |
> |
'cvsfile' => 'URL::URL_cvsfile', |
44 |
> |
'cvs' => 'URL::URL_cvs', |
45 |
> |
'file' => 'URL::URL_file' |
46 |
|
}; |
47 |
|
$self->{filebase}=""; |
48 |
|
$self->setbase("file", {}); # Base file as default |
68 |
|
if ( ! defined $dirname ) { |
69 |
|
$dirname=$self->{cache}; |
70 |
|
} |
71 |
– |
print "dirname = $dirname \n"; |
71 |
|
chdir $dirname or carp "Unable to Enter Directory $dirname $!\n"; |
72 |
|
chomp $origurl; |
73 |
|
# get our version info from the url (after last ??) |
90 |
|
else { |
91 |
|
$rv= |
92 |
|
eval{${$self->{urlostack}{$type}}[$#{$self->{urlostack}{$type}}]}-> |
93 |
< |
get($rest); |
93 |
> |
get($rest, $dirname); |
94 |
|
} |
95 |
|
} |
96 |
|
if ( $rv ne "" ) { |