Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

pod2rtf

by jmcnamara (Monsignor)
on Oct 16, 2002 at 16:13 UTC ( [id://205756]=CUFP: print w/replies, xml ) Need Help??

Simple pod2rtf (Rich Text Format) converter based on the Pod::Simple::RTF subclass of Pod::Simple.

See also pod2rtf.

Usage: pod2rtf [infile] [outfile] If infile isn't defined defaults to STDIN If outfile isn't defined defaults to STDOUT
#!/usr/bin/perl -w use strict; use Pod::Simple::RTF; my $parser = Pod::Simple::RTF->new(); if (defined $ARGV[0]) { open IN, $ARGV[0] or die "Couldn't open $ARGV[0]: $!\n"; } else { *IN = *STDIN; } if (defined $ARGV[1]) { open OUT, ">$ARGV[1]" or die "Couldn't open $ARGV[1]: $!\n"; } else { *OUT = *STDOUT; } $parser->output_fh(*OUT); $parser->parse_file(*IN); __END__

Replies are listed 'Best First'.
Re: pod2rtf
by casiano (Pilgrim) on Apr 18, 2009 at 08:21 UTC
    Thanks for the script.

    I have experienced problems when converting files containing utf8 characters (like spanish accents, etc.). The alternative was to convert the file first to isolatin:

    #!/usr/bin/perl -w use strict; use Pod::Simple::RTF; my $file = shift || die "Provide a file name\n"; die "Provide a file name\n" unless -r $file; my $latin = $file; $latin = "$file.latin"; my $parser = Pod::Simple::RTF->new(); my $outfile = $file; $outfile =~ s/\.\w*$/.rtf/ or $outfile = "$file.rtf"; open STDOUT, "> $outfile"; system("iconv -f UTF-8 -t ISO_8859-15 $file > $latin") and die "Can't +execute iconv\n"; Pod::Simple::RTF->filter($latin)->any_errata_seen; unlink $latin;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: CUFP [id://205756]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-24 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found