From: Peter E. <pe...@bo...> - 2004-05-27 18:54:37
|
>> [ Hey, for those that only know sermons and not gospel, point me to the >> FTPS.pm and I'll gladly use that then suffer through this drama. ] > > Maybe you can make one using Expect so the rest of us can avoid > the suffering. > Certainly. ... >> use Carp; >> use Expect; > > Toss a little debugging in. > $Expect::Debug=1; > $Expect::Exp_Internal=1; > Cool... > You're creating a bit of extra work here by not creating a lexical to > hold $self->{_exp}. It looks like this fouls you up below. > Try this: > >> $self->{_exp} = new Expect; > $expect = $self->{_exp}; > Seems reasonable to me. ... >> >> $self->{_exp}->expect($self->{_timeout}, >> [ qr/Name /i, sub { my $self = shift; >> $self->send($user . "\n"); > ^^^^^^^^^^^ > > Does '$self' have a send method? $self->{_exp}->send()? or, better > yet, $expect->send(). The 'my $self = shift; $self->send()' all happens within the instance of Expect. The little trick of using $self within a sequence seems pretty nifty, but I've changed it to $exp... the result is the same. > >> exp_continue; }], >> [ qr/Password:/i, sub { my $self = shift; >> $self->send($pass . "\n"); > ^^^^^^^^^^^ >> exp_continue; }], >> $self->{_prompt}); > > > Try fixing that, and turn on debugging. > Note that if I ran it from the command-line (real tty) it ran fine. For example, when I run it as a daemon the log file found in /tmp/exp-$$ only logs this: [root@fubar root]# cat /tmp/exp-25225 Connected to secureftp.some.gvmt.office. 220- Department of Human Service Secure Transport site! 220- 220 Secure FTP Server ready. If I run it from the command line: [root@fubar root]# cat /tmp/exp-18484 Connected to secureftp.some.gvmt.office. 220- Department of Human Service Secure Transport site! 220- 220 Secure FTP Server ready. Name (secureftp.some.gvmt.office:root): 234 SSLv23/TLSv1 [TLSv1/SSLv3, cipher DES-CBC3-SHA, 168 bits] 331 Password required for username. Password: 230 Virtual user username logged in. 235 PBSZ=0 200 PROT command successful TLS/SSL protection of data connections on. Remote system type is UNIX. Using binary mode to transfer files. ftps> 250 CWD command successful. ftps> 200 PORT command successful. 150 Opening ASCII mode SSL data connection for file list. total 353677 -rwxrwxrwx 1 root 2000 61009251 May 20 08:54 965713400_RiskAdj_20040519.dat -rwxrwxrwx 1 root 2000 59063559 Feb 20 15:42 965713400_RiskAdj_risk.dat -rwxrwxrwx 1 root 2000 61009251 May 18 17:24 965713400_RiskAdj_risk_051904.dat 226 Transfer complete. ftps> local: /home/rs/tp/username/to-username/.965713400_RiskAdj_20040519.dat remote: 965713400_RiskAdj_20040519.dat 200 PORT command successful. 150 Opening BINARY mode SSL data connection for 965713400_RiskAdj_20040519.dat. 1% 648 KB 06:03 ETA Yeah, I can turn off the verbose stuff at some point... Other thoughts? Thanks, peter |