diff options
author | dakkar <dakkar@luxion> | 2007-09-08 11:51:05 +0000 |
---|---|---|
committer | dakkar <dakkar@luxion> | 2007-09-08 11:51:05 +0000 |
commit | ca459459e37d29ff76a90cc457fb85f7d524b441 (patch) | |
tree | 7eeeaf65421c2564b77bff73d40adaa854678bd3 /lib/File/Cache | |
parent | cache is now updated on 'put' (diff) | |
download | WebCoso-ca459459e37d29ff76a90cc457fb85f7d524b441.tar.gz WebCoso-ca459459e37d29ff76a90cc457fb85f7d524b441.tar.bz2 WebCoso-ca459459e37d29ff76a90cc457fb85f7d524b441.zip |
symlink following, and most parsers for the test
git-svn-id: svn://luxion/repos/WebCoso/trunk@284 fcb26f47-9200-0410-b104-b98ab5b095f3
Diffstat (limited to 'lib/File/Cache')
-rw-r--r-- | lib/File/Cache/Parsed.pm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/File/Cache/Parsed.pm b/lib/File/Cache/Parsed.pm index 1546ef1..f6930d3 100644 --- a/lib/File/Cache/Parsed.pm +++ b/lib/File/Cache/Parsed.pm @@ -3,16 +3,18 @@ use strict; use warnings; use List::Util qw(first); use List::MoreUtils qw(firstidx); +use Cwd 'abs_path'; use Path::Class; use Carp; sub new { - my ($class)=@_; + my ($class,%opts)=@_; return bless { parsers=>[], writers=>[], cache=>{}, + follow=>$opts{follow}, }=>$class; } @@ -58,6 +60,10 @@ sub del_parser { sub get { my ($self,$filename)=@_; + if ($self->{follow}) { + $filename=abs_path($filename); + } + return $self->{cache}{$filename} if exists $self->{cache}{$filename}; my $contents=file($filename)->slurp; |