BigLug has asked for the wisdom of the Perl Monks concerning the following question:

Two (not so) Frequently Asked Questions concerning MakeMaker:

1. Can I add something to my Makefile.PL that will allow a user to make testmore. When they do that, I want the tests matching t/more/*.t to be run.

2. How do I go about asking the user a question after make but before make install? I figure I need to add something like a make preinstall that is autorun by make install if it hasn't already.

Cheers!
Rick
If this is a root node: Before responding, please ensure your clue bit is set.
If this is a reply: This is a discussion group, not a helpdesk ... If the discussion happens to answer a question you've asked, that's incidental.

Replies are listed 'Best First'.
Re: MakeMaker nsFAQs
by adrianh (Chancellor) on Aug 18, 2004 at 08:37 UTC

    You might want to consider looking at Module::Build instead of EU::MM. It makes these sort of customisation very easy. You'd just need to subclass it and do something like (untested):

    sub ACTION_testmore { runtests( glob( 't/more/*.t' ) ); }; sub ACTION_install { my $self = shift; # ask your questions here $self->SUPER::ACTION_install( @_ ); };
Re: MakeMaker nsFAQs
by tachyon (Chancellor) on Aug 18, 2004 at 04:21 UTC

    AFAIK the targets in the makefile are set, however there are lots of workarounds. You could just have a prompt in the Makefile.PL and copy the extra test so they match the t/*.t glob that finds the tests. Alternatively just append a testmore target to the physical Makefile after MakeMaker has written it. This will just be the test target with a slight path modification.

    cheers

    tachyon

      Thanks tachyon, but I found a way:
      sub MY::postamble { return <<'MAKE_FRAG'; testmore :: pure_all PERL_DL_NONLAZY=1 $(FULLPERLRUN) "-MExtUtils::Command::MM" "-e" "t +est_harness($(TEST_VERBOSE), '$(INST_LIB)', '$(INST_ARCHLIB)')" t/mor +e/*.t MAKE_FRAG }
      Creating a MY::postamble that returns a string will append that string to the Makefile. So, by copying the syntax for the existing test target, but altering the directory, I am able to add a new testmore target to the Makefile.

      I'm still working on interaction before installing though. One Idea I've just had is to create a t/zzz_post_make_config.t that would prompt the user after testing. Of course I'd have to be careful about output so as not to trigger as a failed test.

      Cheers!
      Rick
      If this is a root node: Before responding, please ensure your clue bit is set.
      If this is a reply: This is a discussion group, not a helpdesk ... If the discussion happens to answer a question you've asked, that's incidental.
        I hope you realize that is not portable