# perldoc > Pod::Text

---
type: CommandReference
command: Pod::Text
mode: perldoc
section: ""
source: perldoc
---

## Quick Reference

- `Pod::Text->new(%opts)` — create a new parser with options
- `$parser->parse_from_filehandle` — read POD from STDIN, write to STDOUT
- `$parser->parse_from_file($infile, $outfile)` — read from file, write to file
- `$parser->parse_string_document($string)` — parse POD string in memory
- `$parser->parse_lines(@lines)` — parse array of lines (raw bytes)
- `$parser->output_fh($fh)` — set output filehandle
- `$parser->output_string(\$string)` — capture output to a scalar reference
- `$parser->parse_file($filename)` — parse a file (from Pod::Simple)

## Name

Convert POD data to formatted text

## Synopsis

perl
use Pod::Text;
my $parser = Pod::Text->new(sentence => 1, width => 78);

# Read POD from STDIN and write to STDOUT.
$parser->parse_from_filehandle;

# Read POD from file.pod and write to file.txt.
$parser->parse_from_file('file.pod', 'file.txt');
## Options

### Constructor Options

- `alt` — select alternate output format (different heading style, colon in left margin for =item). Default false.
- `code` — include non-POD parts of input file in output. Default false.
- `errors` — error handling: "die" (throw exception), "stderr" (report to stderr), "pod" (include POD ERRORS section), "none" (ignore). Default "pod".
- `indent` — spaces to indent regular text and default for =over blocks. Default 4.
- `loose` — print blank line after =head1 headings. Default false (only blank line after =head2).
- `margin` — left margin width in spaces. Default 0.
- `nourls` — suppress URL in L<> formatting when anchor text is given. Default false.
- `quotes` — quote marks for C<> text. Single character used as both left and right; even-length string split in half. Special value "none" suppresses quotes.
- `sentence` — assume two spaces after each sentence; preserve spacing. Default false.
- `stderr` — send error messages to stderr (backward compatibility, equivalent to `errors => 'stderr'`).
- `utf8` — force output encoding to UTF-8. Requires proper input encoding declaration via =encoding. Default false. **Note:** Requires PerlIO support; otherwise not available.
- `width` — right-hand wrap column. Default 76.

### Methods

- `parse_file($filename)` — read POD from file, output to STDOUT (or set via `output_fh`).
- `parse_from_file($infile, $outfile)` — read from infile, write to outfile.
- `parse_from_filehandle` — read from STDIN, write to STDOUT.
- `parse_lines(@lines)` — parse array of lines (raw bytes).
- `parse_string_document($string)` — parse POD string in memory.
- `output_fh($fh)` — set output filehandle.
- `output_string(\$string)` — capture output to a scalar reference.

## Diagnostics

- `Bizarre space in item` — (W) Internal error in =item processing.
- `Item called without tag` — (W) Internal error in =item processing.
- `Can't open %s for reading: %s` — (F) Input file could not be opened (compatibility mode).
- `Invalid errors setting "%s"` — (F) Unknown value for errors option.
- `Invalid quote specification "%s"` — (F) Invalid quotes option (must be 1 character or even length >1).
- `POD document had syntax errors` — (F) POD has syntax errors and errors option is "die".

## Examples

Create a parser and parse a file:

perl
use Pod::Text;
my $parser = Pod::Text->new(sentence => 1, width => 78);
$parser->parse_from_file('file.pod', 'file.txt');
Parse POD from a string and capture output:

perl
use Pod::Text;
my $parser = Pod::Text->new;
my $output;
$parser->output_string(\$output);
$parser->parse_string_document("=head1 NAME\n\nMy Document\n");
print $output;
Use alternate output format:

perl
my $parser = Pod::Text->new(alt => 1);
## See Also

- [Pod::Simple](http://localhost/phpMan.php/perldoc/Pod%3A%3ASimple/markdown)
- [Pod::Text::Termcap](http://localhost/phpMan.php/perldoc/Pod%3A%3AText%3A%3ATermcap/markdown)
- [perlpod(1)](http://localhost/phpMan.php/man/perlpod/1/markdown)
- [pod2text(1)](http://localhost/phpMan.php/man/pod2text/1/markdown)
- [https://www.eyrie.org/~eagle/software/podlators/](https://www.eyrie.org/~eagle/software/podlators/)