Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | |
2 | require 5; | |
3 | package Pod::Perldoc::ToNroff; | |
4 | use strict; | |
5 | use warnings; | |
6 | ||
7 | # This is unlike ToMan.pm in that it emits the raw nroff source! | |
8 | ||
9 | use base qw(Pod::Perldoc::BaseTo); | |
10 | ||
11 | sub is_pageable { 1 } # well, if you ask for it... | |
12 | sub write_with_binmode { 0 } | |
13 | sub output_extension { 'man' } | |
14 | ||
15 | use Pod::Man (); | |
16 | ||
17 | sub center { shift->_perldoc_elem('center' , @_) } | |
18 | sub date { shift->_perldoc_elem('date' , @_) } | |
19 | sub fixed { shift->_perldoc_elem('fixed' , @_) } | |
20 | sub fixedbold { shift->_perldoc_elem('fixedbold' , @_) } | |
21 | sub fixeditalic { shift->_perldoc_elem('fixeditalic' , @_) } | |
22 | sub fixedbolditalic { shift->_perldoc_elem('fixedbolditalic', @_) } | |
23 | sub quotes { shift->_perldoc_elem('quotes' , @_) } | |
24 | sub release { shift->_perldoc_elem('release' , @_) } | |
25 | sub section { shift->_perldoc_elem('section' , @_) } | |
26 | ||
27 | sub new { return bless {}, ref($_[0]) || $_[0] } | |
28 | ||
29 | sub 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 | ||
50 | 1; | |
51 | __END__ | |
52 | ||
53 | =head1 NAME | |
54 | ||
55 | Pod::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 | ||
63 | This is a "plug-in" class that allows Perldoc to use | |
64 | Pod::Man as a formatter class. | |
65 | ||
66 | The following options are supported: center, date, fixed, fixedbold, | |
67 | fixeditalic, fixedbolditalic, quotes, release, section | |
68 | ||
69 | Those options are explained in L<Pod::Man>. | |
70 | ||
71 | For example: | |
72 | ||
73 | perldoc -o nroff -w center:Pod -d something.3 Some::Modulename | |
74 | ||
75 | =head1 CAVEAT | |
76 | ||
77 | This module may change to use a different pod-to-nroff formatter class | |
78 | in the future, and this may change what options are supported. | |
79 | ||
80 | =head1 SEE ALSO | |
81 | ||
82 | L<Pod::Man>, L<Pod::Perldoc>, L<Pod::Perldoc::ToMan> | |
83 | ||
84 | =head1 COPYRIGHT AND DISCLAIMERS | |
85 | ||
86 | Copyright (c) 2002 Sean M. Burke. All rights reserved. | |
87 | ||
88 | This library is free software; you can redistribute it and/or modify it | |
89 | under the same terms as Perl itself. | |
90 | ||
91 | This program is distributed in the hope that it will be useful, but | |
92 | without any warranty; without even the implied warranty of | |
93 | merchantability or fitness for a particular purpose. | |
94 | ||
95 | =head1 AUTHOR | |
96 | ||
97 | Sean M. Burke C<sburke@cpan.org> | |
98 | ||
99 | =cut | |
100 |