From ca459459e37d29ff76a90cc457fb85f7d524b441 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 8 Sep 2007 11:51:05 +0000 Subject: symlink following, and most parsers for the test git-svn-id: svn://luxion/repos/WebCoso/trunk@284 fcb26f47-9200-0410-b104-b98ab5b095f3 --- lib/File/Cache/Parsed.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'lib/File') 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; -- cgit v1.2.3