If set to true, the unpacker will run tidy on any HTML output files to
convert them to valid XHTML. Be warned that this can occasionally
change the formatting, as Tidy isn't very forgiving on certain common
tricks (such as empty elements with style elements) that abuse
the standard.
=item * C
If set to true, the unpacker will run through all of the unpacking
steps except those that actually write to the disk. This is useful
for testing, but also (particularly when combined with C) can be
used for extracting parsed data from an ebook container without
actually unpacking it.
=back
=cut
my @fields = (
'file',
'dir',
'encoding',
'format',
'formatinfo',
'htmlconvert',
'raw',
'key',
'keyfile',
'opffile',
'author',
'language',
'title',
'datahashes',
'detected',
'tidy',
'nosave',
);
require fields;
fields->import(@fields);
sub new ## no critic (Always unpack @_ first)
{
my $self = shift;
my (%args) = @_;
my $class = ref($self) || $self;
my $subname = (caller(0))[3];
debug(2,"DEBUG[",$subname,"]");
my %valid_args = (
'file' => 1,
'dir' => 1,
'encoding' => 1,
'key' => 1,
'keyfile' => 1,
'format' => 1,
'htmlconvert' => 1,
'raw' => 1,
'author' => 1,
'language' => 1,
'title' => 1,
'opffile' => 1,
'tidy' => 1,
'nosave' => 1,
);
foreach my $arg (keys %args)
{
croak($subname,"(): invalid argument '",$arg,"'")
if(!$valid_args{$arg});
}
croak($subname,"(): no input file specified")
unless($args{file});
croak($subname,"(): '",$args{file},"' not found")
unless(-f $args{file});
$self = fields::new($class);
$self->{file} = $args{file};
$self->{dir} = $args{dir} || $self->filebase;
$self->{encoding} = $args{encoding};
$self->{format} = $args{format} if($args{format});
$self->{key} = $args{key} if($args{key});
$self->{keyfile} = $args{keyfile} if($args{keyfile});
$self->{opffile} = $args{opffile} || ($self->{dir} . ".opf");
$self->{author} = $args{author} if($args{author});
$self->{title} = $args{title} if($args{title});
$self->{datahashes} = {};
$self->{detected} = {};
$self->{htmlconvert} = $args{htmlconvert};
$self->{raw} = $args{raw};
$self->{tidy} = $args{tidy};
$self->{nosave} = $args{nosave};
$self->detect_format unless($self->{format});
return $self;
}
=head1 ACCESSOR METHODS
See L