Sergey Chernyshev > HTML-LinkChanger-2.4 > HTML::LinkChanger

Download:
HTML-LinkChanger-2.4.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 2.4   Source  

NAME ^

HTML::LinkChanger - abstract Perl class to change all linking URLs in HTML.

SYNOPSIS ^

BEGIN {

        package Http2Ftp;

        require HTML::LinkChanger;
        use vars qw(@ISA);
        @ISA = qw(HTML::LinkChanger);

        #
        # Converting http URLs to FTP urls
        #
        sub change_url
        {
                my $self = shift;
                my $url = shift;

                $url=~s/^http:/ftp:/;

                return $url;
        }
}

my $http2ftp = new Http2Ftp();

my $converted_HTML = $http2ftp->filter($original_HTML);

DESCRIPTION ^

HTML::LinkChanger is an abstract class so you need to subclass it to make it do something. See HTML::LinkChanger::Absolutizer for one useful example of such class.

HTML::LinkChanger uses HTML::Tagset::linkElements to change all attributes that contain links that needs to be updated.

This class is a subclass of HTML::Parser. You can call filter() method to convert scalar containing HTML or filter_file() method to convert HTML from file.

You can also call conventional HTML::Parser's parse() and parse_file() methods and call filtered_html() after that to retreive results.

AUTHOR ^

Sergey Chernyshev <sergeyche@cpan.org>

SEE ALSO ^

HTML::Parser, HTML::Tagset, HTML::LinkChanger::Absolutizer

syntax highlighting: