2 # This class is just a hack to act as a "formatter" for
3 # actually unformatted Pod.
5 # Note that this isn't the same as just passing thru whatever
6 # we're given -- we pass thru only the pod source, and suppress
7 # the Perl code (or whatever non-pod stuff is in the source file).
11 package Pod::Perldoc::ToPod;
15 use base qw(Pod::Perldoc::BaseTo);
17 sub write_with_binmode { 0 }
18 sub output_extension { 'pod' }
20 sub new { return bless {}, ref($_[0]) || $_[0] }
23 my( $self, $in, $outfh ) = @_;
25 open(IN, "<", $in) or die "Can't read-open $in: $!\nAborting";
29 # A hack for finding things between =foo and =cut, inclusive
33 if($cut_mode = ($1 eq 'cut')) {
34 print $outfh "\n=cut\n\n";
35 # Pass thru the =cut line with some harmless
36 # (and occasionally helpful) padding
40 print $outfh $_ or die "Can't print to $outfh: $!";
43 close IN or die "Can't close $in: $!";
52 Pod::Perldoc::ToPod - let Perldoc render Pod as ... Pod!
56 perldoc -opod Some::Modulename
58 (That's currently the same as the following:)
60 perldoc -u Some::Modulename
64 This is a "plug-in" class that allows Perldoc to display Pod source as
65 itself! Pretty Zen, huh?
67 Currently this class works by just filtering out the non-Pod stuff from
74 =head1 COPYRIGHT AND DISCLAIMERS
76 Copyright (c) 2002 Sean M. Burke. All rights reserved.
78 This library is free software; you can redistribute it and/or modify it
79 under the same terms as Perl itself.
81 This program is distributed in the hope that it will be useful, but
82 without any warranty; without even the implied warranty of
83 merchantability or fitness for a particular purpose.
87 Sean M. Burke C<sburke@cpan.org>