line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package URI::Fetch::SimpleCache; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
19204
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
29
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw(URI::Fetch); |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
793
|
|
6
|
1
|
|
|
1
|
|
212635
|
use Cache::FileCache; |
|
1
|
|
|
|
|
54868
|
|
|
1
|
|
|
|
|
244
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
9
|
|
|
|
|
|
|
our $CACHE_ROOT = $ENV{'HOME'}; |
10
|
|
|
|
|
|
|
our $DEFAULT_EXPIRES; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub fetch { |
13
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
14
|
0
|
|
|
|
|
|
my($uri,%params) = @_; |
15
|
|
|
|
|
|
|
|
16
|
0
|
0
|
|
|
|
|
if ( ! $params{Cache} ) { |
17
|
0
|
0
|
|
|
|
|
if ( $params{'Cache_root'} ) { |
18
|
0
|
|
|
|
|
|
$CACHE_ROOT = delete $params{'Cache_root'}; |
19
|
|
|
|
|
|
|
} |
20
|
0
|
0
|
|
|
|
|
if ( $params{'Cache_default_expires'} ) { |
21
|
0
|
|
|
|
|
|
$DEFAULT_EXPIRES = delete $params{'Cache_default_expires'}; |
22
|
|
|
|
|
|
|
} |
23
|
0
|
|
|
|
|
|
$params{Cache} = Cache::FileCache->new({ |
24
|
|
|
|
|
|
|
'cache_root' => $CACHE_ROOT, |
25
|
|
|
|
|
|
|
'default_expires' => $DEFAULT_EXPIRES, |
26
|
|
|
|
|
|
|
}); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
|
$class->SUPER::fetch( ( $uri,%params ) ); |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
1; |
33
|
|
|
|
|
|
|
__END__ |