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

Hi,
The PDL Makefile.PL contains the following annoying stuff:
# Check for pre-existing PDL module in @INC eval { require PDL::Lite; PDL::Lite->import(); }; unless($@) { # uh-oh! we have a pre-existing PDL in path warn( "\n ****** WARNING ******\n" . " PDL version $PDL::Version::VERSION was detected in your \ +@INC\n" . " PDL may not build/test correctly with another PDL in \@IN +C!\n" ); my $go_on = prompt("\nDo you still wish to continue?", 'y'); die "OK, stopping build\n" unless $go_on =~ /^[yY]/; }
For me, there's always a "pre-existing PDL" to be found.
How do I configure CPAN.pm to accept the /^[yY]/ prompt ?

Can "acceptance of prompts" be configured for certain modules only ? Or is it a "come one, come all" situation ?

Pointers to the relevant documentation (which, I'm sure, exists) gratefully accepted :-)

Cheers,
Rob

Replies are listed 'Best First'.
Re: Getting CPAN.pm to accept Makefile.PL prompts
by moritz (Cardinal) on Nov 10, 2010 at 08:09 UTC
    You can try setting the PERL_MM_USE_DEFAULT environment to a true value. It helps with some prompts in Makefile.PL scripts, I'm not sure it helps with yours.
    Perl 6 - links to (nearly) everything that is Perl 6.
      PERL_MM_USE_DEFAULT

      Yep - that does the trick - and I've even (now) found the documentation for it ;-)

      Thanks moritz

      Cheers,
      Rob
Re: Getting CPAN.pm to accept Makefile.PL prompts
by Tux (Canon) on Nov 10, 2010 at 08:36 UTC

    Or use the underdocumented distroprefs support from cpan ...

    $ mkdir -p ~/.cpan/prefs $ cat >~/.cpan/prefs/PDL.yml --- match: distribution: "CHM/PDL-" pl: eexpect: mode: anyorder timeout: 15 reuse: 1 talk: - "Do you still wish to continue" - "y\n" <Ctrl-D> $ cpan Expect YAML $ cpan PDL

    And see if that works for you


    Enjoy, Have FUN! H.Merijn
      $ cpan Expect YAML

      I neglected to mention that I'm on MS Windows (apologies for that) ... and the success of that command relies on the Expect module ... which won't install on MS Windows.

      I gave it a go, anyway. My CPAN/Config.pm decrees that:
      'cpan_home' => q[C:/.cpan],
      so I created the following 'PDL.yml' in the C:/.cpan/prefs directory:
      --- match: distribution: "CHM/PDL-" pl: eexpect: mode: anyorder timeout: 15 reuse: 1 talk: - "Do you still wish to continue" - "y\n"
      (I didn't exactly pay attention to the whitespace you specified, but I doubt that's having any bearing.)

      Sure enough, running cpan Expect YAML fails to install Expect, and cpan get CHM/PDL-2.4.7_004.tar.gz still hangs at the "annoying" prompt.

      Please correct me if I'm wrong, but I gather this approach won't work on MS Windows.

      Cheers,
      Rob

        If Expect doesn't install, this indeed won't work at all.

        The falies are in YAML format, which implies that whitespce is extremely important, and the file you show will most likely cause an error message from cpan, saying it is badly formatted and will be ignored.

        I never tried to use distroprefs on Windows. In fact I try to avoid Windows as much as possible.

        Do you use Strawberry or ActivePerl?


        Enjoy, Have FUN! H.Merijn
Re: Getting CPAN.pm to accept Makefile.PL prompts
by kcott (Archbishop) on Nov 10, 2010 at 08:59 UTC

    There's PDL configuration files: perldl.conf discussed in INSTALL and .perldl.conf discussed in FAQ - INSTALLATION that may be of help.

    The latter has "Multiple PDL installs in the same PATH or @INC can cause puzzling test or build failures." which rather suggests this is a known issue.

    -- Ken

      Yes, it's a known issue for some cases ... but not for me.

      I think it affects some nix-type systems, but it hasn't yet posed any problems for me on MS Windows (which is nice .... for a change :-)

      Cheers,
      Rob