xref: /openbsd-src/gnu/usr.bin/perl/cpan/Pod-Perldoc/lib/Pod/Perldoc/ToPod.pm (revision 9f11ffb7133c203312a01e4b986886bc88c7d74b)
1898184e3Ssthenpackage Pod::Perldoc::ToPod;
2898184e3Ssthenuse strict;
3898184e3Ssthenuse warnings;
4898184e3Ssthenuse parent qw(Pod::Perldoc::BaseTo);
5898184e3Ssthen
6898184e3Ssthenuse vars qw($VERSION);
7*9f11ffb7Safresh1$VERSION = '3.28';
8898184e3Ssthen
9898184e3Ssthensub is_pageable        { 1 }
10898184e3Ssthensub write_with_binmode { 0 }
11898184e3Ssthensub output_extension   { 'pod' }
12898184e3Ssthen
13898184e3Ssthensub new { return bless {}, ref($_[0]) || $_[0] }
14898184e3Ssthen
15898184e3Ssthensub parse_from_file {
16898184e3Ssthen  my( $self, $in, $outfh ) = @_;
17898184e3Ssthen
18898184e3Ssthen  open(IN, "<", $in) or $self->die( "Can't read-open $in: $!\nAborting" );
19898184e3Ssthen
20898184e3Ssthen  my $cut_mode = 1;
21898184e3Ssthen
22898184e3Ssthen  # A hack for finding things between =foo and =cut, inclusive
23898184e3Ssthen  local $_;
24898184e3Ssthen  while (<IN>) {
25898184e3Ssthen    if(  m/^=(\w+)/s ) {
26898184e3Ssthen      if($cut_mode = ($1 eq 'cut')) {
27898184e3Ssthen        print $outfh "\n=cut\n\n";
28898184e3Ssthen         # Pass thru the =cut line with some harmless
29898184e3Ssthen         #  (and occasionally helpful) padding
30898184e3Ssthen      }
31898184e3Ssthen    }
32898184e3Ssthen    next if $cut_mode;
33898184e3Ssthen    print $outfh $_ or $self->die( "Can't print to $outfh: $!" );
34898184e3Ssthen  }
35898184e3Ssthen
36898184e3Ssthen  close IN or $self->die( "Can't close $in: $!" );
37898184e3Ssthen  return;
38898184e3Ssthen}
39898184e3Ssthen
40898184e3Ssthen1;
41898184e3Ssthen__END__
42898184e3Ssthen
43898184e3Ssthen=head1 NAME
44898184e3Ssthen
45898184e3SsthenPod::Perldoc::ToPod - let Perldoc render Pod as ... Pod!
46898184e3Ssthen
47898184e3Ssthen=head1 SYNOPSIS
48898184e3Ssthen
49898184e3Ssthen  perldoc -opod Some::Modulename
50898184e3Ssthen
51898184e3Ssthen(That's currently the same as the following:)
52898184e3Ssthen
53898184e3Ssthen  perldoc -u Some::Modulename
54898184e3Ssthen
55898184e3Ssthen=head1 DESCRIPTION
56898184e3Ssthen
57898184e3SsthenThis is a "plug-in" class that allows Perldoc to display Pod source as
58898184e3Ssthenitself!  Pretty Zen, huh?
59898184e3Ssthen
60898184e3SsthenCurrently this class works by just filtering out the non-Pod stuff from
61898184e3Ssthena given input file.
62898184e3Ssthen
63898184e3Ssthen=head1 SEE ALSO
64898184e3Ssthen
65898184e3SsthenL<Pod::Perldoc>
66898184e3Ssthen
67898184e3Ssthen=head1 COPYRIGHT AND DISCLAIMERS
68898184e3Ssthen
69898184e3SsthenCopyright (c) 2002 Sean M. Burke.  All rights reserved.
70898184e3Ssthen
71898184e3SsthenThis library is free software; you can redistribute it and/or modify it
72898184e3Ssthenunder the same terms as Perl itself.
73898184e3Ssthen
74898184e3SsthenThis program is distributed in the hope that it will be useful, but
75898184e3Ssthenwithout any warranty; without even the implied warranty of
76898184e3Ssthenmerchantability or fitness for a particular purpose.
77898184e3Ssthen
78898184e3Ssthen=head1 AUTHOR
79898184e3Ssthen
80898184e3SsthenCurrent maintainer: Mark Allen C<< <mallencpan.org> >>
81898184e3Ssthen
82898184e3SsthenPast contributions from:
83898184e3Ssthenbrian d foy C<< <bdfoy@cpan.org> >>
84898184e3SsthenAdriano R. Ferreira C<< <ferreira@cpan.org> >>,
85898184e3SsthenSean M. Burke C<< <sburke@cpan.org> >>
86898184e3Ssthen
87898184e3Ssthen=cut
88898184e3Ssthen
89