summaryrefslogtreecommitdiff
path: root/t/lib/TAP/Parser/SubclassTest.pm
blob: 84becee932cdfa9092ba3316ec95679f5b3ddacc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# subclass for testing subclassing

package TAP::Parser::SubclassTest;

use strict;
use vars qw(@ISA);

use TAP::Parser;

use MyCustom;
use MySource;
use MyPerlSource;
use MyGrammar;
use MyIteratorFactory;
use MyResultFactory;

@ISA = qw( TAP::Parser MyCustom );

sub _default_source_class           {'MySource'}
sub _default_perl_source_class      {'MyPerlSource'}
sub _default_grammar_class          {'MyGrammar'}
sub _default_iterator_factory_class {'MyIteratorFactory'}
sub _default_result_factory_class   {'MyResultFactory'}

sub make_source      { shift->SUPER::make_source(@_)->custom }
sub make_perl_source { shift->SUPER::make_perl_source(@_)->custom }
sub make_grammar     { shift->SUPER::make_grammar(@_)->custom }
sub make_iterator    { shift->SUPER::make_iterator(@_)->custom }
sub make_result      { shift->SUPER::make_result(@_)->custom }

sub _initialize {
    my $self = shift;
    $self->SUPER::_initialize(@_);
    $main::INIT{ ref($self) }++;
    $self->{initialized} = 1;
    return $self;
}

1;