From 96f381ccf53f4b0f9f17abceb0d7afb63dca6294 Mon Sep 17 00:00:00 2001 From: Arne Georg Gleditsch Date: Tue, 27 Nov 2007 01:19:48 +0100 Subject: Make phys_path persistent over object lifetime --- lib/LXRng/Repo/Git/File.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'lib/LXRng/Repo/Git') diff --git a/lib/LXRng/Repo/Git/File.pm b/lib/LXRng/Repo/Git/File.pm index b0bb9a3..c624b5b 100644 --- a/lib/LXRng/Repo/Git/File.pm +++ b/lib/LXRng/Repo/Git/File.pm @@ -62,6 +62,8 @@ sub revision { sub phys_path { my ($self) = @_; + return $$self{'phys_path'} if exists $$self{'phys_path'}; + my $tmpdir = tempdir() or die($!); open(my $phys, ">", $tmpdir.'/'.$self->node) or die($!); @@ -73,8 +75,9 @@ sub phys_path { close($handle); close($phys) or die($!); - return LXRng::Repo::TmpFile->new(dir => $tmpdir, - node => $self->node); + return $$self{'phys_path'} = + LXRng::Repo::TmpFile->new(dir => $tmpdir, + node => $self->node); } 1; -- cgit v1.2.3