Perl Pod没有输出::简单

Perl Pod没有输出::简单,perl,stdout,perl-pod,Perl,Stdout,Perl Pod,我试图在perl中使用Pod::Simple,但没有得到任何输出。我可以使用Pod::Simple::Text获得输出。下面是一个简短的测试程序: use English; use strict; use Pod::Simple; use Pod::Simple::Text; my $pod_document = <<END_POD; =pod =head1 NAME something =head1 SYNOPSIS something else =cut END_PO

我试图在perl中使用Pod::Simple,但没有得到任何输出。我可以使用Pod::Simple::Text获得输出。下面是一个简短的测试程序:

use English;
use strict;
use Pod::Simple;
use Pod::Simple::Text;

my $pod_document = <<END_POD;
=pod

=head1 NAME

something

=head1 SYNOPSIS

something else

=cut
END_POD

my $pod_parser = new Pod::Simple();
my $pod_output;
if  ($ARGV[0] == 1) {$pod_parser->output_fh(*STDOUT);}
if  ($ARGV[0] == 2) {$pod_parser->output_fh(\*STDOUT);}
if  ($ARGV[0] == 3) {$pod_parser->output_fh(*STDOUT{IO});}
if  ($ARGV[0] == 4) {$pod_parser->output_string(\$pod_output);}
if  ($ARGV[0] == 5) {Pod::Simple::Text->filter(\$pod_document);}
$pod_parser->parse_string_document(\$pod_document);
if  ($ARGV[0] == 4) {print $pod_output;}

exit 0;
使用英语;
严格使用;
使用Pod::简单;
使用Pod::Simple::Text;
my$pod\u document=output\u fh(\*STDOUT);}
if($ARGV[0]==3){$pod_parser->output_fh(*STDOUT{IO});}
if($ARGV[0]==4){$pod\u解析器->输出\u字符串(\$pod\u输出);}
如果($ARGV[0]==5){Pod::Simple::Text->filter(\$Pod\u document);}
$pod\u parser->parse\u string\u文档(\$pod\u文档);
如果($ARGV[0]==4){print$pod_output;}
出口0;
我将此perl代码放入一个名为pod-test.pl的文件中。如果使用命令行参数1、2、3或4运行它,则不会得到任何输出。”perl-pod-test.pl 5'工作正常

我应该如何调用output\u fh或output\u string方法?

该模块旨在用作您自己编写的Pod格式化程序子类的基类。子类提供了生成最终文档的方法,因此没有它,
Pod::Simple
就不会产生任何输出,如您所见

如果您只需要简单的文本输出,那么已经在中为您编写了一个子类。你会像这样使用它吗

use strict;
use warnings;

use English;
use strict;
use Pod::Simple::Text;

my $pod_document = <<END_POD;
=pod

=head1 NAME

something

=head1 SYNOPSIS

something else

=cut
END_POD

my $pod_parser = Pod::Simple::Text->new;
$pod_parser->output_fh(*STDOUT);
$pod_parser->parse_string_document($pod_document);
该模块旨在用作您自己编写的Pod格式化程序子类的基类。子类提供了生成最终文档的方法,因此没有它,
Pod::Simple
就不会产生任何输出,如您所见

如果您只需要简单的文本输出,那么已经在中为您编写了一个子类。你会像这样使用它吗

use strict;
use warnings;

use English;
use strict;
use Pod::Simple::Text;

my $pod_document = <<END_POD;
=pod

=head1 NAME

something

=head1 SYNOPSIS

something else

=cut
END_POD

my $pod_parser = Pod::Simple::Text->new;
$pod_parser->output_fh(*STDOUT);
$pod_parser->parse_string_document($pod_document);

谢谢你给我一个标准的高质量的答案。永远感激学习新事物。谢谢。我做了更改,代码现在可以在我的环境中运行。我犯的另一个错误是将标量引用传递给parse\u string\u document方法,$pod\u parser->parse\u string\u document(\$pod\u document),而不是像您那样简单地传递标量,$pod\u parser->parse\u string\u document($pod\u document)。@davidelvner:我很高兴您成功了。困扰我的是,您在问题中说,“我可以使用
Pod::Simple::Text
”获得输出,而我在编写解决方案时忽略了这一点。看来你可能已经有了答案,我想知道你为什么想用另一种方式工作呢?谢谢你给我提供了一个标准的高质量的答案。永远感激学习新事物。谢谢。我做了更改,代码现在可以在我的环境中运行。我犯的另一个错误是将标量引用传递给parse\u string\u document方法,$pod\u parser->parse\u string\u document(\$pod\u document),而不是像您那样简单地传递标量,$pod\u parser->parse\u string\u document($pod\u document)。@davidelvner:我很高兴您成功了。困扰我的是,您在问题中说,“我可以使用
Pod::Simple::Text
”获得输出,而我在编写解决方案时忽略了这一点。看来你可能已经有了答案,我想知道你为什么想让它以不同的方式工作?