blob: 5707a84c3450c91425d5ae792c50ac0b5a5bd5e4 (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
package FileLocator;
# ************************************************************
# Description : Base class for file locators.
# Author : Chad Elliott
# Create Date : 6/18/2002
# ************************************************************
# ************************************************************
# Pragmas
# ************************************************************
use strict;
use FileHandle;
# ************************************************************
# Subroutine Section
# ************************************************************
sub new {
my($class) = shift;
my($self) = bless {
}, $class;
return $self;
}
sub tmpnam {
my($self) = shift;
my($file) = shift;
my(@def) = ("/tmp", ".");
foreach my $possible ($ENV{TMPDIR}, $ENV{TEMP}, $ENV{TMP}, @def) {
if (defined $possible && -d $possible && -w $possible) {
$possible =~ s!\\!/!g;
return $possible . '/' . $$ . '_' . $> . '_' . $file;;
}
}
return $file;
}
sub process_errors {
my($self) = shift;
my($file) = shift;
my($error) = undef;
if (-s $file != 0) {
my($fh) = new FileHandle();
if (open($fh, $file)) {
$error = '';
while(<$fh>) {
$error .= $_;
}
close($fh);
$error =~ s/\s+$//;
}
}
unlink($file);
return $error;
}
sub locate {
my($self) = shift;
my(@dirs) = @_;
my(@modified) = ();
my(@removed) = ();
my(@conflicts) = ();
my(@unknown) = ();
return \@modified, \@removed, \@conflicts, \@unknown;
}
1;
|