Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: "symbol lookup error" message help

by ikegami (Patriarch)
on Jan 20, 2023 at 22:10 UTC ( [id://11149734]=note: print w/replies, xml ) Need Help??


in reply to "symbol lookup error" message help

How do I specify which version of perl is being used when I install a module using cpanm?

You should have two cpanm, one installed with each perl. They will have different shebang (#!) lines.

It's simply a question of using the right cpanm (e.g. by using its full path to launch it).

head -n 1 /tool/bin/cpanm # #!/tool/bin/perl /tool/bin/cpanm Some::Module # Installs for /tool/bin/perl

The cpanm script itself should work with any perl, so you could explicitly specify the perl to use as a fallback.

/tool/bin/perl "$( which cpanm )" Some::Module

Why do the new modules I installed to /new_location/perl_modules/5.20/lib/perl5 work for both /tool/bin/perl (v5.20.0) and /usr/bin/perl (v5.26.3)

There's no guarantee that using different build will fail.

There's merely no effort made to ensure that it won't fail.

Replies are listed 'Best First'.
Re^2: "symbol lookup error" message help
by Special_K (Monk) on Jan 28, 2023 at 17:49 UTC
    Given a directory where perl modules are already installed (ex: /home/user_foo/perl_modules/lib/perl5 from my original message), how do I determine what version of perl was used to install them?
      Use Module::Metadata (core) to examine the path:
      /usr/bin/perl -MModule::Metadata -le 'print Module::Metadata->find_mod +ule_by_name("Class::Struct")'
      /System/Library/Perl/5.18/Class/Struct.pm

        That gives me the path to a module I specify by name, but that's not what I'm asking.

        I'm asking: given a directory where 1 or more perl modules are installed (ex: /home/user_foo/perl_modules/lib/perl5 from my original message), is there a way to determine what version of perl (e.g. 5.12.2, 5.16.3, etc.) was used to install those modules?

Re^2: "symbol lookup error" message help
by Special_K (Monk) on Feb 03, 2023 at 21:14 UTC
    > There's no guarantee that using different build will fail.

    > There's merely no effort made to ensure that it won't fail.

    So is the best practice to just have a complete modules directory corresponding to each version of installed perl, no matter how minor the version update? For example, if I have the following (hypothetical) versions installed:

    5.26.1 5.26.2 5.26.3 5.26.4

    Then each one of those should have its own complete modules directory?

      Perl actually guarantees that you can upgrade between minor versions without needing to recompile. But that implies that the new minor version was compiled with exactly the same compiler and compiler options as the old one.

Re^2: "symbol lookup error" message help
by Special_K (Monk) on Feb 03, 2023 at 21:52 UTC

    Here's what I don't understand:
    I ran the following:


    > which cpanm /bin/cpanm > head -n 1 /bin/cpanm #!/usr/bin/perl

    I know that /usr/bin/perl on this machine is 5.26.3, yet if I look at the most recent cpanm build.log file, it says:

    cpanm (App::cpanminus) 1.7044 on perl 5.026003 built for x86_64-linux- +thread-multi

    Why does the log file list perl version 5.026003 when /usr/bin/perl is 5.26.3?

      Because $], the variable containing the Perl version number has the value 5.026003. See the documentation in perlvar.

      5.026003 is 5.26.3.

      5.026003 |_||_| 26 3
      See "perldoc version" (version on the CPAN).

      perl -le 'print $]'
      5.026003
      perl -le 'print $^V'
      v5.26.3
      perl -Mversion -le 'print version->parse("5.026003")->normal'
      v5.26.3
      perl -Mversion -le 'print version->declare("v5.26.3")->numify'
      5.026003

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-19 06:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found