2007-06-14 12:05:59 -04:00
|
|
|
package FTPTest;
|
|
|
|
|
|
|
|
use strict;
|
2008-11-12 15:18:27 -05:00
|
|
|
use warnings;
|
2007-06-14 12:05:59 -04:00
|
|
|
|
|
|
|
use FTPServer;
|
2014-09-24 10:40:03 -04:00
|
|
|
use WgetTests;
|
2007-06-14 12:05:59 -04:00
|
|
|
|
2007-07-12 02:10:48 -04:00
|
|
|
our @ISA = qw(WgetTest);
|
2007-06-14 12:05:59 -04:00
|
|
|
my $VERSION = 0.01;
|
|
|
|
|
|
|
|
{
|
2014-11-01 05:06:26 -04:00
|
|
|
my %_attr_data = ( # DEFAULT
|
2007-06-14 12:05:59 -04:00
|
|
|
);
|
2008-11-13 06:29:59 -05:00
|
|
|
|
2007-06-14 12:05:59 -04:00
|
|
|
sub _default_for
|
|
|
|
{
|
|
|
|
my ($self, $attr) = @_;
|
|
|
|
return $_attr_data{$attr} if exists $_attr_data{$attr};
|
|
|
|
return $self->SUPER::_default_for($attr);
|
|
|
|
}
|
|
|
|
|
2009-09-21 23:39:44 -04:00
|
|
|
sub _standard_keys
|
2007-06-14 12:05:59 -04:00
|
|
|
{
|
|
|
|
my ($self) = @_;
|
|
|
|
($self->SUPER::_standard_keys(), keys %_attr_data);
|
|
|
|
}
|
|
|
|
}
|
2008-11-13 06:29:59 -05:00
|
|
|
|
2014-11-01 05:06:26 -04:00
|
|
|
sub _setup_server
|
|
|
|
{
|
2007-06-14 12:05:59 -04:00
|
|
|
my $self = shift;
|
|
|
|
|
2014-11-01 05:06:26 -04:00
|
|
|
$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!!!";
|
2007-06-14 12:05:59 -04:00
|
|
|
}
|
|
|
|
|
2014-11-01 05:06:26 -04:00
|
|
|
sub _launch_server
|
|
|
|
{
|
|
|
|
my $self = shift;
|
2007-06-14 12:05:59 -04:00
|
|
|
my $synch_func = shift;
|
2009-09-06 02:08:55 -04:00
|
|
|
|
2014-11-01 05:06:26 -04:00
|
|
|
$self->{_server}->run($synch_func);
|
2008-06-12 05:18:35 -04:00
|
|
|
}
|
2007-06-14 12:05:59 -04:00
|
|
|
|
2014-11-01 05:06:26 -04:00
|
|
|
sub _substitute_port
|
|
|
|
{
|
2008-06-12 05:18:35 -04:00
|
|
|
my $self = shift;
|
2014-11-01 05:06:26 -04:00
|
|
|
my $ret = shift;
|
2008-06-12 05:18:35 -04:00
|
|
|
$ret =~ s/{{port}}/$self->{_server}->sockport/eg;
|
|
|
|
return $ret;
|
2007-06-14 12:05:59 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
1;
|
|
|
|
|
|
|
|
# vim: et ts=4 sw=4
|