File: demo-language

package info (click to toggle)
libcurses-ui-perl 0.9609-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,312 kB
  • sloc: perl: 12,464; makefile: 2
file content (49 lines) | stat: -rwxr-xr-x 951 bytes parent folder | download | duplicates (7)
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
47
48
49
#!/usr/bin/perl -w
use strict;
use warnings;

use FindBin;
use lib "$FindBin::RealBin/../lib";
use Curses::UI;
use File::Spec;
use File::Temp qw ( :POSIX );

my $debug = 0;
my $fh = tmpfile();
open STDERR, ">&$fh";
 
if (@ARGV and $ARGV[0] eq '-d') {
    $debug = 1;
}

my $cui = new Curses::UI (
    -clear_on_exit => 0,
    -debug         => $debug,
);



my $filename;
foreach my $mod (keys %INC) {
	$filename  = $INC{$mod} if ($mod =~ /UI\.pm/);
}

$filename =~ s/\.pm//gi;
$filename = File::Spec->catfile($filename, "Language");

opendir DIR, "$filename" or die "Couldn't open language dir $filename: $!\n";
my @entries = grep /\.pm$/, sort readdir(DIR);
map s/\.pm$//, @entries;

$cui->dialog( "This demo will present all languages of Curses::UI to you\n" .
	      join "\n", @entries);

foreach my $entry (@entries) {
	my $lang = new Curses::UI::Language("$entry");

	$cui->lang($lang);

	$cui->dialog("\u$entry");

	$cui->savefilebrowser();
}