Beefy Boxes and Bandwidth Generously Provided by pair Networks Joe
XP is just a number
 
PerlMonks  

Packaging dependent modules with Perl script(s) for shared hosting environments

by silent11 (Vicar)
on Apr 27, 2006 at 15:14 UTC ( #546037=perlquestion: print w/ replies, xml ) Need Help??
silent11 has asked for the wisdom of the Perl Monks concerning the following question:

I want to be able to develop a perl (web) script containing both CPAN and personal modules on a development machine the upload the entire *package* to a shared hosting environment.

Often times I can't get various required modules built/installed on my host. (Generally using CPAN.pm or building from source in my own lib directory) Most things I try to build die for some reason or another. This is probably my real problem, however after tinkering with Ruby on Rails I came across a sweet little feature called 'rake freeze_gems'. What this does is 'freeze' your gems (modules) by copying them into a .vendor directory, thus allowing you to upload the entire working app to a shared host.

Is there a Perl equivalent? Something that will allow me to bundle all of a script's dependent modules into a new directory that I assume I'd have to push into @INC?

I've looked into PAR, but I have no experience with it. Also, I also assumed that this must be a common problem in shared hosting environments (or am I alone?) Is there a commonly accepted way to handle this problem?

Thanks!


-silent11
Spread Firefox

Comment on Packaging dependent modules with Perl script(s) for shared hosting environments
Re: Packaging dependent modules with Perl script(s) for shared hosting environments
by sgifford (Prior) on Apr 27, 2006 at 15:26 UTC
    par can do what you want; just follow the documentation to get one big executable containing your script and all of the modules it uses. Keep in mind that if any of the modules aren't pure-perl, you'll have to build them on a platform identical to the one at your hosting environment.

    I usually deal with modules in hosting environments by creating a ~/cgi-lib/perl5 directory to upload my modules into, then putting use lib '/path/to/home/cgi-lib/perl5' near the top of my script. I'm not sure what problems you keep running into with building them; see Re: Re: Alternatives to User::Agent? for a useful technique.

Re: Packaging dependent modules with Perl script(s) for shared hosting environments
by jplindstrom (Monsignor) on Apr 27, 2006 at 15:59 UTC
    PAR should work, but you may not be able (or find it suitable) to execute the PAR binary. In that case you could use PAR to collect all the stuff for you.

    Use the pp --save option of to skip deleting the working directory. There you'll find all the modules your app needs.

    /J

Re: Packaging dependent modules with Perl script(s) for shared hosting environments
by perrin (Chancellor) on Apr 27, 2006 at 17:17 UTC
    There's an interesting take on this in the Krang CMS. It bundles the modules as source and installs them in a local directory using a build script.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-04-18 09:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (464 votes), past polls