| 1 |
# subclass for testing TAP::Harness custom sources |
| 2 |
|
| 3 |
package MyFileSourceHandler; |
| 4 |
|
| 5 |
use strict; |
| 6 |
use warnings; |
| 7 |
our ($LAST_OBJ, $CAN_HANDLE, $MAKE_ITER, $LAST_SOURCE); |
| 8 |
|
| 9 |
use TAP::Parser::IteratorFactory; |
| 10 |
|
| 11 |
use base qw( TAP::Parser::SourceHandler::File MyCustom ); |
| 12 |
$LAST_OBJ = undef; |
| 13 |
$CAN_HANDLE = undef; |
| 14 |
$MAKE_ITER = undef; |
| 15 |
$LAST_SOURCE = undef; |
| 16 |
|
| 17 |
TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); |
| 18 |
|
| 19 |
sub can_handle { |
| 20 |
my $class = shift; |
| 21 |
$class->SUPER::can_handle(@_); |
| 22 |
$CAN_HANDLE++; |
| 23 |
return 1; |
| 24 |
} |
| 25 |
|
| 26 |
sub make_iterator { |
| 27 |
my ( $class, $source ) = @_; |
| 28 |
my $iter = $class->SUPER::make_iterator($source); |
| 29 |
$MAKE_ITER++; |
| 30 |
$LAST_SOURCE = $source; |
| 31 |
return $iter; |
| 32 |
} |
| 33 |
|
| 34 |
1; |