| Next: HTML::Scrubber | Previous: HTML::BreakupText | [Table of Contents] |
HTML::Linkize - Add Hyperlinks to plain text/HTML.
#!/usr/bin/perl -w
use HTML::Linkize;
use strict;
# Text to add links to.
my $text = q[ http://foo.com/ <a href="http://bar.com/">Bar</a> ];
# Create linker object.
my $linker = HTML::Linkize->new();
# Display results.
print $linker->linkize($text) . "\n";
For more discussion on the code, and why it is implemented in this manner you might be interested in the following node at Perlmonks: http://www.perlmonks.org/?node_id=514464
If you wanna display HTML links in text, but you don't want to break text which already contains well-formed HTML links then this is the module you'll need.
Create a new instance of this object.
Actually perform the linking of the text.
Steve Kemp
http://www.steve.org.uk/
Copyright (c) 2005 by Steve Kemp. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The LICENSE file contains the full text of the license.