Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

CPAN.pm programming

by gwhite (Friar)
on Nov 22, 2009 at 05:38 UTC ( [id://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?

g_White

Replies are listed 'Best First'.
Re: CPAN.pm 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 CPAN.pm take care of it.

    From the docs:

    Default values defined in the CPAN/Config.pm file can be overridden in a user specific file: CPAN/MyConfig.pm. Such a file is best placed in $HOME/.cpan/CPAN/MyConfig.pm, 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.

    CountZero

    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[ftp://some.site.com/cpan/], 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: CPAN.pm programming
by syphilis (Archbishop) 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.

    Cheers,
    Rob
Re: CPAN.pm 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.

      Alexander

      --
      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.

      g_White
        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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (2)
As of 2024-04-25 22:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found