Curses and AnyEvent
Mike Schilli
anyevent at perlmeister.com
Fri Jan 25 07:11:49 CET 2013
On Wed, 23 Jan 2013, Marc Lehmann wrote:
> That means that failing everything else, one could use that POE module
> - AnyEvent should just work on top of POE or whatever POE uses.
Ou la la, and it works indeed.
--
-- Mike
anyevent at perlmeister.com
#!/usr/local/bin/perl -w
use strict;
use Curses::UI::POE;
use AnyEvent;
my $CUI = Curses::UI::POE->new(
-color_support => 1 );
my $WIN = $CUI->add("win_id", "Window");
my $text = "type [q] to quit";
my $counter = 1;
my $TOP = $WIN->add( qw( top Label
-y 0 -width -1 -paddingspaces 1
-fg white -bg blue
), -text => $text );
my $timer = AnyEvent->timer(
after => 0,
interval => 1,
cb => sub {
$TOP->text( $text .
" (" . $counter++ . ")" );
$TOP->draw();
},
);
$CUI->set_binding(sub { exit 0; }, "q");
$CUI->mainloop;
More information about the anyevent
mailing list