#! /usr/local/bin/perl -w

use strict;
use warnings;

use Perl6::Perldoc::Parser;
use Perl6::Perldoc::To::Text;

my $source_file = $ARGV[0] || \*STDIN;

print Perl6::Perldoc::Parser->parse( $source_file, {all_pod=>'auto'} )
                            ->report_errors()
                            ->to_text()
                            ;

__END__ 

=head1 NAME

perldoc2text - Convert Perldoc markup to plaintext

=head1 VERSION

This documentation refers to perldoc2text version 0.0.1
This version is still a prototype.

=head1 USAGE

    perldoc2text [filename]

=head1 REQUIRED ARGUMENTS

None.

=head1 OPTIONS

May be given a single argument specifying the name of the file to convert.
If filename not given, reads from STDIN.

=head1 DESCRIPTION

This utility converts documentation in the Perl 6 "Perldoc" notation to
plaintext. The plaintext is always written to STDOUT.


=head1 DIAGNOSTICS

See the documentation for Perl6::Perldoc::Parser


=head1 CONFIGURATION AND ENVIRONMENT

Requires no configuration files or environment variables.


=head1 DEPENDENCIES

Perl6::Perldoc::Parser


=head1 BUGS

None reported.
Bug reports and other feedback are most welcome.


=head1 AUTHOR

Damian Conway C<< DCONWAY@cpan.org >>


=head1 COPYRIGHT

Copyright (c) 2007, Damian Conway C<< <DCONWAY@cpan.org> >>. All rights reserved.

This module is free software. It may be used, redistributed
and/or modified under the terms of the Perl Artistic License
(see http://www.perl.com/perl/misc/Artistic.html)


=head1 DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH
YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE
LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL,
OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.


