Hi, I have problems to get Expect.pm working within the builtin test server.
The following code resides inside a model: use Expect; my $exp = Expect->new; $exp->log_stdout(0); $exp->spawn('ssh', '-l' => $c->config->{client}{user}, $c->config->{client}{host}) or die "Can't spawn ssh"; $exp->expect( $c->config->{client}{timeout}, [ 'Connection closed by remote host', sub { die "SSH failed (connection closed)"; }, ], [ 'lost connection', sub { die "SSH failed (lost connection)"; }, ], [ 'Enter passphrase', sub { print $exp $self->password . "\r"; exp_continue; }, ], ); $exp->clear_accum; # bin/command prints something like »herewego >foobarblubb« # I want the part after the »>«. print $exp "bin/command" . "\r"; if ( !$exp->expect($c->config->{client}{timeout}, 'herewego >') ) { die "failure in remote command"; }; my $wanted = $exp->after; Using the default test server (Catalyst::Engine::HTTP, script/myapp_server.pl -r -d), $wanted is empty, but setting CATALYST_ENGINE='HTTP::Prefork' sets $wanted to the expected value. If I set $exp->exp_internal(1), then the last log message looks like spawn id(7): Does `bin/command\r\n' match: pattern #1: -ex `herewego >'? No. Anyone else used Expect.pm and got this behaviour? I use Catalyst::Engine::HTTP from Catalyst-Runtime-5.8000_06. Thanks, Frank _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/