summaryrefslogtreecommitdiffstats
path: root/gnu/usr.bin/perl/cpan/Test-Harness/t/lib/MySourceHandler.pm
diff options
context:
space:
mode:
authorsthen <sthen@openbsd.org>2013-03-25 20:06:16 +0000
committersthen <sthen@openbsd.org>2013-03-25 20:06:16 +0000
commit898184e3e61f9129feb5978fad5a8c6865f00b92 (patch)
tree56f32aefc1eed60b534611007c7856f82697a205 /gnu/usr.bin/perl/cpan/Test-Harness/t/lib/MySourceHandler.pm
parentPGSHIFT -> PAGE_SHIFT (diff)
downloadwireguard-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.pm39
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;