The code should do the same as this code...

Should do the same as:

sub word {
  my $kernel = $_[KERNEL];
  my $session = $_[SESSION];
  my $heap = $_[HEAP];
  my @args = @_[ARG0..ARG9];
  my $input = <STDIN>;
  $kernel->yield( 'input', $input );
}

sub input {
  #echo input
  my ($heap, $kernel, $input) = @_[HEAP, KERNEL, ARG0];
  if (defined $input) {
    print $input;
    undef ($input);
  } else {
    $input = <STDIN>;
  }
  $kernel->yield( 'input', $input );
}

-----Ursprüngliche Nachricht-----
Von: Angerstein [mailto:[EMAIL PROTECTED] 
Gesendet: Dienstag, 27. Juni 2006 14:20
An: [email protected]
Betreff: Issue with POE::Wheel::ReadLine


Hello there, 
I have a Problem with the ReadLine Wheel both on my Windows and my Unix
Box.

On Windows:
Your vendor has not defined POSIX macro B38400, used at
C:/perl/site/lib/POE/Whe el/ReadLine.pm line 700
        (in cleanup) Can't call method "Tputs" on an undefined value at
C:/perl/ site/lib/POE/Wheel/ReadLine.pm line 911.

On Unix:
Failed termcap lookup on dtterm at .../ReadLine.pm line 709 (in
cleanup). Can´t call methode "Tputs" on an undefined value at
../ReadLine.pm Line 911.

I added the code at the end of the Mail.

Any ideas?

Thx Bastian

The Code:
use strict;
#use warnings;
use POE qw( Wheel::ReadLine );

POE::Session->create(
  inline_states => {
    _start => \&sys_start,
    word => \&word,
    input => \&input,
    _stop  => \&sys_exit,
     },
);

$poe_kernel->run();

sub sys_start {
  my $kernel = $_[KERNEL];
  print "Just Starting Up\n";
  $kernel->yield( 'word' );
  print "sys_start fertig!\n";
}

sub word {
  my $kernel = $_[KERNEL];
  my $session = $_[SESSION];
  my $heap = $_[HEAP];
  my @args = @_[ARG0..ARG9];
  print "Starte Word!\n";
  $heap->{read} = POE::Wheel::ReadLine->new(
    InputEvent   => 'input',
    appname => 'mycli'
  );
  $heap->{read}->get( 'Prompt: ' );
  print "Word fertig!\n"
}

sub input {
#echo input
 my ($heap, $input, $exception) = @_[HEAP, ARG0, ARG1];
  if (defined $input) {
      $heap->{read}->addhistory($input);
      $heap->{read}->put("Got: $input");
      $heap->{read}->get('Prompt: ');
    }
    else {
      $heap->{read}->put("Exception: $exception");
    }
    $heap->{read}->clear();
}





Reply via email to