NAME

Text::Shortcuts - A shortcut creation & usage engine

SYNOPSIS

    use Text::Shortcuts;
    my $sc = Text::Shortcuts->new($shortcut_file, $output_file);

    while(1) {
        print "Choose option:\n
                \t1. Set Shortcut\n
                \t2. Get Shortcuts\n
                \t3. Start Note\n
                \t4. Read Note\n";
        print "Choice: ";
        chomp(my $choice = <STDIN>);

        unless ($choice == 1
                || $choice == 2
                || $choice == 3 ||                 #--Quick Gettaway
                $choice == 4) {
                print "Invalid Choice: $choice";
                redo;
        }

        if ($choice == 1) {
                print "What letter do you want to make this shortcut? ";
                chomp (my $letter = <STDIN>);
                print "What do you want \[$letter\] to produce?\n";
                chomp (my $produce = <STDIN>);
                $sc->set_shortcut($letter, $produce);
        } elsif ($choice == 2) {
                $sc->get_shortcuts;
        } elsif ($choice == 3) {
                print "type 'end' to end\n";
                $sc->new_doc;
        } elsif ($choice == 4) {
                $sc->get_doc;
        }
}

DESCRIPTION

This module is for use in creating a shortcuts engine. Shortcuts engine? you ask. Text::Shortcuts lets you define shortcuts (such as [j] or [R]) and then lets you write documents using your shortcuts to stand for longer pieces of text.

For example, you might set [y] to equal Yoonsdock, Mars. When you create a new document using new_doc, it will change all occurences of [y] in that document to Yoonsdock, Mars.

This modules allows for creating and viewing of shortcuts, and creating and viewing of documents. When a document is typed using $sc-new_doc>, the module sends the real text to the output file, not the shortcut.

USAGE

new($shortcut_file, $output_file)

This is the constructor method. It must have the args for the file that contains the shortcut definitions, and the file that the output will go to.

set_shortcut($shortcut_letter, $shortcut_expanded)

This method sets shortcuts, so [$shortcut_letter] will acess $shortcut_expanded.

get_shortcuts

This method print out a list of every shortcut, and what it produces.

new_doc

This method allows you to type to your output file using shortcuts you've defined earlier.

get_doc

A method for people who are too lazy to open their output file. It simply opens the output file and prints what's in it.

BUGS

None known yet. Email me at steven@ssrubin.com if any are found.

AUTHOR

Steven S. Rubin (steven@ssrubin.com)

COPYRIGHT

Copyright 2002. This may be modified and distributed on the same terms as Perl.