At 05:04 PM 6/11/01 -0400, RICHARD A. NAKROSHIS (Contractor) wrote:
>After poking around in the online documentation with AS 626, I came
>across reference to the Text::Abbrev module. There's not a whole lot of
>documentation for it, and I frankly can't figure out what it supposed to
>do, or to come up with a good example program of what it does.
>
>Anyone find a use for this module?
It looks from the documentation as though its purpose is to create a hash
whose keys are all the unambiguous truncations of a set of commands, and
whose values are those commands.
You'd use this in a command parser that wanted to save the user as much
typing as possible.
Example:
$ perl -MText::Abbrev -le '$hr = abbrev qw(quit quirk edit exit save);
for(keys %$hr){print "$_: $hr->{$_}"}'
exi: exit
edit: edit
quirk: quirk
ed: edit
quir: quirk
s: save
quit: quit
ex: exit
edi: edit
sav: save
save: save
sa: save
exit: exit
Documentation follows:
SYNOPSIS
use Text::Abbrev;
abbrev $hashref, LIS
DESCRIPTION
Stores all unambiguous truncations of each element of LIST as keys in the
associative array referenced by $hashref. The values are the original list
elements.
EXAMPLE
$hashref = abbrev qw(list edit send abort gripe);
%hash = abbrev qw(list edit send abort gripe);
abbrev $hashref, qw(list edit send abort gripe);
abbrev(*hash, qw(list edit send abort gripe));
abbrev - create an abbreviation table from a list
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com