Alberto Simões wrote:
Adriano Ferreira wrote:
On Tue, Mar 18, 2008 at 12:37 PM, Alberto Simões
<[EMAIL PROTECTED]> wrote:
Hi

 I need to use a non-core, non-standard module on a Makefile.PL.

  - I would like to abort Makefile.PL run if it is not installed;
  - I would like it to be installed if being run inside CPAN;

 Hints?

Very recent versions of CPAN has support for 'configure_requires',
which looks like the right way to do that.

Hmms... that might be a solution when installing the module through CPAN. But if the user runs Makefile.PL manually she will get a Can't locate module message.

Not yet the thing I would love.

The "Can't locate module" message would seem to indicate exactly what's wrong and clearly suggests what needs to be done to fix it. If they're installing by hand they're used to resolving dependencies by hand anyway.

If it's not a good enough message, make a better one. Makefile.PL is just a program. Unlike require dependencies, it's ok to die if you're missing configuration dependencies because your Makefile.PL would have done that anyway.

        my @missing_deps;
        for my $module (@configure_dependencies) {
                unless( eval qq{require $module} ) {
                        push @missing_deps, $module
                }
        }

        die "Makefile.PL requires @{[ join ',', @missing_deps ]}.\n"
                if @missing_deps;


--
54. “Napalm sticks to kids” is *not* a motivational phrase.
    -- The 213 Things Skippy Is No Longer Allowed To Do In The U.S. Army
           http://skippyslist.com/list/

Reply via email to