blob: 0a1c768c9f4523ad2533086e1515e7d029e7c644 (
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
|
package FTPTest;
use strict;
use warnings;
use FTPServer;
use WgetTests;
our @ISA = qw(WgetTest);
my $VERSION = 0.01;
{
my %_attr_data = ( # DEFAULT
);
sub _default_for
{
my ($self, $attr) = @_;
return $_attr_data{$attr} if exists $_attr_data{$attr};
return $self->SUPER::_default_for($attr);
}
sub _standard_keys
{
my ($self) = @_;
($self->SUPER::_standard_keys(), keys %_attr_data);
}
}
sub _setup_server
{
my $self = shift;
$self->{_server} = FTPServer->new(
input => $self->{_input},
server_behavior => $self->{_server_behavior},
LocalAddr => 'localhost',
ReuseAddr => 1,
rootDir => "$self->{_workdir}/$self->{_name}/input"
)
or die "Cannot create server!!!";
}
sub _launch_server
{
my $self = shift;
my $synch_func = shift;
$self->{_server}->run($synch_func);
}
sub _substitute_port
{
my $self = shift;
my $ret = shift;
$ret =~ s/\Q{{port}}/$self->{_server}->sockport/eg;
return $ret;
}
1;
# vim: et ts=4 sw=4
|