blob: bc9024a74a407e2d4e340c227a672210c01d6f53 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
package LXRng::Repo::TmpFile;
# This package is used to hold on to a reference to a physical copy of
# a file normally only present inside a repo of some sort. When it
# leaves scopy, the destructor will remove it. (The object acts as
# string containing the path of the physical manifestation of the
# file.)
use strict;
use overload '""' => \&filename;
sub new {
my ($class, %args) = @_;
return bless(\%args, $class);
}
sub filename {
my ($self) = @_;
return $$self{'dir'}.'/'.$$self{'node'};
}
sub DESTROY {
my ($self) = @_;
unlink($$self{'dir'}.'/'.$$self{'node'});
rmdir($$self{'dir'});
}
1;
|