Hi, good choice of tools.

"Firstly, to run a Perl script with the correct libraries, I need to put “carton exec” on the front of each script invocation. If you don’t do that then the correct Perl binary runs, but it fails because it cannot find the modules that carton installed.

How can I arrange things so that just running perl from a shell will do the right thing? (Run Perl 5.10.0 with the carton installed modules available), Perhaps by tweaking PERL5LIB for bash shells, or putting a wrapper script into the path? (note that I don't need to worry about multi user accounts here, all users login as root!)"

You can avoid having to use carton exec by setting the included library path:

perl -Ilocal/lib/perl5 <cmd>
...or set PERL5lIB.

Note however that you can avoid using local/ at all and install the modules into the normal location if you use carton bundle to make an archive of the sources (after having installed them one time with carton install). This will be placed into vendor/cache but you can move it somewhere. Then install your dependencies at build time using cpanm --from file://path/to/the/cache.

I also recommend using perlbrew libs to keep your Perl version installation core-mdoules only. Then you can test installing dependencies multiple times without having to compile Perl over and over. I also use one perlbrew lib to build the cache, allowing carton to install in local/, and then after saving the cache as described above, I remove local/ and install to a fresh perlbrew lib for development, using the cache as described above.

Hope this helps!


The way forward always starts with a minimal test.

In reply to Re: How to run a legacy perl version smoothly from perlbrew & Carton by 1nickt
in thread How to run a legacy perl version smoothly from perlbrew & Carton by chrestomanci

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.