File: demo_util

package info (click to toggle)
libperlmenu-perl 4.0-8
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 556 kB
  • sloc: perl: 4,691; makefile: 8
file content (77 lines) | stat: -rwxr-xr-x 2,373 bytes parent folder | download | duplicates (2)
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/local/bin/perl5
#**************************************************************************
# demo_util --  Demonstate some utilities in menuutil.pl
#
# Notes:   Perl4 - Requires curseperl
#          Perl5 - Requires William Setzer's "Curses" extension
#
#          Demostrates some basic curses techniques via a set of
#          utility routines (which can also be snipped or built on).
#
# Author:  Steven L. Kunz
#          Networked Applications
#          Iowa State University Computation Center
#          Ames, IA  50011
#          Email: skunz@iastate.edu
#
# Date:    February 1997
#**************************************************************************

# Perl5+Curses ONLY!
# Comment these lines for use with Perl4/curseperl
BEGIN { $Curses::OldCurses = 1; }
use Curses;                     # PerlMenu needs "Curses"
use perlmenu;                   # Main menu package (Perl5 only)
require "./menuutil.pl";        # For "pause" and "print_nl" routines.

# Perl4/curseperl ONLY!
# Uncomment these lines for use with Perl4/curseperl
# (Did you remember to run "create_menu.pl"?)
#require "./menu.pl";           # Main menu package (Perl4 only)
#require "./menuutil.pl";       # For "pause" and "print_nl" routines.

$| = 1;				# Flush after every write to stdout

#
# Required global variables are $window, $row, and $col.
# These variables are used by the menuutil.pl routines.
#
$window = $row = $col = 0;

# Init the curses environment
  $window = &menu_init();

# Clear screen and center a top title.
  &top_title("PerlMenu Utility Routine Demo");

# Put out a couple lines.
  &print_nl("The first line (followed by two new-lines).",2);
  &print_nl("The second line.",1);

# Pause (with the default prompt);
  &pause("");

# Put out a couple more lines.
  &print_nl("The third line",1);
  &print_nl("The fourth line",2);

# See if they want to see the last line.
  if (&query("Do you want to see a pop-up \"ask\" box?","yn") eq "n") {
    &new_line(1);
    &print_nl("Sigh ... and it was the best demo!",1);
    if (&query("Are you SURE you don't want to see it?","yn") eq "y") {
      &endwin;
      exit(0);
    }
  }

# Do the pop-up query.
  $name = &popup_ask("Please enter your first name: ",20);
  &pause("Goodbye, $name.  Press any key to exit");

# All done - clean up and go home.
  &clear_screen();
  &refresh();
  &endwin;
  exit(0);