Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: redirecting output from a format

by brian_d_foy (Abbot)
on Nov 30, 2004 at 05:46 UTC ( [id://411115]=note: print w/replies, xml ) Need Help??


in reply to redirecting output from a format

I ran into a similar problem and came up with a very ugly, don't-try-this-at-home solution I posted in use.perl
my( $totals, $failed ) = eval { local @INC = @INC; local *STDOUT; # Shut up Test::Harness! local *STDERR; # Yeah, you too! my $MM = ExtUtils::MM->new(); # and you! unshift @INC, map { File::Spec->rel2abs($_) } @{ $MM }{ qw( INST_LIB INST_ARCHLIB ) }; Test::Harness::_run_all_tests( @test_files ) };

I could use Test::Harness::Straps to do this all myself, but at the time I was on a bit of a deadline and wasn't sure I could reproduce everything _run_all_tests did, so I just wrapped it.

This solution is a slightly (very slightly) easier than shelling out to `make test` and parsing the output since I only needed the percentage of tests that fail. Besides, I was curious if it would work.

To repeat: very ugly kludge for demonstration purposes only. If you truly, deeply, and sincerely need to do this sort of thing, look at Test::Harness::Straps which can run everything for you and hand you back the information. I haven't done that yet because I've been little-l lazy (or big b Busy).

--
brian d foy <bdfoy@cpan.org>

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (9)
As of 2024-04-23 13:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found