The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

HTML::LinkAdd - Add hyperlinks to phrases in HTML documents

SYNOPSIS

        use HTML::LinkAdd;
        my $page = new HTML::LinkAdd(
                'testinput1.html', {
                        'the clocks were striking thirteen'=>'footnotes.html#OrwellG-1',
                        'updated' => ['updated.html', 'View the latest update],
        });
        warn $page -> hyperlinked;
        $page ->save ('output.html');

DESCRIPTION

A simple object that accepts a class reference, a path to a file, and a hash of text-phrase/link-URLs, and supplies a method to obtain the HTML with supplied hyperlinks interpolated.

If the values of the supplied has are anonymous lists, the first value should a URI, the second escaped text to place in the link's title attribute.

The phrase to hyperlink will be skipped if it appears in a context that prevents linking, as defined in %$HTML::LinkAdd::SKIP. This is currently head, script, style>, pre, xmp, textarea, object, and a.

DEPENDENCIES

HTML::TokeParser

CONSTRUCTOR (new)

Accepts class reference, followed by either a filename or reference to a scalar of HTML (as HTML::TokeParser, and a hash of phrases and hyperlinks.

Returns a scalar that is the updated HTML.

PUBLIC METHOD hyperlink

Returns the hyperlinked HTML docuemnt constructed by...the constructor.

PUBLIC METHOD save

Convenience method to save the object's output slot to filename passed as scalar.

Returns undef on failure, 1 on success.

SEE ALSO

HTML::TokeParse.

TODO

Add support for linking images by source or ID.

AUTHOR

Lee Goddard lgoddard@cpan.org

COPYRIGHT

Copyright 2001 (C) Lee Goddard. All Rights Reserved. This is free software and you may use, abuse, amend and distribute under the same terms as Perl itself.