Path: usenet.cis.ufl.edu!usenet.eel.ufl.edu!news.iag.net!newsboy.utelfla.com!news.sprintlink.net!psgrain!nntp.teleport.com!usenet
From: [email protected] (Steven L. Kunz)
Newsgroups: comp.lang.perl.announce,comp.lang.perl.misc,comp.lang.perl
Subject: ANNOUNCE: perlmenus version 3.2
Date: 1 Jun 1995 22:23:09 GMT
Organization: Iowa State University, Ames, Iowa
Lines: 203
Approved: [email protected] (comp.lang.perl.announce)
Message-ID: <[email protected]>
NNTP-Posting-Host: linda.teleport.com
Xref: usenet.cis.ufl.edu comp.lang.perl.announce:22 comp.lang.perl.misc:293 comp.lang.perl:51102

---------------------------------
Announcing Perl Menus Version 3.2
---------------------------------

This is the official announcement of the release of the latest perl menu
package "menu.pl version 3.2".  Version 3.2 is an intermediate release which
incorporates some new features and one bug-fixe.

This package has been tested with both Perl4/curseperl and Perl5/Curses
(works with Perl5.000 and Perl5.001).

This software is available via "anonymous ftp" from "ftp.iastate.edu", in
a tar'd and compressed format library as:

 pub/perl/perlmenu.v3.2.tar.Z

-----------------------------
Compatibility and New Features
-----------------------------

For current "menu.pl version 3.x" users, this version of menu.pl is
call-compatible with older versions.

Changes between menu.pl version 3.2 and version 3.1:

- Added support for required fields to the "template" facility.  This new
 support greatly simplifies coding data-entry routines with required fields.
 New parameters to "menu_display_template" allow automatic insertion of
 required field markers at one end (or each end) of required fields.
 New parameter supplied to your "template exit" routine indicates how
 many required fields remain to be filled in by the user.  The required
 field markers can be changed via a new "menu_template_prefs" call.
- Rewrote the "ezreg" demo to take advantage of the new "required field"
 template support.
- Added Control-L screen refresh control key for template input.
- Added "current cursor location latch" to input fields in a template.
 Now when you tab between fields on a template it returns to the cursor
 location you left (from within each window) when you return to it.
- Fixed a bug in the menu subtitle support.  When a subtitle routine was
 returning "null" (no titles), the titles already in the title array
 were not cleared.  The first line of the old menu subtitle would not go
 away.

-------------------
Perl4/Perl5 Aspects
-------------------

This package uses an extension of "stock Perl" which incorporates curses
library calls into the perl interpreter.  How you build perl to include
these calls depends on whether you are using Perl4 or Perl5.

When using Perl4 you must use the pieces distributed in the "usub" directory
of the Perl4 source distribution to link perl with a curses interface module
which incorporates calls to the curses function library.

When using Perl5 you must use William Setzer's "Curses" extension.
Commented code is placed in "menu_init" for those systems with curses
implementations that do not have a "getcap" call (or for those that have
"tigetstr" instead of "getcap").  Read the "README" section for complete
info.  Feedback welcome.

--------
Overview
--------

