Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Detecting a module to be used by Makefile.PL

0 views
Skip to first unread message

al...@alfarrabio.di.uminho.pt

unread,
Mar 18, 2008, 11:37:18 AM3/18/08
to MakeMaker
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?

Thanks
ambs
--
Alberto Simões - Departamento de Informática - Universidade do Minho
Campus de Gualtar - 4710-057 Braga - Portugal

al...@alfarrabio.di.uminho.pt

unread,
Mar 18, 2008, 12:52:15 PM3/18/08
to Adriano Ferreira, MakeMaker

Adriano Ferreira wrote:


> On Tue, Mar 18, 2008 at 12:37 PM, Alberto Simões
> <al...@alfarrabio.di.uminho.pt> 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.

Thanks ;)
ambs

Adriano Ferreira

unread,
Mar 18, 2008, 12:40:24 PM3/18/08
to al...@alfarrabio.di.uminho.pt, MakeMaker
On Tue, Mar 18, 2008 at 12:37 PM, Alberto Simões
<al...@alfarrabio.di.uminho.pt> 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.

>

Michael G Schwern

unread,
Mar 18, 2008, 2:58:19 PM3/18/08
to al...@alfarrabio.di.uminho.pt, Adriano Ferreira, MakeMaker
Alberto Simões wrote:
> Adriano Ferreira wrote:
>> On Tue, Mar 18, 2008 at 12:37 PM, Alberto Simões
>> <al...@alfarrabio.di.uminho.pt> 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/

0 new messages