Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Truly Isolated Perl

by mikkoi (Beadle)
on Sep 19, 2018 at 10:57 UTC ( #1222635=perlquestion: print w/replies, xml ) Need Help??

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

For using on a website, I need to create a completely isolated Perl. Not just local::lib isolated module space. My first thought was using plenv install but it installs new Perl executable only under ${PLENV_ROOT}. What I need is to install to ~/public_html (or similar), e.g. ~/public_html/prog/env/bin/perl. And this new Perl executable would use ~/public_html/prog/env/lib as its @INC, and only that!

The web server is running in a different server and for security reasons home directories are not mounted. Whereas the web page directories are mounted to the system in which I use shell. Besides this, the web server is running a seriously limited OS and could be updated not in sync with the other system, including Perl versions. So I need to have everything the software needs in the disk with the web page.</p:

Currently this is not possible with plenv install. But could we make it so? Or is there an existing easy way? Instead of actually manually configuring and building Perl.

Replies are listed 'Best First'.
Re: Truly Isolated Perl
by wjw (Priest) on Sep 19, 2018 at 12:24 UTC

    It seems to me that perlbrew might meet your needs. If I understand your requirement, the following link should give you an idea of how to go about this.

    Managing Perl environments with perlbrew

    My understanding is that each version of Perl installed is isolated. And locating it can be accomplished by:

    If you need to install perlbrew somewhere other than your home directory, just download the installer and pass it the PERLBREW_ROOT environment variable.

    ...the majority is always wrong, and always the last to know about it...

    A solution is nothing more than a clearly stated problem...

Re: Truly Isolated Perl
by bliako (Monsignor) on Sep 19, 2018 at 12:34 UTC

    never used it but Perl::Build may be what you are looking for. Specifically:

    Perl::Build->install_from_cpan($version, %args)
    
    Install $version perl from CPAN. This method fetches tar ball from CPAN, build, and install it.
    
    You can pass following options in %args.
    
        dst_path
    
        Destination directory to install perl.
    
    

    Now, I suspect it may be one thing to handle many perls on the command-line, for a user, via plenv or perlbrew and a different thing to tell your webserver which perl to use etc.

Re: Truly Isolated Perl
by Haarg (Curate) on Sep 19, 2018 at 12:40 UTC

    I would recommend using perl-build, which provides an easy way to install perl in an arbitrary directory.

Re: Truly Isolated Perl
by mr_mischief (Monsignor) on Sep 19, 2018 at 19:30 UTC

    There are ways to lock down subdirectories from being served by a web server. Even so, putting the executable for a general-purpose programming language within your document root seems like a terrible idea. Since you're not talking about a PSGI server as part of this scenario and talking about needing to put things in a particular directory, it seems you're likely using CGI.

    Imagine you have CGI enabled within your web root. Now imagine for some reason the subdirectory containing perl within that web root becomes web accessible. The HTTP verb POST sends the request body from the client to the web server, which then runs the executable mapped at the requested URI. The request body is then passed in its entirety to that executable's STDIN. Eve fuzzes and futzes and finds your perl executable. She then POSTs arbitrary code, which then runs. Suddenly your system is a command and control system for a botnet or something even worse.

Re: Truly Isolated Perl
by mikkoi (Beadle) on Sep 19, 2018 at 13:05 UTC

    I believe perl-build might be the right answer. It is already integrated in plenv and a plugin but only with plenv install.

    I should have described my environment better. The web server is running in a different server and for security reasons home directories are not mounted. Whereas the web page directories are mounted to the system in which I use shell. Besides this, the web server is running a seriously limited OS and could be updated not in sync with the other system, including Perl versions. So I need to have everything the software needs in the disk with the web page.

      Perhaps update the OP with your refined requirements so that those who don't read all the way down to this post first will not waste effort pursuing snipe. Please see How do I change/delete my post?


      Give a man a fish:  <%-{-{-{-<

Re: Truly Isolated Perl
by ikegami (Pope) on Sep 21, 2018 at 16:29 UTC

    Installing Perl is as east as following these steps:

    wget https://cpan.metacpan.org/authors/id/X/XS/XSAWYERX/perl-5.28.0.ta +r.gz tar xvzf perl-5.28.0.tar.gz cd perl-5.28.0 sh Configure -des -Dusethreads -Dprefix="$HOME/public_html/prog" make make test make install

    The instructions on how to install Perl are found in the file named INSTALL. (e.g. [https://metacpan.org/source/XSAWYERX/perl-5.28.0/INSTALL|5.28.0's

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2021-11-27 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?