my $hl = new HTML::Highlight ( words => , wildcards => , colors => , czech_language => 0, debug => 0 );
This is a constructor of the highlighter object. It takes an array of even number of parameters.
A wildcard can be either undef or one of % or *.
Default Google-like colors are used if you dont specify your own colors. Number of colors can be lower than number of words - in this case the colors are rotated and some of the words are therefore highlighted using the same color.
The highlighter takes HTML tags into account and therefore does not highlight a word or a pattern inside a tag.
A support for diacritics insenstive matching for ISO-8859-2 languages (for for example the czech language) can be activated using the <B>czech_languageB> option. This feature requires a module <B>CzFastB> that is available on CPAN in a directory of author TRIPIE or at http://geocities.com/tripiecz/.
my $hl_document = $hl->highlight($document);
The only parameter is a document in that you want to highlight the words that were passed to the constructor of the highlighter object. The method returns a version of the document in which the words are highlighted.
my $sections = $hl->preview_context($document, $num);
This method takes two parameters. The first one is the document you want to scan for the words that were passed to the constructor of the highlighter object. The second parameter is an optional integer that specifies maximum number of characters in each of the context sections (see below). This parameter defaults to 80 characters if its not specified. Minimum allowed value of this parameter is 60.
The method returns a reference to an array of sections of the document in which the words that were passed to the constructor appear. HTML tags are removed before the document is proccessed and are not present in the ouput. This feature is typically used in search engines to preview a context in which words from a search query appear in the resulting documents. The words are always in the middle of each of the sections. The number of sections this method returns is equal to the number of words passed to the constructor of the highlighter object. That means only the first occurence of each of the words is taken into account.
No official support is provided, but I welcome any comments, patches and suggestions on my email.
I am aware of no bugs.
Tomas Styblo, email@example.com, CPAN-ID TRIPIE
Prague, the Czech republic
HTML::Highlight - A module to highlight words or patterns in HTML documents
Copyright (C) 2000 Tomas Styblo (firstname.lastname@example.org)
This module is free software; you can redistribute it and/or modify it under the terms of either:
b) the Artistic License which comes with this module.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.
You should have received a copy of the Artistic License with this module, in the file Artistic. If not, Ill be glad to provide one.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Hey! <B>The above document had some coding errors, which are explained below:B>
Around line 251: =item outside of any =over Around line 344: You forgot a =back before =head1
|perl v5.20.3||HIGHLIGHT (3)||2001-08-17|