A question: is there any reason that you made this an OO module but still show calls to the methods as functions rather than methods on the object?
I.e. why C<verify_number_lines($capture)> rather than C<$capture->verify_number_lines> ? This would also remove the need to explicitly export those functions.
Just askin'. :-)
Ask and ye shall receive! TestAuxiliary is now IO::Capture::Stdout::Extended.
http://mysite.verizon.net/jkeen/perl/modules/misc/IO-Capture-Stdout-Extended-0.02.tar.gz
Here is the SYNOPSIS:
use IO::Capture::Stdout::Extended;
$capture = IO::Capture::Stdout::Extended->new(); $capture->start(); # some code that prints to STDOUT $capture->stop();
# scalar context: return number of print statements with 'fox' $matches = $capture->grep_print_statements('fox');
# list context: return list of print statements with 'fox' @matches = $capture->grep_print_statements('fox');
# return number of print statements $matches = $capture->statements;
# scalar context: return number of pattern matches $regex = qr/some regular expression/; $matches = $capture->matches($regex);
# list context: return list of pattern matches @matches = $capture->matches($regex);
# return reference to array holding list of pattern matches $matchesref = $capture->matches_ref($regex);
All the functionality has been reworked into a valid, object-oriented subclass of IO::Capture::Stdout. Tests and documentation have been reworked. Contributors to this thread will recognize that (some of) their suggestions have been implemented. (And, for you coverage mavens, the coverage is 100% all around!)
I've submitted this to the authors of IO::Capture. Enjoy!
Jim Keenan