Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses


by jmcnamara (Monsignor)
on Oct 16, 2002 at 16:13 UTC ( #205756=snippet: print w/replies, xml ) Need Help??
Description: 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;



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?

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://205756]
[chacham]: I'm sure this is old, but i just came across it: If you put a million monkeys at a million keyboards, one of them will eventually write a Java program. The rest of them will write Perl programs.
[LanX]: lol
[Corion]: Woo hoo! A new Auralnauts episode!
LanX mean unfair and funny
[LanX]: but most java code looks like from one million monkey using eclipse. ..
[Eily]: ah yes, perl's motto, There Is More Than One Monkey Typing It

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2018-04-23 16:06 GMT
Find Nodes?
    Voting Booth?