Hi thank you very much for your reply. Unfortunately, it's now working due to this error: --------------------------------------------------- Bareword "KERNEL" not allowed while "strict subs" in use at try.pm line 31. Compilation failed in require at ./script.pl line 8. BEGIN failed--compilation aborted at ./script.pl line 8. POE::Kernel's run() method was never called. ---------------------------------------------------- Line 8 of script.pl is: "use try;"
this is how the function is called: ------------------from script.pl:------------------- sub irc::irc_public { my ($kernel, $who, $chan, $msg) = @_[KERNEL, ARG0 .. ARG2]; if ($msg =~ /\@try ?(.+)?/i) { if ($1) { try->try($kernel, $1, $who); } } } ---------------------------------------------------- If you need any other information, please tell me, cause I'm dying to get it fixed :) again, thanks for your reply Bart Erick Calder wrote: > Bart, > > the session you are creating needs an alias set to "try" since you're > telling the ftp client to use "try" to send its events... > > you can do it like this: > > sub start { > $_[KERNEL]->alias_set("try"); > print "*** test\n"; > } > > dngnand was going to add an arg to the session create function so you could > name it at creation time... but I don't know if that's released yet. > > - e > > -----Original Message----- > From: Bart [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, September 17, 2002 3:04 AM > To: [EMAIL PROTECTED] > Subject: POE::Component::Client::FTP problem > > > 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 > } > ); > } >