Formatter::HTML::Preformatted - Absolute minimal HTML formatting of pure text
use Formatter::HTML::Preformatted; my $formatter = Formatter::HTML::Preformatted->format($data); print $formatter->fragment; my @links = $text->links; print ${$links}[0]->{url};
This module will simply take any text-string and put it in a HTML pre element. It will escape tags and entities. It will also look through it to see if there are any URIs, and they will be turned into hyperlinks.
pre
This module conforms with the Formatter API specification, version 0.95:
format($string)
The format function that you call to initialise the formatter. It takes the plain text as a string argument and returns an object of this class.
fragment
To get only the text enclosed in the minimal pre element, you will call this method. It returns a string with the HTML fragment.
document([$charset])
Will add a document type declaration and some minimal markup, to return a full, valid, HTML document. You may specify an optional $charset parameter. This will include a HTML meta element with the chosen character set. It will still be your responsibility to ensure that the document served is encoded with this character set.
$charset
meta
links
Will return all links found the input plain text string. They will be found in an arrayref where each element has a key url.
url
title
Since this formatter has no way of finding the title of the document this method will always return undef.
undef
Formatter, Formatter::HTML::Textile, URI::Find::Simple
Kjetil Kjernsmo, <kjetilk@cpan.org>
Copyright (C) 2004-2005 by Kjetil Kjernsmo
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.
To install Formatter::HTML::Preformatted, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Formatter::HTML::Preformatted
CPAN shell
perl -MCPAN -e shell install Formatter::HTML::Preformatted
For more information on module installation, please visit the detailed CPAN module installation guide.