xref: /openbsd-src/gnu/usr.bin/perl/cpan/Test-Harness/t/lib/TAP/Parser/SubclassTest.pm (revision 6fb12b7054efc6b436584db6cef9c2f85c0d7e27)
1b39c5158Smillert# subclass for testing subclassing
2b39c5158Smillert
3b39c5158Smillertpackage TAP::Parser::SubclassTest;
4b39c5158Smillert
5b39c5158Smillertuse strict;
6*6fb12b70Safresh1use warnings;
7b39c5158Smillert
8898184e3Ssthenuse MySourceHandler;
9898184e3Ssthenuse MyPerlSourceHandler;
10b39c5158Smillertuse MyGrammar;
11b39c5158Smillertuse MyResultFactory;
12b39c5158Smillert
13*6fb12b70Safresh1use base qw( TAP::Parser MyCustom );
14b39c5158Smillert
15898184e3Ssthensub _default_source_class         {'MySourceHandler'}        # deprecated
16898184e3Ssthensub _default_perl_source_class    {'MyPerlSourceHandler'}    # deprecated
17b39c5158Smillertsub _default_grammar_class        {'MyGrammar'}
18b39c5158Smillertsub _default_result_factory_class {'MyResultFactory'}
19b39c5158Smillert
20898184e3Ssthensub make_source { shift->SUPER::make_source(@_)->custom }    # deprecated
21898184e3Ssthen
22898184e3Ssthensub make_perl_source {
23898184e3Ssthen    shift->SUPER::make_perl_source(@_)->custom;
24898184e3Ssthen}                                                            # deprecated
25b39c5158Smillertsub make_grammar  { shift->SUPER::make_grammar(@_)->custom }
26898184e3Ssthensub make_iterator { shift->SUPER::make_iterator(@_)->custom }    # deprecated
27b39c5158Smillertsub make_result   { shift->SUPER::make_result(@_)->custom }
28b39c5158Smillert
29b39c5158Smillertsub _initialize {
30b39c5158Smillert    my $self = shift;
31b39c5158Smillert    $self->SUPER::_initialize(@_);
32b39c5158Smillert    $main::INIT{ ref($self) }++;
33b39c5158Smillert    $self->{initialized} = 1;
34b39c5158Smillert    return $self;
35b39c5158Smillert}
36b39c5158Smillert
37b39c5158Smillert1;
38