For Programmers: Free Programming Magazines  


Home > Archive > PERL POE > June 2006 > WG: Issue with POE::Wheel::ReadLine









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author WG: Issue with POE::Wheel::ReadLine
Angerstein

2006-06-27, 8:10 am

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

Should do the same as:

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

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

-----Urspr=FCngliche Nachricht-----
Von: Angerstein [mailto:ang@nmc-m.dtag.de]=20
Gesendet: Dienstag, 27. Juni 2006 14:20
An: poe@perl.org
Betreff: Issue with POE::Wheel::ReadLine


Hello there,=20
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=B4t 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 =3D> {
_start =3D> \&sys_start,
word =3D> \&word,
input =3D> \&input,
_stop =3D> \&sys_exit,
},
);

$poe_kernel->run();

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

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

sub input {
#echo input
my ($heap, $input, $exception) =3D @_[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();
}





Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com