Text::Abbrev for Perl 6
Perl6
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib/Text
t
LICENSE
META.info
README.md

README.md

Text::Abbrev - create an abbreviation table from a list.

Synopsis

use Text::Abbrev;

# You can say "y" or "n" too
my $option = abbrev(<yes no>){lc prompt "Y/N? "};
if $option {
    say "You have said {$option.titlecase}.";
}
else {
    say "Sorry, unknown option.";
}

Functions

abbrev

The only function exported by this module which will return unambigous truncations of every option in list. For example, when you will call abbrev <break brick> you will get following hash.

(
    # break
    "break" => "break",
    "brea"  => "break",
    "bre"   => "break",
    # brick
    "brick" => "brick",
    "bric"  => "brick",
    "bri"   => "brick",
)

Author

GlitchMr glitchmr@myopera.com