diff options
author | Arne Georg Gleditsch <argggh@lxr.linpro.no> | 2007-11-27 01:19:48 +0100 |
---|---|---|
committer | Arne Georg Gleditsch <argggh@lxr.linpro.no> | 2007-11-27 01:19:48 +0100 |
commit | 96f381ccf53f4b0f9f17abceb0d7afb63dca6294 (patch) | |
tree | 1f9cf27a51d7481d3f0ef3eb0638993103fed664 | |
parent | f96ca283fc3c67a5cca850d6fce362d3b1ff83de (diff) |
Make phys_path persistent over object lifetime
-rw-r--r-- | lib/LXRng/Repo/Git/File.pm | 7 |
1 files changed, 5 insertions, 2 deletions
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; |