Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

"Installed" Perl 5.34 , sort of

by misterperl (Pilgrim)
on May 05, 2022 at 15:26 UTC ( #11143594=perlquestion: print w/replies, xml ) Need Help??

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

I hope its OK to ask Perl install questions here? If not, my apologies be gentle!

I ran these steps from the CPAN README on install from source:

How to install from source wget https://www.cpan.org/src/5.0/perl-5.34.1.tar.gz tar -xzf perl-5.34.1.tar.gz cd perl-5.34.1 ./Configure -des -Dprefix=$HOME/localperl make make test make install
I did all of those steps, and it created 3 dirs under ~root/local: bin, lib, and man , comprising the 5.34 build.

But there the instructions stop. I think there must be another step where either I symlink whatever I find in "which perl" to this dir (probably not , since I don't think everyone should run Perl out of ~root), or I backup and copy over certain files in certain directories.

Can someone please add a "tail" to this guide with the way to make 5.34 the system-wide default for "which perl" ? I've installed Perl years ago, and I thought the "install" step did that for me?

TYVM!

Replies are listed 'Best First'.
Re: "Installed" Perl 5.34 , sort of
by choroba (Archbishop) on May 05, 2022 at 15:32 UTC
    To install for everyone, rerun the steps again, but setting prefix to /opt/perl or similar. You only need root for the last step (make install).

    Now just prepend the /opt/perl/.../bin paths to everyone's $PATH and you're done. You probably don't want to replace the original perl for the system user, as they might depend on the installed modules and version sensitive behaviour in the system tools.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      Ahhh ok - your reply makes sense , Appreciated
Re: "Installed" Perl 5.34 , sort of
by kcott (Archbishop) on May 06, 2022 at 01:07 UTC

    G'day misterperl,

    You may find it's easier to use Perlbrew.

    This won't mess with the system Perl. (See ++choroba's comments re that.)

    $ /usr/bin/perl -v This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-cy +gwin-threads-multi (with 6 registered patches, see perl -V for more detail) ...

    You can have multiple versions of Perl installed.

    $ perlbrew list * perl-5.34.0 perl-5.33.5 perl-5.32.0 perl-5.30.0

    You can very easily switch between the different Perl versions you have installed.

    $ which perl /home/ken/perl5/perlbrew/perls/perl-5.34.0/bin/perl $ perlbrew switch perl-5.32.0 $ which perl /home/ken/perl5/perlbrew/perls/perl-5.32.0/bin/perl $ perlbrew switch perl-5.34.0 $ which perl /home/ken/perl5/perlbrew/perls/perl-5.34.0/bin/perl

    If you start your scripts with the shebang

    #!/usr/bin/env perl

    they will run using the current (`which perl`) version. This can be very useful when troubleshooting why a script worked successfully under one Perl version but not another: just run the script; switch version; run the script again.

    Installation of Perlbrew is straightforward; as is the installation of Perl versions. There's no need to go through the laborious effort of installing Perl by hand; there's no need to fiddle with $PATH; there's no need to change shebang lines.

    I've used Perlbrew on many different platforms for many years (1 to 2 decades) and can highly recommend it. Many other monks also use Perlbrew so, if you run into difficulties, there's plenty of help available.

    — Ken

      just run the script; switch version; run the script again.

      First of all, you should be using use (changes that shell only), not switch (changes all subsequently-created shells).

      But you don't even need to use use.

      "$PERLBREW_ROOT"/perls/5.34t/bin/perl ... "$PERLBREW_ROOT"/perls/5.32t/bin/perl ... "$PERLBREW_ROOT"/perls/5.30t/bin/perl ...

      Update: Clarified which shells switch affects.

        "... you should be using use (changes that shell only), ..."

        use is an option; not a requirement. Fix with: s/should be using/can also use/ (or similar).

        "... not switch (changes all shells)."

        That's incorrect. Fix with: s/changes all shells/changes subsequent shells/ (or similar). Below, I show starting two shells both using 5.34 — I change to 5.32 in the second shell; the first shell remains at 5.34; after that I start a third shell which uses 5.32.

        $ # Shell A $ perlbrew list * perl-5.34.0 perl-5.33.5 perl-5.32.0 perl-5.30.0 $ # perlbrew switch in Shell B $ perlbrew list * perl-5.34.0 perl-5.33.5 perl-5.32.0 perl-5.30.0
        $ # Shell B $ perlbrew list * perl-5.34.0 perl-5.33.5 perl-5.32.0 perl-5.30.0 $ perlbrew switch perl-5.32.0 $ perlbrew list perl-5.34.0 perl-5.33.5 * perl-5.32.0 perl-5.30.0
        $ # Shell C $ perlbrew list perl-5.34.0 perl-5.33.5 * perl-5.32.0 perl-5.30.0

        — Ken

      TYVM, I looked at this also. First I unset PERL* env VARS, and I CD'ed to /opt/local. I removed ALL perl copies with yum.

      My @INC looks a lot better (no more /root...), BUT, I have some strange double-/ such as: /opt/local/perl5//lib/site_perl/5/34/1

      Seems like its very difficult to get a clean @INC !

      TY

        I don't have // in any of my @INC paths:

        $ perl -E 'say for @INC' /home/ken/perl5/perlbrew/perls/perl-5.34.0/lib/site_perl/5.34.0/cygwin +-thread-multi /home/ken/perl5/perlbrew/perls/perl-5.34.0/lib/site_perl/5.34.0 /home/ken/perl5/perlbrew/perls/perl-5.34.0/lib/5.34.0/cygwin-thread-mu +lti /home/ken/perl5/perlbrew/perls/perl-5.34.0/lib/5.34.0

        I suspect you may have done something in your installation which caused this; however, without knowing the steps you took, I don't know what that might have been. Do note the differences between your /opt/local/perl5//lib/site_perl/5/34/1 and my /home/ken/perl5/perlbrew/perls/perl-5.34.0/lib/site_perl/5.34.0:

        • At the start: you have /opt/local; I have /home/ken.
        • In the middle: you have //; I have /perlbrew/perls/perl-5.34.0/.
        • At the end: you have /5/34/1; I have /5.34.0.

        There are potentially a number of things you may need to change.

        Having // in a path is not a problem in itself: x/y and x//y are effectively the same.

        $ ls -al x/y ls: cannot access 'x/y': No such file or directory $ mkdir -p x/y $ cd x//y $ pwd /home/ken/tmp/x/y $ cd ../.. $ pwd /home/ken/tmp $ cd x/y $ pwd /home/ken/tmp/x/y $ cd ../.. $ pwd /home/ken/tmp

        — Ken

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-09-25 04:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (116 votes). Check out past polls.

    Notices?