Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Cannot redirect HTML output to a file using TAP::Formatter

by Illuminatus (Curate)
on Jun 28, 2011 at 22:47 UTC ( #911866=note: print w/ replies, xml ) Need Help??


in reply to Cannot redirect HTML output to a file using TAP::Formatter

Are you sure that you're using the latest version of TAP::Formatter::HTML (ie 0.09)? This small code sample runs fine for me:

#! /usr/bin/perl use strict; use warnings; use TAP::Harness; use TAP::Formatter::HTML; my @tests = glob( 't/*.t' ); # to use a custom formatter: my $fmt = TAP::Formatter::HTML->new; my $my_css; $fmt->css_uris([])->inline_css( $my_css ) ->js_uris(['http://mysite.com/jquery.js', 'http://mysite.com/cust +om.js']) ->inline_js( '$(div.summary).hide()' ); my $harness = TAP::Harness->new({ formatter => $fmt, merge => 1 }); $fmt->output_file( '/tmp/foo.html' );
If you are running an older version and can't upgrade, perhaps the output_fh accessor is there, and/or the environment variable.

fnord


Comment on Re: Cannot redirect HTML output to a file using TAP::Formatter
Download Code
Re^2: Cannot redirect HTML output to a file using TAP::Formatter
by mkhan (Sexton) on Jun 28, 2011 at 23:16 UTC
    I'm relatively new to this.
    Could you give me an example/sample code on how to use the output_fh accessor?

    Your help is appreciated. Also, I'm not able to install the TAP::Formatter:HTML package using cpanm on Strawberry Perl + Windows. It just hangs at "Building and testing .. ". How do I get around that? :S
      TAP::Formatter::HTML has a large number of dependencies. Run this script:
      #!/usr/bin/perl use strict; use warnings; use CPAN; CPAN::Shell->install( "accessors", "ExtUtils::ParseXS", "Module::CoreList", "Module::Load", "Params::Check", "Module::Load::Conditional", "Locale::Maketext::Simple", "IPC::Cmd", "ExtUtils::CBuilder", "Perl::OSType", "IO::Dir", "Version::Requirements", "Exporter", "CPAN::Meta::YAML", "JSON::PP", "Parse::CPAN::Meta", "CPAN::Meta", "version", "Module::Metadata", "Module::Build", "AppConfig", "File::Temp", "File::Spec", "Scalar::Util", "Template", "MIME::Base64", "Test::More", "URI", "Test::Harness", "TAP::Formatter::HTML");
      Then run this:
      #!/usr/bin/perl use strict; use warnings; use TAP::Harness; use TAP::Formatter::HTML; my $fmt = TAP::Formatter::HTML->new; my @tests = glob('*.t'); my $harness = TAP::Harness->new( { formatter => $fmt, merge => 1 } ); $fmt->output_file('output.html'); $harness->runtests(@tests);
        Thanks fnord and Khen.

        Both of your suggestions collectively resolved my issue.
        1. PPM installed an older version of TFH module.
        2. I had to install all the dependencies before getting it to work

        I now regret giving up on strawberry Perl because I thought the problem was with it.

        Also beyond the context of this thread, worth mentioning is this thread: http://www.perlmonks.org/?node_id=890830
        Great tips/solutions for ActivePerl on 64-bit Windows and how to get cpan working on it.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://911866]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2015-07-06 05:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls