#!/usr/local/bin/perl

=head1 NAME

asciipos2isopod - converts pod Escapes to iso8859 characters.

=head1 SYNOPSIS

    asciipos2isopod [<lt>Infile.pod<gt> <lt>Outfile.iso<gt>]

=head1 DESCRIPTION

asciipos2isopod accepts an ascii pod file and converts all Pod escapes
(E<lt>xxx<gt> where xxx is the name of an accented character) to the
ISO-8859-1 equivalent of this character. Reads from either stdin and
writes to stdout or from and to the given files.


=head1 SEE ALSO

    isopod2asciipos - converts ISO-8859-1 pods to ascii character set

=head1 AUTHOR

Simon Washbrook E<lt>F<SimonWashbrook@compuserve.com>E<gt>

=head1 TODO

=cut

# use strict;
use FileHandle;
use Pod::IsoPod;

###########################################################################
# Must have 2 parameters.
((scalar(@ARGV) == 2) || (scalar(@ARGV) == 0)) or
    die "Error: Wrong number of parameters.\n\tasciipos2isopod <InFile> <OutFile>\n";

###########################################################################
# Open the files
my $InFile = new FileHandle;
my $OutFile = new FileHandle;

if (scalar(@ARGV))
{
    open ($InFile, '<' . $ARGV[0]) or
	die "Error: Cannot open the file for reading:\n\t".$ARGV[0]."\n";
    open ($OutFile, '>' . $ARGV[1]) or
	die "Error: Cannot open the file for writing:\n\t".$ARGV[1]."\n";
}
else
{
    open ($InFile, "<&STDIN");
    open ($OutFile, ">&STDOUT");
}


###########################################################################
# Convert it
&ascii2iso($InFile, $OutFile);

###########################################################################
# Finished, Cleanup
$InFile->close();
$OutFile->close();