For people who do not even know what "menu.pl" does for you, here is the
"Overview" section from the MENU_DOC document included in the package.

 The "menu.pl" package is a perl package (built into your perl program with
 a "require menu.pl" command) that automates curses-based full screen menus
 and data entry.

 Using three simple calls, any number of items may be selected from a
 single or multiple-page menu by moving an arrow to the desired item (or
 directly entering the selection number displayed on the screen).  In
 addition to simple "single one-shot selection menus", "radio button"  style
 menus and "multiple-item-selection" menus are provided.  Paging through
 multiple-page menus is handled automatically.  Menu titles, sub-titles and
 prompts are supported.

 Using two simple calls a full-screen data entry template may be loaded
 and a fully-titled data entry input screen may be created.  Defaults,
 maximum field lengths, and numeric-only data are supported.

 ---

 The "menu.pl" package uses curses interface routine calls supplied by the
 "curseperl" package (for Perl4) or the Curses extension (for Perl5).

 The "curseperl" package is distributed with the normal perl4 distribution in
 the "usub" directory.  The "curseperl" binary is a complete perl interpreter
 with the addition of many "curses" routines dealing with screen manipulation
 (cursor positioning, display of text at the current cursor location, etc).
 Applications using "menu.pl" must be constructed to use "curseperl" instead
 of "perl".

 The "Curses" extension for Perl5 is maintained by William Setzer (of North
 Carolina State University).  This package is available via anonymous FTP at:

   ftp://ftp.ncsu.edu/pub/math/wsetzer/Curses-a8.tar.gz

 When writing perl5/Curses programs make sure you include the following two
 lines at the start of your program (to initialize the Curses environment
 correctly):

   BEGIN { $Curses::OldCurses = 1; }
   use Curses;

 ---

 For menus, most applications using will use the following three calls
 (with the "menu_item" routine used multiple times to provide the menu
 selections) as follows:

    #!/usr/local/bin/curseperl
    ...
    &menu_init(1,"Select an Animal"); # Init menu

    &menu_item("Collie","dog");       # Add item
    &menu_item("Shetland","pony");    # Add item
    &menu_item("Persian","cat");      # Add last item

    $sel = &menu_display("Which animal?"); # Get user selection

    if ($sel eq "%UP%") { ... }
    if ($sel eq "dog") { ... }
    ...

 When this code is executed, only the call to "menu_display" will actually
 cause the constructed menu to be displayed to the user for selection.
 The title is centered and displayed at the top of the screen in reverse
 video.  The selection items are automatically numbered and presented in
 the order they were added.  The prompt is displayed at the bottom of the
 screen preceded by an indication of how many of the items in the menu
 are presented on the current screen ("All" or some percentage).  In the
 above example, the menu would look like:

                             Select an Animal

    -> 1) Collie
       2) Shetland
       3) Persian

    (All)  Which animal?

 Only one menu may be active at a time.  In applications with "layers" of
 menus, only the "current layer" menu is maintained in memory.  As you use
 the "up" function to "pop up" to a previous menu, your application must
 return to a subroutine (or upper program layer) that reconstructs the menu
 for that layer of the application and displays it.  Since the lower layer
 used a "menu_init" to construct that menu, the "upper layer" must reconstruct
 the entire menu appropriate at that level.  Support is provided (with
 proper programming of the application) to go directly to the "top" (first)
 menu and to remember the selection position in a previous menu.

 ---

 For full-screen data entry, most applications using will use the following
 two calls:

    #!/usr/local/bin/curseperl
    ...
    @input_data = (); # Define a place to put the input data
    ...
    &menu_load_template("/path/to/template.file"); # Load template
    &menu_display_template(*input_data);

 When this code is executed, only the call to "menu_display_template" will
 actually cause the template to be displayed to the user for data entry.  For
 example, assume the file containing the template looked like:

                            Address Information

          Name: [_______________________________________________]
          Addr: [_______________________________________________]
          City: [______________________] State: [__]  Zip:[_____]


 The call to "menu_load_template" would load and parse the template file
 for locations of text and data fields (data fields denoted by underscores).
 When "menu_display_template" is called, the user would see the following
 screen:

                            Address Information

          Name: [                                               ]
          Addr: [                                               ]
          City: [                      ] State: [  ]  Zip:[     ]

 Field tabbing and insertion/deletion of text is handled by

 "menu_display_template" until the user hits "Return".  Data values for each
 field are returned in $input_data[0] - $input_data[4].  Defaults,
 numeric-only, blanked, protected, and required fields are supported, along
 with the ability to parse and control user input while the
 "menu_display_template" is active via a user exit.

--
Steven L. Kunz
Networked Applications  --  Microcomputer Networked Services
Iowa State University Computation Center, Iowa State University, Ames, Iowa
E-mail: [email protected]