テストの前とかあとにフックするとかの件
http://mt.endeworks.jp/d-6/2010/10/miextendsmaketest.html
について。
ちょっと遅レスですが、以下のようなコードを Module::Install::TestTarget で処理するという話なんですが
replace_default_make_test includes => [ "modules/common/lib" ], env => { MYAPP_CONFIG => 't/config.pl' }, before_run_scripts => [ 't/start_daemons.pl', 't/load_fixtures.pl' ], ;
Module::Build だと inc/MyBuilder.pm を以下のようにかいておいて
package inc::MyBuilder; use strict; use warnings; use parent qw(Module::Build); sub ACTION_test { my $self = shift; $self->do_system('t/start_daemons.pl'); $self->do_system('t/load_fixtures.pl'); local %ENV = %ENV; $ENV{MYAPP_CONFIG} = 't/config.pl'; local @INC = @INC; unshift @INC, 'modules/common/lib'; $self->generic_test(type => 'default'); } 1;
Build.PL を以下のようにかくと、おなじことができます。
use strict; use warnings; use inc::MyBuilder; my $build = inc::MyBuilder->new( license => 'perl', dynamic_config => 0, dist_abstract => 'xaicron', build_requires => { 'Test::More' => '0.98', 'Test::Requires' => 0, }, configure_requires => { 'Module::Build' => '0.38' }, requires => { # 'Exporter' => '0', 'parent' => '0', # 'Plack' => '0.9949', }, no_index => { 'directory' => [ 'inc' ] }, name => 'Suzuki', module_name => 'Shimada', # script_files => [''], test_files => (-d '.git' || $ENV{RELEASE_TESTING}) ? 't/ xt/' : 't/', recursive_test_files => 1, create_readme => 1, create_license => 1, ); $build->create_build_script();