#!/usr/bin/env perl -w use strict; use File::Basename; use File::Spec; use HTML::Copy; use Getopt::Long; use Pod::Usage; our $VERSION = '1.22'; { my $man = 0; my $help = 0; GetOptions('help|?' => \$help, man => \$man) or pod2usage(2); pod2usage(-exitstatus => 0, -verbose => 1) if $help; pod2usage(-exitstatus => 0, -verbose => 2) if $man; if (@ARGV > 2) { pod2usage(-message => 'Too many arguments.', -exitstatus => 1, -verbose => 1) } if (@ARGV < 2) { pod2usage(-message => 'Required arguments is not given.', -exitstatus => 1, -verbose => 1) } my ($source_path, $target_path) = @ARGV; my $p = HTML::Copy->new($source_path); #$p->set_encode_suspects(qw/euc-jp shiftjis 7bit-jis/); $p->copy_to($target_path); } 1; __END__ =head1 NAME htmlcopy -- Copy a HTML file without breaking links. =head1 SYNOPSIS htmlcopy [OPTION] SOURCE DESTINATION htmlcopy [OPTION] SOURCE DIRECTORY =head1 DESCRIPTION htmlcopy a source HTML file into DESTINATION or DIRECTORY. If the HTML file have links to images, other HTML files, javascripts and cascading style sheets, htmlcopy changing link path in the HTML file to keep the link destination. =head1 OPTIONS =over 4 =item -h, --help Print a brief help message and exits. =item -m, --man Prints the manual page and exits. =back =head1 AUTHOR Tetsuro KURITA =cut