#!/usr/local/bin/perl

=head1 NAME

isopod2asciipos - converts iso8859 characters to pod Escapes.

=head1 SYNOPSIS

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

=head1 DESCRIPTION

isopod2asciipos accepts a pod file containing ISO-8859-1 characters
and converts them to POD escape sequences (E<lt>xxx<gt> where xxx is
the name of an accented character). Reads from either stdin and writes
to stdout or from and to the given files.

=head1 SEE ALSO

    Pod::IsoPod.pm - The converter module
    asciipos2isopod - converts ascii pods to ISO-8859-1 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 0 or 2 parameters.
((scalar(@ARGV) == 2) || (scalar(@ARGV) == 0)) or
    die "Error: Wrong number of parameters.\n\tisopod2asciipos [<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
&iso2ascii($InFile, $OutFile);

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

