TAP::Formatter::HTML - 将生成的 HTML 的输出重定向到文件
我在 Perl/Windoes 中使用来自 CPAN 的 TAP::Formatter::HTML 模块。我注意到有一个选项允许我们重定向文件中的 HTML 输出,即:输出文件()。
但是,我想我错过了一些东西。
我尝试使用 $fmt->output_file($outputfile) 但无济于事。
它给了我以下错误: 无法通过点击包“TAP::Formatter::HTML”找到对象方法“output_fh” .pl 第 12 行。
有人能告诉我我错过了什么吗? 解释如何重定向输出的示例代码将是理想的选择。
我检查了一个名为“knb”的用户的帖子,他似乎使用过这个模块。 我希望他也能读到这篇文章。
谢谢!
代码:
use TAP::Harness;
use IO::Handle;
use TAP::Formatter::HTML;
use File::Glob::Windows;
use TAP::Parser::Aggregator;
my $fmt = TAP::Formatter::HTML->new;
my @tests = glob( 'te*.pl');
my $harness = TAP::Harness->new( { formatter => $fmt, merge => 1 } );
$fmt->output_file('output.html');
$harness->runtests(@tests);
I'm using the TAP::Formatter::HTML module from CPAN in Perl/Windoes. I notice that there is an option that allows us to redirect the HTML output in a file viz. output_file().
However, I think I'm missing something.
I tried using $fmt->output_file($outputfile) but to no avail.
It gives me the following error:
Can't locate object method "output_fh" via package "TAP::Formatter::HTML" at tap
.pl line 12.
Could someone tell me what am I missing?
A sample code that explains how to redirect the output would be ideal.
I checked a post by a user named "knb" who seems to have worked with this module.
I hope he reads this as well.
Thanks!
CODE:
use TAP::Harness;
use IO::Handle;
use TAP::Formatter::HTML;
use File::Glob::Windows;
use TAP::Parser::Aggregator;
my $fmt = TAP::Formatter::HTML->new;
my @tests = glob( 'te*.pl');
my $harness = TAP::Harness->new( { formatter => $fmt, merge => 1 } );
$fmt->output_file('output.html');
$harness->runtests(@tests);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在 Windows 上安装它时遇到了一些问题(需要跳过测试才能继续),但您的简化脚本对我有用:
此构建的
output.html
文件包含测试结果。然而,它没有正确包含 javascript 和 css 文件。I had a bit of problems to install it on Windows (needed to skip tests to proceed), but your simplified script works for me:
This built
output.html
file with test results. It however did not properly include javascripts and css files.