Hi
I'm trying to run Poco::Client::FTP in a self-made module file, but somehow,
it's going wrong.
I execute the function "try::try($kernel, $1, $who);" somewhere in the main
.pl file. The try function searches for $adname ($1) in the database, and if
it can find it, it logs into the ftp with the host/ip user/pass for that
ftp. Everything is going fine, POE connects to the server, executes the
start function as it should ("*** test" gets printed) and logs in. Then, it
should execute the inline authenticated() function, but it doesn't. I have
absolutely no idea why this is. The other 2 functions won't get executed
either, when they should.
Does anyone have an idea of what's going wrong ?
Thanks
Bart
----------------------------------------------------------------------
use strict;
use warnings;
sub POE::Component::Client::FTP::DEBUG () { 1 };
use POE qw (Session Component::Client::FTP);
package try;
return 1;
sub login_error {
print "*** no login\n";
}
sub authenticated {
print "*** yes\n";
}
sub connect_error {
print "*** no connection\n";
}
sub start {
print "*** test\n";
}
sub try {
my ($kernel, $adname, $who) = @_;
my $number = -1;
my $counter = 0;
my $ftp = main::getAdByName($adname);
while ($number < 0) {
if (!$main::leeches[$counter]) {
$number = $counter;
}
$counter ++;
}
POE::Component::Client::FTP->spawn(
Alias => "try",
Username => $main::database[$ftp][4],
Password => $main::database[$ftp][5],
RemoteAddr => $main::database[$ftp][2],
RemotePort => $main::database[$ftp][3],
Timeout => 5,
Events => [qw (authenticated login_error connect_error
cmd_connected) ]
);
POE::Session->create(
inline_states => {
authenticated => sub { print "test"; }, #DOES NOT
GET EXECUTED
_start => \&start, #>>> GETS EXECUTED <<<
login_error => \&login_error, #DOES NOT GET EXECUTED
cmd_connected => sub { print "CONNECTED
!!!!!!!!\n"; }, #DOES NOT GET EXECUTED
connect_error => \&connect_error, #DOES NOT GET
EXECUTED
}
);
}