Astro-Coord-ECI-TLE-Iridium

 view release on metacpan or  search on metacpan

inc/My/Module/Build.pm  view on Meta::CPAN

optionals_test
AUTHOR_TESTING=1
PERL5OPT=-MTest::Without::Module=$optionals
EOD

    # Not depends_on(), because that is idempotent. But we really do
    # want to run 'test' more than once if we do more than one of the
    # *_test actions.
    $self->dispatch( 'test' );

    return;
}

sub ACTION_structural_test {
    my ( $self ) = @_;

    local $ENV{AUTHOR_TESTING} = 1;

    $self->my_depends_on();

    print <<'EOD';

structural_test
AUTHOR_TESTING=1
EOD

    my $structural_test_files = 'xt/author';
    if ( $self->can( 'args' ) ) {
	my @arg = $self->args();
	for ( my $inx = 0; $inx < $#arg; $inx += 2 ) {
	    $arg[$inx] =~ m/ \A structural[-_]test[-_]files \z /smx
		or next;
	    $structural_test_files = $arg[ $inx + 1 ];
	    last;
	}
    }
    $self->test_files( $structural_test_files );

    # Not depends_on(), because that is idempotent. But we really do
    # want to run 'test' more than once if we do more than one of the
    # *_test actions.
    $self->dispatch( 'test' );

    return;
}

sub my_depends_on {
    my ( $self ) = @_;
    my @depends_on;
    -d 'blib'
	or push @depends_on, 'build';
    -e 'META.json'
	or push @depends_on, 'distmeta';
    @depends_on
	and $self->depends_on( @depends_on );
    return;
}

sub harness_switches {
    my ( $self ) = @_;
    my @res = $self->SUPER::harness_switches();
    foreach ( @res ) {
	'-MDevel::Cover' eq $_
	    or next;
	$_ .= '=-db,cover_db,-ignore,inc/';
    }
    return @res;
}

1;

__END__

=head1 NAME

My::Module::Build - Extend Module::Build for My::Module

=head1 SYNOPSIS

 perl Build.PL
 ./Build
 ./Build test
 ./Build authortest # supplied by this module
 ./Build install

=head1 DESCRIPTION

This extension of L<Module::Build|Module::Build> adds the following
action to those provided by L<Module::Build|Module::Build>:

  authortest

=head1 ACTIONS

This module provides the following actions:

=over

=item authortest

This action does nothing on its own, but it depends on
L<functional_test|/functional_test>, L<optionals_test|/optionals_test>,
and L<structural_test|/structural_test>, so invoking it runs all these tests.

=item functional_test

This action is the same as C<test>, but the C<AUTHORTEST> environment
variable is set to true.

This test is sensitive to both the C<verbose> argument and the
C<test-files> argument.

=item optionals_test

This action is the same as C<test>, but the C<AUTHORTEST> environment
variable is set to true, and the C<PERL5OPT> environment variable is set
to C<-MTest::Without::Module=...>, where the elipsis is a
comma-separated list of all optional modules.

This test is sensitive to both the C<verbose> argument and the
C<test-files> argument.



( run in 2.056 seconds using v1.01-cache-2.11-cpan-98e64b0badf )