Perl/wecker.pl: Difference between revisions

From Linuxwiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 2: Line 2:
#!/usr/bin/perl
#!/usr/bin/perl


# script for automagic pop-ups
# Usage: perl wecker.pl <popup message>
# Usage: perl wecker.pl 'popup message'
# Depends: perl-tk
# Depends: perl-tk


Line 10: Line 11:
use Encode qw(decode encode);
use Encode qw(decode encode);


my $input = $ARGV[0];
my $text = $ARGV[0];
my $message = decode("utf8", $input);
my $message = decode('utf8', $text);
$message = "Reminder" unless $ARGV[0];
$message = 'Reminder' unless $text;


my $main = MainWindow->new;
my $main = MainWindow->new;
$main -> Label( -text=>$message, -height=>"20", -width=>"40")->pack;
$main -> Label(-text=>$message, -height=>"40", -width=>"80")->pack;
$main -> Button( -text=>'quit', -command=>'exit')->pack;
$main -> Button(-text=>'quit', -command=>'exit',)->pack;


MainLoop;
MainLoop;

</pre>
</pre>

Latest revision as of 18:47, 3 August 2023

#!/usr/bin/perl

# script for automagic pop-ups
# Usage: perl wecker.pl 'popup message'
# Depends: perl-tk

use strict;
use Tk;
use utf8;
use Encode qw(decode encode);

my $text = $ARGV[0];
my $message = decode('utf8', $text);
$message = 'Reminder' unless $text;

my $main = MainWindow->new;
$main -> Label(-text=>$message, -height=>"40", -width=>"80")->pack;
$main -> Button(-text=>'quit', -command=>'exit',)->pack;

MainLoop;