GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Text::Context(3) User Contributed Perl Documentation Text::Context(3)

Text::Context - Handle highlighting search result context snippets

  use Text::Context;

  my $snippet = Text::Context->new($text, @keywords);

  $snippet->keywords("foo", "bar"); # In case you change your mind

  print $snippet->as_html;
  print $snippet->as_text;

Given a piece of text and some search terms, produces an object which locates the search terms in the message, extracts a reasonable-length string containing all the search terms, and optionally dumps the string out as HTML text with the search terms highlighted in bold.

Creates a new snippet object for holding and formatting context for search terms.

Accessor method to get/set keywords. As the context search is done case-insensitively, the keywords will be lower-cased.

    @paras = $self->paras($maxlen)

Return shortened paragraphs to fit together into a snippet of at most $maxlen characters.

Calculates a "representative" string which contains the given search terms. If there's lots and lots of context between the terms, it's replaced with an ellipsis.

Markup the snippet as a HTML string using the specified delimiters or with a default set of delimiters ("<span class="quoted">").

Original author: Simon Cozens

Current maintainer: Tony Bowden

Please direct all correspondence regarding this module to: bug-Text-Context@rt.cpan.org

  Copyright (C) 2002-2005 Kasei

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License; either version
  2 of the License, or (at your option) any later version.

  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.
2009-07-23 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.