Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

How to install a DarkPAN module?

by Anonymous Monk
on Jan 28, 2009 at 12:33 UTC ( [id://739525]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a CPAN ready module, packaged according and conforming to the modern practices. That is to say, it declares its required and optional dependencies in META.yml, and the build system is M::B (but I could change that, if necessary).

I do not want to publish it on CPAN. However, I wish to give the tarball to other people to install. I wish them to have a pleasant installation experience, i.e. not need to hunt down dependencies manually. If possible, I do not wish to deviate from established ways and instead leverage the standard tools we are familiar with, as the end user assumably might be familiar with them, too.

Unfortunately, this does not work:

$ cpan My-Module-0.01.tar.gz
Going to read $HOME/.cpan/Metadata
Warning: Cannot install My-Module-0.01.tar.gz, don't know what it is.
Try the command

    i /My-Module-0.01.tar.gz/

to find objects with matching identifiers.


Neither does this:

$ cpanp -i My-Module-0.01.tar.gz
[MSG] No '$HOME/.cpanplus/custom-sources' dir, skipping custom sources
[ERROR] 'My-Module-0.01.tar.gz' does not contain an author part

[ERROR] Cannot find 'My-Module-0.01.tar.gz' in the module tree

No such module: My-Module-0.01.tar.gz
No modules found to operate on!
Nothing done


The CPAN(PLUS) tools are much more stupid than I thought they are.

All dependencies are available on CPAN. I think I can get away with requiring that the end user has 5.010, but if your proposal works under 5.8.8, that would be Fine Too.

This works, but is not very pleasant. Do you have an idea how to condense it?

$ cpan Dependency::Foo Dependency::Bar
$ tar -xvzf My-Module-0.01.tar.gz
$ cd My-Module-0.01/
$ perl Build.PL
$ ./Build
$ ./Build test
$ sudo ./Build install

Replies are listed 'Best First'.
Re: How to install a DarkPAN module?
by Corion (Patriarch) on Jan 28, 2009 at 13:26 UTC

    For the CPAN program, cpan, the magic is cpan . where you've unpacked the tarball, see Integrating Local Directories. The unpack step is not included. It would be nice to point cpan at a directory full of tarballs and it would go and unpack+install all of them, and I guess a patch to implement that would be welcome.

      I like that solution very much, thanks a million for it. Just two commands and no configuration required.

      According to the CPAN Changes file, the feature is available with 1.88_55, and 5.8.8 ships with only 1.76_02, so I guess I have to either require perl 5.010 or have the end user upgrade CPAN first.

      Or you could run a local CPAN mirror with your packages added to it, using CPAN::Mini and CPAN::Mini::Inject. This is what we do at work, as it makes things so much easier for people to use exactly the same interface as they're already used to for installing modules.
Re: How to install a DarkPAN module?
by grinder (Bishop) on Jan 28, 2009 at 13:21 UTC

    See the bit:

    [MSG] No '$HOME/.cpanplus/custom-sources' dir, skipping custom sources

    That's a clue! You probably want to read CPANPLUS and custom_sources, which will explain things far better than I ever could. Executive summary: you place your tarball in a directory or on the web somewhere, and then tell CPANPLUS where it is.

    • another intruder with the mooring in the heart of the Perl

      Good suggestion, thanks. I'm going with Corion's answer, as I can rely on CPAN more than CPANPLUS.

      Just to expand slightly on this, CPANPLUS will also accept file:// type URLs as well.

      cpanp -i file://./My-Module-0.01.tar.gz
Re: How to install a DarkPAN module?
by xdg (Monsignor) on Jan 28, 2009 at 19:36 UTC

    There's also pip.

    $ pip My-Module-0.01.tar.gz

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://739525]
Approved by ww
Front-paged by tye
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2024-04-23 20:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found