install the prerequisite module automatically

install the prerequisite module automatically

am 05.08.2011 03:12:28 von Feng He

Hi,

I have wrote a module and released it with module-starter.
(http://search.cpan.org/~xsawyerx/Module-Starter-1.58/lib/Mo dule/Starter.pm)

When I install it from the CPAN shell, how can I make the shell
install the prerequisite modules automatically?

for example, my module:

package ABC;
use MIME::Lite;

....
1;


When I install ABC from CPAN shell, I want to make it install
MIME::Lite automatically.

Thanks.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: install the prerequisite module automatically

am 05.08.2011 10:36:05 von dermot

On 5 August 2011 02:12, Feng He wrote:
> Hi,
>
> I have wrote a module and released it with module-starter.
> (http://search.cpan.org/~xsawyerx/Module-Starter-1.58/lib/Mo dule/Starter.pm)
>
> When I install it from the CPAN shell, how can I make the shell
> install the prerequisite modules automatically?
>
> for example, my module:
>
> package ABC;
> use MIME::Lite;
>
> ...
> 1;

If the Makefile.PL for you module has "requires MIME::Lite" in then
the end user will get a warning about the lack of a dependency. You
can not force the required modules to install on an end user's
machine. That will be down to how the end user configured their CPAN.
Their cpan config will have a line for 'prerequisites_policy'.
Possible values include ask or follow. If it follow, then the
prerequisites are downloaded and installed. Otherwise it will ask the
user if they want to install the required modules.

HTH,
Dp.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: install the prerequisite module automatically

am 05.08.2011 11:28:50 von Feng He

On Fri, Aug 5, 2011 at 4:36 PM, Dermot wrote:

> If the Makefile.PL for you module has "requires MIME::Lite" in then
> the end user will get a warning about the lack of a dependency. You
> can not force the required modules to install on an end user's
> machine. That will be down to how the end user configured their CPAN.
> Their cpan config will have a line for 'prerequisites_policy'.
> Possible values include ask or follow. If it follow, then the
> prerequisites are downloaded and installed. Otherwise it will ask the
> user if they want to install the required modules.
>


Thanks.
Do you mean this section in Makefile.PL?

PREREQ_PM => {
'Test::More' => 0,
},

Regards.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/

Re: install the prerequisite module automatically

am 05.08.2011 12:03:33 von dermot

On 5 August 2011 10:28, Feng He wrote:
> On Fri, Aug 5, 2011 at 4:36 PM, Dermot wrote:

> Thanks.
> Do you mean this section in Makefile.PL?
>
> =A0 =A0PREREQ_PM =3D> {
> =A0 =A0 =A0 =A0'Test::More' =3D> 0,
> =A0 =A0},
>
> Regards.

Yes. That's the form you will see if you use module-starter. You may
also come across this form

requires 'SomeMod::Foo' =3D> [an optional version number];

hth,
Dp.

--
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/