Posted on 2008-08-27 13:13:00-07 by tillersweep
Real Rookie question
I love this module but... After struggling with varions regex to determine if I had a number this is very refreshing. Of course I am a rookie, so this is obvious to everyone but me, but the thing is really chatty. It outputs to the screen the result of every compare (I have thousands). It also sends warnings that a test failed (in my case it isn't a number). It also tells me if I have more or less than the predicted number of tests. All this slows it down. I have no idea what the $name variable is used for in the documentation and that could be part of the problem. It works, this is a simplified version of what I have.
use Test::Numeric tests => 50000; if ( is_number $this_element ) { $this_is_a_data_line = 1; }
Sorry, I am a real rookie.
Direct Responses: 8717 | Write a response
Posted on 2008-09-02 11:57:06-07 by tillersweep in response to 8678
Re: Real Rookie question
I have tried redirecting STDERR and STDOUT and it still goes to the screen.
#open ( STDOUT, "> nul" ) or die $!; #open ( STDERR, "> nul" ) or die $!; open STDERR, '>nul'; open STDOUT, '>nul'; if ( is_number $this_element ) {... close STDERR; close STDOUT;
It still blasts away on each compare and it proudly declares how many tests it ran.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.