Posted on 2007-01-21 23:39:18-08 by thom
POE::Component::Generic and Net::FTP
Hello. I'm a little confused about how I can spawn a new session when using PoCo::Generic with Net::FTP. Net::FTP needs the host and port in new(), and both SSH2 and Telnet used in the examples returns "empty" objects which you call either open() or connect() on. Maybe I could do something like below? I'm not sure how I can have the results for it returned to a function though..
my $ftp = POE::Component::Generic->spawn( package => 'Net::FTP', object_options => [{Host=>'localhost',Port=>26000,Debug=>1} ], alias => 'telnet', debug => 1, verbose => 1, }
I thought about making a "wrapper" module for Net::FTP which returns an object with a ftp_login() function that does both the connection and login (this would be most convenient), and returns the result in e.g connected or failed_connect. I'm not sure how exactly i could make that wrapper module (I'm still pretty new to OO), or if this is the right approach. Anyone have any tips on how I should do this? Thanks Thom
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.