Tatsuhiko Miyagawa > HTML-ResolveLink-0.01 > HTML::ResolveLink

Download:
HTML-ResolveLink-0.01.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  2
Open  0
View/Report Bugs
Module Version: 0.01   Source   Latest Release: HTML-ResolveLink-0.05

NAME ^

HTML::ResolveLink - Resolve relative links in (X)HTML into absolute URI

SYNOPSIS ^

  use HTML::ResolveLink;

  my $resolver = HTML::ResolveLink->new(
      base => 'http://www.example.com/foo/bar.html',
  );
  $html = $resolver->resolve($html);

DESCRIPTION ^

HTML::ResolveLink is a module to rewrite relative links in XHTML or HTML into absolute URI.

For example. when you have

  <a href="foo.html">foo</a>
  <img src="/bar.gif" />

and use http://www.example.com/foo/bar as base URL, you'll get:

  <a href="http://www.example.com/foo/foo.html">foo</a>
  <img src="http://www.example.com/bar.gif" />

If the parser encounters <base> tag in HTML, it'll honor that.

METHODS ^

new
  my $resolver = HTML::ResolveLink->new(
      base => 'http://www.example.com/',
  );

base is a required parameter, which is used to resolve the relative URI found in the document.

resolve
  $html = $resolver->resolve($html);

Resolves relative URI found in $html into absolute and returns a string containing rewritten one.

AUTHOR ^

Tatsuhiko Miyagawa <miyagawa@bulknews.net>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO ^

HTML::Parser, HTML::LinkExtor

syntax highlighting: