xref: /onnv-gate/usr/src/cmd/perl/5.8.4/distrib/lib/Pod/Perldoc/ToNroff.pm (revision 0:68f95e015346)
1
2require 5;
3package Pod::Perldoc::ToNroff;
4use strict;
5use warnings;
6
7# This is unlike ToMan.pm in that it emits the raw nroff source!
8
9use base qw(Pod::Perldoc::BaseTo);
10
11sub is_pageable        { 1 }  # well, if you ask for it...
12sub write_with_binmode { 0 }
13sub output_extension   { 'man' }
14
15use Pod::Man ();
16
17sub center          { shift->_perldoc_elem('center'         , @_) }
18sub date            { shift->_perldoc_elem('date'           , @_) }
19sub fixed           { shift->_perldoc_elem('fixed'          , @_) }
20sub fixedbold       { shift->_perldoc_elem('fixedbold'      , @_) }
21sub fixeditalic     { shift->_perldoc_elem('fixeditalic'    , @_) }
22sub fixedbolditalic { shift->_perldoc_elem('fixedbolditalic', @_) }
23sub quotes          { shift->_perldoc_elem('quotes'         , @_) }
24sub release         { shift->_perldoc_elem('release'        , @_) }
25sub section         { shift->_perldoc_elem('section'        , @_) }
26
27sub new { return bless {}, ref($_[0]) || $_[0] }
28
29sub parse_from_file {
30  my $self = shift;
31  my $file = $_[0];
32
33  my @options =
34    map {; $_, $self->{$_} }
35      grep !m/^_/s,
36        keys %$self
37  ;
38
39  defined(&Pod::Perldoc::DEBUG)
40   and Pod::Perldoc::DEBUG()
41   and print "About to call new Pod::Man ",
42    $Pod::Man::VERSION ? "(v$Pod::Man::VERSION) " : '',
43    "with options: ",
44    @options ? "[@options]" : "(nil)", "\n";
45  ;
46
47  Pod::Man->new(@options)->parse_from_file(@_);
48}
49
501;
51__END__
52
53=head1 NAME
54
55Pod::Perldoc::ToNroff - let Perldoc convert Pod to nroff
56
57=head1 SYNOPSIS
58
59  perldoc -o nroff -d something.3 Some::Modulename
60
61=head1 DESCRIPTION
62
63This is a "plug-in" class that allows Perldoc to use
64Pod::Man as a formatter class.
65
66The following options are supported:  center, date, fixed, fixedbold,
67fixeditalic, fixedbolditalic, quotes, release, section
68
69Those options are explained in L<Pod::Man>.
70
71For example:
72
73  perldoc -o nroff -w center:Pod -d something.3 Some::Modulename
74
75=head1 CAVEAT
76
77This module may change to use a different pod-to-nroff formatter class
78in the future, and this may change what options are supported.
79
80=head1 SEE ALSO
81
82L<Pod::Man>, L<Pod::Perldoc>, L<Pod::Perldoc::ToMan>
83
84=head1 COPYRIGHT AND DISCLAIMERS
85
86Copyright (c) 2002 Sean M. Burke.  All rights reserved.
87
88This library is free software; you can redistribute it and/or modify it
89under the same terms as Perl itself.
90
91This program is distributed in the hope that it will be useful, but
92without any warranty; without even the implied warranty of
93merchantability or fitness for a particular purpose.
94
95=head1 AUTHOR
96
97Sean M. Burke C<sburke@cpan.org>
98
99=cut
100
101