| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | # $Header: /home/fergal/my/cvs/Test-Tester/lib/Test/Tester/CaptureRunner.pm,v 1.3 2003/03/05 01:07:55 fergal Exp $ | 
| 2 | 6 |  |  | 6 |  | 41 | use strict; | 
|  | 6 |  |  |  |  | 16 |  | 
|  | 6 |  |  |  |  | 336 |  | 
| 3 |  |  |  |  |  |  |  | 
| 4 |  |  |  |  |  |  | package Test::Tester::CaptureRunner; | 
| 5 |  |  |  |  |  |  |  | 
| 6 |  |  |  |  |  |  | our $VERSION = '1.302182'; | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 | 6 |  |  | 6 |  | 2673 | use Test::Tester::Capture; | 
|  | 6 |  |  |  |  | 17 |  | 
|  | 6 |  |  |  |  | 1457 |  | 
| 10 |  |  |  |  |  |  | require Exporter; | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  | sub new | 
| 13 |  |  |  |  |  |  | { | 
| 14 | 6 |  |  | 6 | 0 | 13 | my $pkg = shift; | 
| 15 | 6 |  |  |  |  | 15 | my $self = bless {}, $pkg; | 
| 16 | 6 |  |  |  |  | 15 | return $self; | 
| 17 |  |  |  |  |  |  | } | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | sub run_tests | 
| 20 |  |  |  |  |  |  | { | 
| 21 | 18 |  |  | 18 | 0 | 35 | my $self = shift; | 
| 22 |  |  |  |  |  |  |  | 
| 23 | 18 |  |  |  |  | 26 | my $test = shift; | 
| 24 |  |  |  |  |  |  |  | 
| 25 | 18 |  |  |  |  | 42 | capture()->reset; | 
| 26 |  |  |  |  |  |  |  | 
| 27 | 18 |  |  |  |  | 121 | $self->{StartLevel} = $Test::Builder::Level; | 
| 28 | 18 |  |  |  |  | 168 | &$test(); | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | sub get_results | 
| 32 |  |  |  |  |  |  | { | 
| 33 | 18 |  |  | 18 | 0 | 37 | my $self = shift; | 
| 34 | 18 |  |  |  |  | 35 | my @results = capture()->details; | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 18 |  |  |  |  | 43 | my $start = $self->{StartLevel}; | 
| 37 | 18 |  |  |  |  | 42 | foreach my $res (@results) | 
| 38 |  |  |  |  |  |  | { | 
| 39 | 26 | 50 |  |  |  | 65 | next if defined $res->{depth}; | 
| 40 | 26 |  |  |  |  | 69 | my $depth = $res->{_depth} - $res->{_level} - $start - 3; | 
| 41 |  |  |  |  |  |  | #		print "my $depth = $res->{_depth} - $res->{_level} - $start - 1\n"; | 
| 42 | 26 |  |  |  |  | 54 | $res->{depth} = $depth; | 
| 43 |  |  |  |  |  |  | } | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 18 |  |  |  |  | 85 | return @results; | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  |  | 
| 48 |  |  |  |  |  |  | sub get_premature | 
| 49 |  |  |  |  |  |  | { | 
| 50 | 18 |  |  | 18 | 0 | 41 | return capture()->premature; | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | sub capture | 
| 54 |  |  |  |  |  |  | { | 
| 55 | 54 |  |  | 54 | 0 | 138 | return Test::Tester::Capture->new; | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | __END__ | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | =head1 NAME | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | Test::Tester::CaptureRunner - Help testing test modules built with Test::Builder | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | This stuff if needed to allow me to play with other ways of monitoring the | 
| 67 |  |  |  |  |  |  | test results. | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | =head1 AUTHOR | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | Copyright 2003 by Fergal Daly <fergal@esatclear.ie>. | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | =head1 LICENSE | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | Under the same license as Perl itself | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | See http://www.perl.com/perl/misc/Artistic.html | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | =cut |