/usr/share/doc/libio-async-loop-glib-perl/examples/timer.pl is in libio-async-loop-glib-perl 0.21-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | #!/usr/bin/perl
use strict;
use warnings;
use IO::Async::Loop::Glib;
use IO::Async::Timer::Periodic;
use Gtk2 -init;
my $loop = IO::Async::Loop::Glib->new;
my $dialog = Gtk2::MessageDialog->new( undef,
'destroy-with-parent',
'info',
'none',
"Hello world!"
);
$dialog->get_content_area->add( my $message = Gtk2::Label->new );
$loop->add( my $timer = IO::Async::Timer::Periodic->new(
interval => 1,
on_tick => sub { $message->set_text( "Time is now " . scalar localtime ) },
) );
$dialog->add_button( "Start", 1 )->signal_connect(
clicked => sub {
$timer->start;
}
);
$dialog->add_button( "Stop", 2 )->signal_connect(
clicked => sub {
$timer->stop;
$message->set_text( "" );
}
);
$dialog->add_button( "Quit", 'close' )->signal_connect(
clicked => sub { $loop->loop_stop }
);
$dialog->show_all;
$loop->loop_forever;
|