| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PITA::Guest::Driver; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2365
|
use 5.008; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
37
|
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
31
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use Carp (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
14
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use File::Temp (); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
14
|
|
|
7
|
1
|
|
|
1
|
|
3970
|
use File::Remove (); |
|
|
1
|
|
|
|
|
3797
|
|
|
|
1
|
|
|
|
|
30
|
|
|
8
|
1
|
|
|
1
|
|
9
|
use Params::Util (); |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
22
|
|
|
9
|
1
|
|
|
1
|
|
717
|
use PITA::XML (); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.60'; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
##################################################################### |
|
18
|
|
|
|
|
|
|
# Constructor and Accessors |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub new { |
|
21
|
|
|
|
|
|
|
my $class = shift; |
|
22
|
|
|
|
|
|
|
my $self = bless { @_ }, $class; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Were we passed the guest object |
|
25
|
|
|
|
|
|
|
unless ( Params::Util::_INSTANCE($self->guest, 'PITA::XML::Guest') ) { |
|
26
|
|
|
|
|
|
|
Carp::croak('Missing or invalid guest'); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Get ourselves a fresh tmp directory |
|
30
|
|
|
|
|
|
|
unless ( $self->injector_dir ) { |
|
31
|
|
|
|
|
|
|
$self->{injector_dir} = File::Temp::tempdir(); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
unless ( -d $self->injector_dir and -w _ ) { |
|
34
|
|
|
|
|
|
|
die("Temporary directory " . $self->injector_dir . " is not writable"); |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
$self->{pid} = $$; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$self; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub guest { |
|
42
|
|
|
|
|
|
|
$_[0]->{guest}; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub injector_dir { |
|
46
|
|
|
|
|
|
|
$_[0]->{injector_dir}; |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
##################################################################### |
|
54
|
|
|
|
|
|
|
# PITA::Guest::Driver Main Methods |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub ping { |
|
57
|
|
|
|
|
|
|
my $self = shift; |
|
58
|
|
|
|
|
|
|
Carp::croak(ref($self) . " failed to implement 'ping'"); |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub discover { |
|
62
|
|
|
|
|
|
|
my $self = shift; |
|
63
|
|
|
|
|
|
|
Carp::croak(ref($self) . " failed to implement 'discover'"); |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub test { |
|
67
|
|
|
|
|
|
|
my $self = shift; |
|
68
|
|
|
|
|
|
|
Carp::croak(ref($self) . " failed to implement 'test'"); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
##################################################################### |
|
76
|
|
|
|
|
|
|
# Support Methods |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
# Is the param a fully resolved request |
|
79
|
|
|
|
|
|
|
# To be usable, it needs an identifier and an absolute filename path |
|
80
|
|
|
|
|
|
|
# that can be verified to exist. |
|
81
|
|
|
|
|
|
|
# Returns the request or undef if not usable. |
|
82
|
|
|
|
|
|
|
sub _REQUEST { |
|
83
|
|
|
|
|
|
|
my $self = shift; |
|
84
|
|
|
|
|
|
|
my $request = Params::Util::_INSTANCE(shift, 'PITA::XML::Request') or return undef; |
|
85
|
|
|
|
|
|
|
$request->id or return undef; |
|
86
|
|
|
|
|
|
|
File::Spec->file_name_is_absolute( $request->file->filename ) or return undef; |
|
87
|
|
|
|
|
|
|
-f $request->file->filename or return undef; |
|
88
|
|
|
|
|
|
|
$request; |
|
89
|
|
|
|
|
|
|
} |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
sub DESTROY { |
|
92
|
|
|
|
|
|
|
# Delete the temp dirs, ignoring errors |
|
93
|
|
|
|
|
|
|
if ( |
|
94
|
|
|
|
|
|
|
$_[0]->{pid} == $$ |
|
95
|
|
|
|
|
|
|
and |
|
96
|
|
|
|
|
|
|
$_[0]->{injector_dir} |
|
97
|
|
|
|
|
|
|
and |
|
98
|
|
|
|
|
|
|
-d $_[0]->{injector_dir} |
|
99
|
|
|
|
|
|
|
) { |
|
100
|
|
|
|
|
|
|
File::Remove::remove( \1, $_[0]->{injector_dir} ); |
|
101
|
|
|
|
|
|
|
delete $_[0]->{injector_dir}; |
|
102
|
|
|
|
|
|
|
} |
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
1; |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
__END__ |