Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Bundling Digest::MD5 with a distributed application?

by skazat (Chaplain)
on Mar 14, 2005 at 06:10 UTC ( [id://439177]=perlquestion: print w/replies, xml ) Need Help??

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

Hello All,

Intro.

Is there a "better" way to bundle the Digest::MD5 module with a distributed application? I want to make sure I'm bundling a tricky module like, Digest::MD5 correctly.

Background

I develop a very very popular CGI script. It comes with many CPAN modules. Let's say the cgi script itself is called, script.cgi. Along with the script.cgi file, there's a LIB directory. Inside the lib file are all the .pm files that are use'd/require'd by the script.cgi file.

In the lib directory, there's also a perllib directory, where I put modules fetched from CPAN in. I bundle the CPAN modules with the program, because I don't expect:

(1 that they will be installed by default and

(2 don't expect the user of my program (demographic: everyone from the casual website creator to professional JAPHY) to install each of the CPAN modules separately.

(3 I respect the Laziness of my users.

If that's hard to understand, here's a outline: (- = directories, + = files)

 
+script.cgi
    -LIB
        +IHandleErrorsForScript.pm
        +IHandleCGIScreensForScript.pm
        +ETC.pm
        +ETC.pm
        +ETC.pm
        -perllib
            +CGI.pm
            -HTML
                +Template.pm
            -MIME
                +Lite.pm
In the script.cgi file, the perllib directory is tweaked like so:
use lib qw(./LIB ./LIB/perllib
This means, my perllibs will be checked before the site_perl libs.

The Question

One the modules I need is Digest::MD5. This is a hard module to install, because it has both a pure perl version and a compiled version. I want to bundle the pure perl version, because I don't want my users to have to compile any modules I bundle in.

So, the question is, what's the best way to get a copy of the pure-perl version of Digest::MD5?

My current scheme

At the moment, I fetch all the modules needed by the script.cgi program by making a CPAN bundle, running cpan with "force install My::Bundle in a separate perllib directory on my local machine.

I then delete the directory that has to do with my architecture, example, "darwin-thread-multi-2level", copy all the modules that got downloaded from the bundle into the LIB/perllib directory of my script.cgi program and tar/gzip it up!

So, is this the best way to go about my business? Is there a better way to distribute perl modules that have both compiled and pure-perl versions?

Do you guys bundle CPAN modules into distributed programs in a different way?

 

-justin simoni
skazat me

Replies are listed 'Best First'.
Re: Bundling Digest::MD5 with a distributed application?
by Joost (Canon) on Mar 14, 2005 at 09:43 UTC
    Note that the pure-perl version of Digest::MD5 is a seperate distribution called Digest::Perl::MD5, which you can copy around like any other pure-perl module. Also CGI.pm has been a core module since at least perl 5.004.

    You should not remove the architecture dependend directory tree, unless there's really nothing in there.

    You could take a look at the PAR module, which can make a bundle automatically (though not always without problems).

      CGI.pm is something I do bundle in - if not for the reason that certain versions of the CGI.pm module have bugs in it - if I know which version I'm targeting, I know how it will act - any quirks, etc.

      Digest::Perl::MD5 seems to be exactly what I'm looking for - but it seems like its own docs are incorrect (in the synopsis at least) - it's namespace *is* Digest::Perl::MD5, and not Digest::MD5.

      Other bundled modules, like CGI::Session, HTML::Template::Expr(?) that need Digest::MD5 won't find Digest::Perl::MD5.

       

      -justin simoni
      skazat me

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (4)
As of 2024-04-25 13:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found