The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

HTML::Copy - copy a HTML file without breaking links.

SYMPOSIS

 use HTML::Copy;

 $p = HTML::Copy->new();
 $p->htmlcopy($source_path, $destination_path);

DESCRIPTION

This module is to copy a HTML file without beaking links in the file. This module is a sub class of HTML::Parser.

CONSTRUCTOR METHODS

new

Make an instance of this module.

        $p = HTML::Copy->new($source_path);

INSTANCE METHODS

copy_to

Parse contents of $source_path given in new method, change links and write into $destination_path.

Class Methods

parse_file

Parse contents of $source_path and change links to copy into $destination_path. But don't make $destination_path. Just return modified HTML. The encoding of strings is converted into utf8.

        $html_text = HTML::Copy->parse_file($source_path, $destination_path);
htmlcopy

Parse contents of $source_path, change links and write into $destination_path.

        HTML::Copy->htmlcopy($source_path, $destination_path);

ACCESSOR METHODS

io_layer

Perl IO layer to read $source_path and to write $destination_path. It was determined by $source_path's charset tag. If charset is not specified, Encode::Guess module will be used.

        $p->io_layer;
set_encode_suspects

Add suspects of text encoding to guess the text encoding of the source HTML. If the source HTML have charset tag, it is not requred to add suspects.

        $p->set_encode_suspects(qw/shiftjis euc-jp/);
source_html

Obtain source HTML's contents

        $p->source_html;

AUTHOR

Tetsuro KURITA <tkurita@mac.com>