1package Pod::Perldoc::ToPod; 2use strict; 3use warnings; 4use parent qw(Pod::Perldoc::BaseTo); 5 6use vars qw($VERSION); 7$VERSION = '3.28'; 8 9sub is_pageable { 1 } 10sub write_with_binmode { 0 } 11sub output_extension { 'pod' } 12 13sub new { return bless {}, ref($_[0]) || $_[0] } 14 15sub parse_from_file { 16 my( $self, $in, $outfh ) = @_; 17 18 open(IN, "<", $in) or $self->die( "Can't read-open $in: $!\nAborting" ); 19 20 my $cut_mode = 1; 21 22 # A hack for finding things between =foo and =cut, inclusive 23 local $_; 24 while (<IN>) { 25 if( m/^=(\w+)/s ) { 26 if($cut_mode = ($1 eq 'cut')) { 27 print $outfh "\n=cut\n\n"; 28 # Pass thru the =cut line with some harmless 29 # (and occasionally helpful) padding 30 } 31 } 32 next if $cut_mode; 33 print $outfh $_ or $self->die( "Can't print to $outfh: $!" ); 34 } 35 36 close IN or $self->die( "Can't close $in: $!" ); 37 return; 38} 39 401; 41__END__ 42 43=head1 NAME 44 45Pod::Perldoc::ToPod - let Perldoc render Pod as ... Pod! 46 47=head1 SYNOPSIS 48 49 perldoc -opod Some::Modulename 50 51(That's currently the same as the following:) 52 53 perldoc -u Some::Modulename 54 55=head1 DESCRIPTION 56 57This is a "plug-in" class that allows Perldoc to display Pod source as 58itself! Pretty Zen, huh? 59 60Currently this class works by just filtering out the non-Pod stuff from 61a given input file. 62 63=head1 SEE ALSO 64 65L<Pod::Perldoc> 66 67=head1 COPYRIGHT AND DISCLAIMERS 68 69Copyright (c) 2002 Sean M. Burke. All rights reserved. 70 71This library is free software; you can redistribute it and/or modify it 72under the same terms as Perl itself. 73 74This program is distributed in the hope that it will be useful, but 75without any warranty; without even the implied warranty of 76merchantability or fitness for a particular purpose. 77 78=head1 AUTHOR 79 80Current maintainer: Mark Allen C<< <mallencpan.org> >> 81 82Past contributions from: 83brian d foy C<< <bdfoy@cpan.org> >> 84Adriano R. Ferreira C<< <ferreira@cpan.org> >>, 85Sean M. Burke C<< <sburke@cpan.org> >> 86 87=cut 88 89