Domanda

I am cpan module which have prerequisite on other module. Is there any process to make sure the module can be installed only after the installation of the prerequisite module while manual installation of the module.

     perl MakeFile.pl
     make
     make test
     make install
È stato utile?

Soluzione

Yes. Use a standard build management module like ExtUtils::MakeMaker or Module::Build, which have conventions to handle prerequisites.

For ExtUtils::MakeMaker, the convention is to pass prerequisite information in the PREREQ_PM argument to the WriteMakefile function. Here's what it might look like:

use ExtUtils::MakeMaker;

WriteMakefile(
    NAME => 'My::Module',
    AUTHOR => 'Me',
    VERSION_FROM => 'lib/My/Module.pm',

    PREREQ_PM => {

        'Some::Module' => 0.42,       # need >=v0.42 of Some::Module
        'Some::Other::Module' => 0,   # but any version of Some::Other::Module is ok

    }
    dist => ... ,
    clean => ... ,
    ...
);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top