Hello list!

I am struggling with a particular problem using Curses::UI. I am trying
to display a constantly refreshing clock in the curses interface without
much success. I've tried using a while loop instead of the mainloop()
provided by Curses::UI, and still no effect.

Here's a snippet of my code:

use warnings;
use strict;
use Curses::UI;
use Curses;
use POSIX qw(strftime);

my $timeout = 1;
my $date_display = strftime("%Y-%m-%d %H:%M:%S",localtime);

my $main_ui = new Curses::UI( -color_support => 1, -userdata =>
$date_display, -clear_on_exit => 0 );

my $main_window = $main_ui->add(
                'main_win', 'Window',
);

my $clock_widget = $main_window->add(
                'clock', 'Label',
                -x => 90,
                -y => 1,
                -border => 1,
                -title => "Clock",
                -text => $date_display,
);

$main_ui->draw();
$main_window->draw;
$clock_widget->draw;

my $count = 0;
while (1)
{
  $count = $count +1;
  $main_ui->draw;
  $main_window->draw;
  $clock_widget->draw;
}

Can anyone point out my newbie mistakes? What am I missing here?

Cheers,
Callan

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to