GithubHelp home page GithubHelp logo

Comments (4)

lestrrat avatar lestrrat commented on September 25, 2024

I can't speak for others, but I don't think using plenv for such purposes is a good thing to do.

I use plenv for personal perl copies -- i.e. my Mac that I use everyday, I use plenv so I can switch around versions when necessary.

But for deployed apps, I never use plenv. Instead I use something like xbuild or Perl::Build and stick to that version until I manually decide to upgrade.

from plenv.

Lx avatar Lx commented on September 25, 2024

I'm interested in this discussion because I had a vaguely similar use case in mind.

I was hoping to run a Plack-served app through a plenv-provided Perl as a regular (but purpose-made) user on a Debian system, started by a Daemon::Control-prepared init script at system boot.

Everything works fine when run from that user's shell, because obviously the environment provides the means to pick out the right Perl.

At the init level though, the system Perl is run and none of the dependencies are available, so nothing starts.

There doesn't seem to be an easy fix to this. Is the only solution to prepare a Perl exclusively for that web app (probably using Perl::Build) and then hard-code all of the web app's scripts to use that Perl (which would have the effect of tightly coupling the two)?

Thanks in advance for any pointers.

from plenv.

lestrrat avatar lestrrat commented on September 25, 2024

In real life we often have a wrapper script that wraps any command we execute:

./scripts/env.sh ./scripts/foo.pl

and in that script we do something similar to

export PATH="/path/to/perl-that-we-should-use-for-this-project:$PATH"
export PERL5LIB="/path/to/project/local/lib/perl5:/path/to/project/lib"
...
exec "$@"

Then your shebangs just need to be

#!/usr/bin/env perl

or something similar

from plenv.

Lx avatar Lx commented on September 25, 2024

That sounds like exactly what I need in my case: make the code "Perl-agnostic" (for lack of a better term), and make whoever runs it responsible for making the environment point to the right Perl. No plenv required, and everything is nicely decoupled. Thanks very much for your insight.

from plenv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.