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
有帮助吗?

解决方案

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 => ... ,
    ...
);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top