Coder Social home page Coder Social logo

Comments (4)

mrmuskrat avatar mrmuskrat commented on June 15, 2024

I looked at this issue intently for a few days. The only way that I found to fix it is nothing more than a workaround; fire off perlbrew and replace the shell with exec so that the environment changes are preserved.

from app-perlbrew.

gugod avatar gugod commented on June 15, 2024

It does not seem to be possible to preserve $PATH without an exec bash after your bash script finished.

perlbrew switch should update your $HOME/.perlbrew/init file with new values. A newly invoked shell should be able to read those values again.

Basically, a source $HOME/.perlbrew/init right after your bash script finished should be sufficient. But you'll need to do it outside of your bash script.

from app-perlbrew.

gugod avatar gugod commented on June 15, 2024

@mrmuskrat, correct me if I'm understanding it wrong, are you trying to run "perlbrew use perl-5.12.2" inside your bash script ? If so, you will need to source the provided bashrc first.

If you did that and the problem remains, I suggest you to upgrade to at lease version 0.22, which, I believe, is a much robust version in terms of bash integration.

Let me know if upgrading works, or let's discuss your use case and maybe craete a Howto document for it :)

from app-perlbrew.

gugod avatar gugod commented on June 15, 2024

Just a quick not here. In the next release, to be above to perform perlbrew function in a shell script, 3 lines should be included in advance in the script:

export PERLBREW_ROOT=/opt/perlbrew
export PERLBREW_HOME=/tmp/.perlbrew
. ${PERLBREW_ROOT}/etc/bashrc

After that, perlbrew use and perlbrew switch can correctly alter $PATH in the shell script. This should also make it friendlier to be invoked from crontab.

However I still have no idea how to implement a csh counter-part. Leaving that as an exercise :)

I will write an brief article about this improvement in the next release note, therefore I am closing this issue now.

from app-perlbrew.

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.