JavaScript::Autocomplete::Backend

JavaScript::Autocomplete::Backend is a Google Suggest-compatible autocompletion backend.
Download

JavaScript::Autocomplete::Backend Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Ivan Tubert-Brohman
  • Publisher web site:
  • http://search.cpan.org/~itub/

JavaScript::Autocomplete::Backend Tags


JavaScript::Autocomplete::Backend Description

JavaScript::Autocomplete::Backend is a Google Suggest-compatible autocompletion backend. JavaScript::Autocomplete::Backend is a Google Suggest-compatible autocompletion backend.SYNOPSYS package MyAutocompleter; use base qw(JavaScript::Autocomplete::Backend); my @NAMES = qw(alice bob charlie); sub expand { my ($self, $query) = @_; # do something to expand the query my $re = qr/^Q$queryE/i; my @names = grep /$re/, @NAMES; (lc $query, @names, [], ); } MyAutocompleter->run;This is a base class for implementing an autocompletion server with the same protocol used by Google Suggest ( http://www.google.com/webhp?complete=1&hl=en ). It is basically a CGI script that takes a word to be completed as the "qu" parameter and returns a specially concoted JavaScript statement. For more efficiency it should be possible to turn it into a mod_perl handler; that is left as an exercise for the reader.The front-end JavaScript code is discussed in http://serversideguy.blogspot.com/2004/12/google-suggest-dissected.html .This module is used by creating a subclass, which should override the expand method, which takes care of searching for the autocompletion results. Requirements: · Perl


JavaScript::Autocomplete::Backend Related Software