Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Spliting own program distribution intoi several modules.

by vsespb (Chaplain)
on Dec 27, 2012 at 08:35 UTC ( #1010468=perlquestion: print w/replies, xml ) Need Help??
vsespb has asked for the wisdom of the Perl Monks concerning the following question:

I want to distribute perl command line program (say in, which split into several modules. Some modules are really useful and I am going to publish it in CPAN (for example one of them is Net::MyModule). can come with installer (or have myscript.deb/myscript.rpm in it) which installs all modules into global location.

I am wondering how to deal with possible conflict of Net::MyModule from CPAN and Net::MyModule from ( myscript.deb ) ?

Obvious solution is 1) distribute without Net::MyModule 2) Publish Net::MyModule on CPAN 3) Ask/force users to install Net::MyModule from CPAN

But I don't want' to do that currently as works without external dependencies (except Core modules) with any perl version higher that 5.8.8. So I don't want bother non-Perl users to install something using CPAN ( I wan't easier deploy ). Another reason is that I might want to fix something it Net::MyModule and make it immediatelly available with new version of

What are options here?

  • Comment on Spliting own program distribution intoi several modules.

Replies are listed 'Best First'.
Re: Spliting own program distribution intoi several modules.
by tobyink (Abbot) on Dec 27, 2012 at 09:35 UTC

    Maybe take a look at App::FatPacker which allows you to inline all the modules used by into itself. This way always gets the exact versions of its required modules that are inlined within it, even if newer/older versions are available.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
      Yep, that looks like a solution..
Re: Spliting own program distribution intoi several modules.
by Corion (Pope) on Dec 27, 2012 at 08:46 UTC

    One way would be to add your private module path before the CPAN module path in @INC so that Perl will prefer local module installations over installations from CPAN:

    BEGIN { my $private_module_path = '/usr/local/myscript/lib'; unshift @INC, $private_module_path; }; use Net::MyModule; # will pick up the first Net/ that is fo +und in @INC

    An alternative approach would be to load both modules and then try to find out which one has the largert version number, but that is a hairy thing to try and a user who does local modifications might not think of bumping the version number high enough.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1010468]
Approved by davido
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2018-02-19 08:09 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (259 votes). Check out past polls.