htspell - an application built using Navegante
Build the application:
$ navegante examples/htspell
Use the newly created file htspell as a CGI.
This application behaves as a CGI and it checks in a dictionary if the word exists. The application keeps track of words not found. On every request we also use the banner live feedback section to present some information about the number of not found words. The specific DSL section is:
cginame(./htspell) formtitle(Spell Checking Tool) proc(htspellFunction) desc(htspellDesc) init(htspellInit) feedback(htspellFeedback) livefeedback(htspellLive)
Text::Aspell
Module Text::Aspell was used to check for words in a dictionary.
Some variables were used so that we can present information about the number of words processed with every request.
$processed
This variable keeps tracks of the total of processed words in every request.
$found
This variable keeps track of the number of found words in the dictionary.
$not_found
This variable keeps track of the number of found not words in the dictionary.
htspellDesc
This function prints the description of the application. This is defined in the DSL by the desc statement.
desc
htspellFunction
This function is used to process the page content. We are checking for words in the dictionary, we are pushing words not found to the special variable estado in order to keep track of not found words over sequential requests. We are also updating counters, like the number of processed or not found words.
XXX _loadit
htspellFeedback
This is the fuction called when the application's feedback link is followed. This is defined in the DSL by the livefeedback. In this case we are printing the list of words not found since the application started, and for each one the number of occurrences.
livefeedback
htspellLive
This is the function that prints the HTML that feeds the banner section for reporting information. This is defined in the DSL by the livefeedback statement. Here we print information about the number of not found words for every page viewed.
htspellInit
This function runs on the beginig of every request and it's used here to reset word counters and create an Aspell object for word checking. This is defined in the DSL by the init statement.
init
To install App::Navegante, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::Navegante
CPAN shell
perl -MCPAN -e shell install App::Navegante
For more information on module installation, please visit the detailed CPAN module installation guide.