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;



Comment on pod2rtf
Download Code
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;

Back to Snippets Section

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2015-11-25 00:38 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (666 votes), past polls