Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How to include CPAN packages in distribution package

by johnnywang (Priest)
on Dec 03, 2007 at 19:38 UTC ( #654634=note: print w/ replies, xml ) Need Help??


in reply to How to include CPAN packages in distribution package

Wow, I'm just about to submit the same question when I see this post. Let me add a little detail to my version of the same question.

I'm trying to add a custom tool that needs a DBI/mysql combination, the perl installation doesn't have DBI/mysql. I'd like the user to be able to use my package (say via gunzip/tar) without installing any perl modules. What's the best way to package it?


Comment on Re: How to include CPAN packages in distribution package
Re^2: How to include CPAN packages in distribution package
by halley (Prior) on Dec 03, 2007 at 20:22 UTC
    If you intend to embed modules into your application, your application can use lib to find them in your own private library directory (a part of your application). After use lib, perl will see the updated value of @INC in its search for subsequent use statements.
    BEGIN { $INSTALLDIR = my_fun_to_find_my_own_install_dir() } use lib "$INSTALLDIR/privatelib"; use Acme::SuperModule qw(whatever);

    The upside is that you have some control over the versions that folks will use, and thus you can more easily guarantee proper execution. The downside to this approach is that the writer of that embedded module (e.g., Acme::SuperModule) might fix a critical bug, and your customers won't get the benefits until you ship them a new version.

    --
    [ e d @ h a l l e y . c c ]

Re^2: How to include CPAN packages in distribution package
by tsee (Curate) on Dec 03, 2007 at 20:52 UTC
Re^2: How to include CPAN packages in distribution package
by johnnywang (Priest) on Dec 03, 2007 at 21:34 UTC
    Thanks, I knew about "use lib" for my own lib paths, just never tried to have a CPAN module like DBI in my own path.

    I just did a manual make of DBI from source, all the files are in the usual blib directory, I'm thinking that if I put everything of blib (except the docs) as part of my distribution (keeping the same structure like: lib/auto, lib/Bundle, lib/DBD, etc.) it should all work. I guess I'll just go ahead and do that, and report back.

    Update Yes, it's as simple as that, I took the blib/lib directory, and moved it somewhere, and just do "use lib" to point there, all worked fine.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://654634]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2014-12-27 09:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls