This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Assimilate Pod-Simple-3.03 to the Perl core
[perl5.git] / lib / Pod / Simple / TextContent.pm
1
2
3 require 5;
4 package Pod::Simple::TextContent;
5 use strict;
6 use Carp ();
7 use Pod::Simple ();
8 use vars qw( @ISA $VERSION );
9 $VERSION = '2.02';
10 @ISA = ('Pod::Simple');
11
12 sub new {
13   my $self = shift;
14   my $new = $self->SUPER::new(@_);
15   $new->{'output_fh'} ||= *STDOUT{IO};
16   $new->nix_X_codes(1);
17   return $new;
18 }
19
20 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22 sub _handle_element_start {
23   print {$_[0]{'output_fh'}} "\n"  unless $_[1] =~ m/^[A-Z]$/s;
24   return;
25 }
26
27 sub _handle_text {
28   if( chr(65) eq 'A' ) {     # in ASCIIworld
29     $_[1] =~ tr/\xAD//d;
30     $_[1] =~ tr/\xA0/ /;
31   }
32   print {$_[0]{'output_fh'}} $_[1];
33   return;
34 }
35
36 sub _handle_element_end {
37   print {$_[0]{'output_fh'}} "\n"  unless $_[1] =~ m/^[A-Z]$/s;
38   return;
39 }
40
41 #@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
42 1;
43
44
45 __END__
46
47 =head1 NAME
48
49 Pod::Simple::TextContent -- get the text content of Pod
50
51 =head1 SYNOPSIS
52
53  TODO
54
55   perl -MPod::Simple::TextContent -e \
56    "exit Pod::Simple::TextContent->filter(shift)->any_errata_seen" \
57    thingy.pod
58
59 =head1 DESCRIPTION
60
61 This class is that parses Pod and dumps just the text content.  It is
62 mainly meant for use by the Pod::Simple test suite, but you may find
63 some other use for it.
64
65 This is a subclass of L<Pod::Simple> and inherits all its methods.
66
67 =head1 SEE ALSO
68
69 L<Pod::Simple>, L<Pod::Simple::Text>, L<Pod::Spell>
70
71 =head1 COPYRIGHT AND DISCLAIMERS
72
73 Copyright (c) 2002 Sean M. Burke.  All rights reserved.
74
75 This library is free software; you can redistribute it and/or modify it
76 under the same terms as Perl itself.
77
78 This program is distributed in the hope that it will be useful, but
79 without any warranty; without even the implied warranty of
80 merchantability or fitness for a particular purpose.
81
82 =head1 AUTHOR
83
84 Sean M. Burke C<sburke@cpan.org>
85
86 =cut
87