10 |
|
# --------- |
11 |
|
# new(URLcache) : A new SimpleURLDoc object |
12 |
|
# addbasetags(parse) : Add Base Tags to the given parse |
13 |
< |
# urlget(urlstring) : get the given url. Returns (url, filename) |
13 |
> |
# urlget(urlstring[,location]) : get the given url. Returns (url, filename) |
14 |
> |
# cache([cache]) : get/set the current URL cache |
15 |
|
|
16 |
|
package ActiveDoc::SimpleURLDoc; |
17 |
|
use ActiveDoc::SimpleDoc; |
22 |
|
my $class=shift; |
23 |
|
my $self={}; |
24 |
|
bless $self, $class; |
25 |
< |
$self->{cache}=shift; |
25 |
< |
$self->{urlhandler}=URL::URLhandler->new($self->{cache}); |
25 |
> |
$self->cache(shift); |
26 |
|
$self->{switch}=ActiveDoc::SimpleDoc->new(); |
27 |
|
return $self; |
28 |
|
} |
36 |
|
\&Base_end,$self); |
37 |
|
} |
38 |
|
|
39 |
+ |
sub cache { |
40 |
+ |
my $self=shift; |
41 |
+ |
if ( @_ ) { |
42 |
+ |
$self->{cache}=shift; |
43 |
+ |
$self->{urlhandler}=URL::URLhandler->new($self->{cache}); |
44 |
+ |
} |
45 |
+ |
return $self->{cache}; |
46 |
+ |
} |
47 |
+ |
|
48 |
|
sub urlget { |
49 |
|
my $self=shift; |
50 |
|
my $urlstring=shift; |
51 |
< |
($fullurl,$filename)=$self->{urlhandler}->get($urlstring); |
51 |
> |
|
52 |
> |
($fullurl,$filename)=$self->{urlhandler}->get($urlstring, @_); |
53 |
|
if ( ( ! defined $filename ) || ( $filename eq "" ) ) { |
54 |
|
$self->{switch}->parseerror("Failed to get $fullurl"); |
55 |
|
} |