ANNOUNCE: Select Loop for Perl Released

ANNOUNCE: Select Loop for Perl Released

Post by Tim Maher/CONSULTI » Wed, 14 May 2003 09:10:58



JAPHs,

I've recently released Shell::POSIX::Select to the CPAN. It provides
Perl with a significantly enhanced version of the select loop of
the POSIX shells, implemented through source filtering.

I'm interested to have people check it out, and tell me how they
like it.  I'm even more interested in having people submit cool
examples of using it to me, for possible inclusion in my upcoming
Manning book on Perl -- with the submitter's permission and foot
duly noted, of course! 9-}

The module has been heavily tested on my Linux and Solaris boxes,
and reports from CPAN testers indicate that it works on the one
version of each of these OS's on which they've tested it.  As you
might imagine, I'm rather interested to know how well it works
(or even if it installs) on other platforms too!

There are lots of detailed examples of its use in the documentation,
including the useful cool "Perl documentation browser" shown below.

So here are some excerpts from the documentation, which you can find
on CPAN and at http://TeachMePerl.com/Select_doc.html.

PURPOSE
       This module implements the "select" loop of the "POSIX"
       shells (Bash, Korn, and derivatives) for Perl.  That loop
       is unique in two ways: it's by far the friendliest feature
       of any UNIX shell, and it's the only UNIX shell loop
       that's missing from the Perl language.  Until now!

       What's so great about this loop? It automates the genera-
       tion of a numbered menu of choices, prompts for a choice,
       proofreads that choice and complains if it's invalid (at
       least in this enhanced implementation), and executes a
       code-block with a variable set to the chosen value.  That
       saves a lot of coding for interactive programs -- especially
       if the menu consists of many values!

       The benefit of bringing this loop to Perl is that it obvi-
       ates the need for future programmers to reinvent the
       Choose-From-A-Menu wheel.

SYNOPSIS
       select [ [my|local|our] scalar_var ] ( [LIST] ) { [CODE] }

------------------

Here's an example of what the select loop lets you do, also excerpted
from the man-page, from a script I use all the time.

perl_man.plx

  Back in the olden days, we only had one Perl man-page. It was
  voluminous, but at least you knew what argument to give the man
  command to get the documentaton.

  Now we have over a hundred Perl man pages, with unpredictable
  names that are difficult to remember.  Here's the program I use
  that allows me to select the man-page of interest from a menu.

   use Shell::POSIX::Select ;

   # Extract man-page names from TOC portion of "perldoc perl" output
   select $manpage ( sort ( `perldoc perl` =~ /^\s+(perl\w+)\s/mg) ) {
       system "perldoc '$manpage'" ;
   }

  Screen

    1) perl5004delta     2) perl5005delta     3) perl561delta
    4) perl56delta       5) perl570delta      6) perl571delta
   . . .

   Enter number of choice: 6

   PERL571DELTA(1)       Perl Programmers Reference Guide

   NAME
          perl571delta - what's new for perl v5.7.1

   DESCRIPTION
          This document describes differences between the 5.7.0
          release and the 5.7.1 release.
   . . .
***************************************************************

-Tim
*------------------------------------------------------------*
|  Tim Maher (206) 781-UNIX  (866) DOC-PERL  (866) DOC-UNIX  |
|  CEO, JAWCAR ("Just Another White Camel Award Recipient")  |

*+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-*
|  Watch for my Book: "Minimal Perl for Shell Programmers"   |
*------------------------------------------------------------*

 
 
 

1. ANNOUNCE - Empress announces Perl interface

Empress Software, Inc. is pleased to announce the availability of a Perl
interface for its  multimedia RDBMS.  The Perl interface is available
for free downloading by checking the Empress World Wide WEB Page at
http://www.empress.com.

Platforms supported are:

SUN Solaris 2.4 or compatible
SGI IRIX 5.3 or compatible
IBM RS6000 AIZ 4.1 or compatible
HP   9000/700 HP-UX 10.01 or compatible
INTEL 486 SCO Open server 5 or compatible
INTEL 486 Solaris 2.4 or compatible
INTEL 486 Linux ELF format

2. Mail probs! Help!

3. help with infinite loop in select()

4. array question

5. TCP servers: forking vs. select loop

6. No telnet from outside!

7. bash problem with select in while loop

8. Connect two Hosts on private Subnets via the Internet

9. bash select loop string replacement returns only first element

10. X-Event loop using select?

11. how to use select() in combination with a while( read() ) loop?

12. Problem with select() in a loop ...

13. select() loop.