diff options
author | 2013-03-25 20:06:16 +0000 | |
---|---|---|
committer | 2013-03-25 20:06:16 +0000 | |
commit | 898184e3e61f9129feb5978fad5a8c6865f00b92 (patch) | |
tree | 56f32aefc1eed60b534611007c7856f82697a205 /gnu/usr.bin/perl/cpan/Test-Harness/t/lib/MySourceHandler.pm | |
parent | PGSHIFT -> PAGE_SHIFT (diff) | |
download | wireguard-openbsd-898184e3e61f9129feb5978fad5a8c6865f00b92.tar.xz wireguard-openbsd-898184e3e61f9129feb5978fad5a8c6865f00b92.zip |
import perl 5.16.3 from CPAN - worked on by Andrew Fresh and myself
Diffstat (limited to 'gnu/usr.bin/perl/cpan/Test-Harness/t/lib/MySourceHandler.pm')
-rw-r--r-- | gnu/usr.bin/perl/cpan/Test-Harness/t/lib/MySourceHandler.pm | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gnu/usr.bin/perl/cpan/Test-Harness/t/lib/MySourceHandler.pm b/gnu/usr.bin/perl/cpan/Test-Harness/t/lib/MySourceHandler.pm new file mode 100644 index 00000000000..67cbee016f6 --- /dev/null +++ b/gnu/usr.bin/perl/cpan/Test-Harness/t/lib/MySourceHandler.pm @@ -0,0 +1,39 @@ +# subclass for testing customizing & subclassing + +package MySourceHandler; + +use strict; +use vars '@ISA'; + +use MyCustom; +use MyIterator; +use TAP::Parser::SourceHandler; +use TAP::Parser::IteratorFactory; + +#@ISA = qw( TAP::Parser::SourceHandler MyCustom ); +@ISA = qw( MyCustom ); + +TAP::Parser::IteratorFactory->register_handler(__PACKAGE__); + +sub can_handle { + my ( $class, $source ) = @_; + my $meta = $source->meta; + my $config = $source->config_for($class); + + if ( $config->{accept_all} ) { + return 1; + } + elsif ( my $accept = $config->{accept} ) { + return 0 unless $meta->{is_scalar}; + return 1 if ${ $source->raw } eq $accept; + } + return 0; +} + +sub make_iterator { + my ( $class, $source ) = @_; + $class->custom; + return MyIterator->new( [ $source->raw ] ); +} + +1; |