Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
PerlMonks programming

by gwhite (Friar)
on Nov 22, 2009 at 05:38 UTC ( #808640=perlquestion: print w/replies, xml ) Need Help??

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

I am running Strawberry Perl 5.8.9, and I am creating a distribution of an application for a client behnd a firewall. The client is not at all familiar with Perl. I will send them a disc with Strawberry installation .msi, my application and I have created a minicpan that I will deliver on the disc, but I want to programmatically load some modules from the minicpan so the client doesn't have to mess with it. I can't find any documentation on how to change the repository in code, I know how to do it from the shell. Can someone point me in the right direction?


Replies are listed 'Best First'.
Re: programming
by CountZero (Bishop) on Nov 22, 2009 at 07:46 UTC
    For a custom install of CPAN, best to directly change the list of repositories in the configuration file. You can do that manually, or let the mkmyconfig function of take care of it.

    From the docs:

    Default values defined in the CPAN/ file can be overridden in a user specific file: CPAN/ Such a file is best placed in $HOME/.cpan/CPAN/, because $HOME/.cpan is added to the search path of the CPAN module before the use() or require() statements. The mkmyconfig command writes this file for you.


    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      Yep, and the specific configuration key within that file is urllist, e.g.:
      $CPAN::Config->{urllist} = [q[], q[http://cpa +n.elsewhere/]];
      They are checked in the order in which they appear, falling through to later entries if the connection fails or if a particular name can't be found.
Re: programming
by syphilis (Bishop) on Nov 22, 2009 at 07:23 UTC
    I know how to do it from the shell

    Just run those shell commands inside system() calls.

Re: programming
by JavaFan (Canon) on Nov 22, 2009 at 11:26 UTC
    Why not just put the modules you need in place? Shipping a minicpan and then installing it from said minicpan seems like the long way around.

      Perhaps because of license issues? For example, DBD::Oracle needs to be linked against Oracle client libraries, but most times, you do not have the permission to redistribute those libraries.


      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        So? You could still compile DBD::Oracle and distribute it.

      The nature of the application is that it will be updated pretty regularly with new features that may or may not require CPAN modules. By having a miniCPAN available I can use most any module and not have to worry about dependancies and such. I am sending the client a CD, might as well fill it with what I might need.

        But if you're going to update your application, you'll have to send your client something anyway - might as well then send the modules you need. You also may need a module, or a version of a module that wasn't present in the minicpan you deliver on CD.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://808640]
Approved by ww
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2019-11-13 12:14 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (72 votes). Check out past polls.