File: zenity.pl

package info (click to toggle)
libsystem-sub-perl 0.162800-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 196 kB
  • sloc: perl: 253; sh: 6; makefile: 2
file content (24 lines) | stat: -rwxr-xr-x 528 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env perl
use lib '../lib';
use System::Sub 'zenity';

# The sub will die if status is not 0
# But exit status of zenity is 1 for the cancel button
# so we have to catch that
eval {
    zenity '--question',
           '--no-markup',
           '--title' => 'System::Sub test',
	   '--text' => 'How are you today?',
	   '--ok-label' => 'Fine!',
	   '--cancel-label' => 'Tired.';
};

my $status = $? >> 8;
print "$status\n";

if ($status == 0) {
    print "Great!\n"
} elsif ($status == 1) {
    print "Have a nap!\n"
}