require 5;
use strict;
use warnings;
# This class is unlike ToText.pm et al, because we're NOT paging thru
# the output in our particular format -- we make the output and
# then we run nroff (or whatever) on it, and then page thru the
# (plaintext) output of THAT!
sub new { return bless {}, ref($_[0]) || $_[0] }
sub parse_from_file {
my $self = shift;
# turn the switches into CLIs
my $switches = join ' ',
map qq{"--$_=$self->{$_}"},
grep !m/^_/s,
keys %$self
;
my $command =
)
. " $switches --lax $file | $render -man"
; # no temp file, just a pipe!
# Thanks to Brendan O'Dea for contributing the following block
) {
}
# I hear persistent reports that adding a -c switch to $render
# solves many people's problems. But I also hear that some mans
# don't have a -c switch, so that adding it here would presumably
# be a Bad Thing -- sburke@cpan.org
and print "About to run $command\n";
;
my $err;
if( $self->{'__filter_nroff'} ) {
and print "filter_nroff is set, so filtering...\n";
} else {
and print "filter_nroff isn't set, so not filtering.\n";
}
if (($err = $?)) {
and print "Nonzero exit ($?) while running $command.\n",
"Falling back to Pod::Perldoc::ToPod\n ",
;
# A desperate fallthru:
} else {
or die "Can't print to $$self{__output_file}: $!";
}
return;
}
sub ___Do_filter_nroff {
my $self = shift;
my @data = split /\n{2,}/, shift;
# 28/Jan/99 perl 5.005, patch 53 1
join "\n\n", @data;
}
1;
=head1 NAME
Pod::Perldoc::ToMan - let Perldoc render Pod as man pages
=head1 SYNOPSIS
perldoc -o man Some::Modulename
=head1 DESCRIPTION
This is a "plug-in" class that allows Perldoc to use
Pod::Man and C<nroff> for reading Pod pages.
The following options are supported: center, date, fixed, fixedbold,
fixeditalic, fixedbolditalic, quotes, release, section
(Those options are explained in L<Pod::Man>.)
For example:
perldoc -o man -w center:Pod Some::Modulename
=head1 CAVEAT
This module may change to use a different pod-to-nroff formatter class
in the future, and this may change what options are supported.
=head1 SEE ALSO
L<Pod::Man>, L<Pod::Perldoc>, L<Pod::Perldoc::ToNroff>
=head1 COPYRIGHT AND DISCLAIMERS
Copyright (c) 2002 Sean M. Burke. All rights reserved.
under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
=head1 AUTHOR
Sean M. Burke C<sburke@cpan.org>
=cut