Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: "symbol lookup error" message help

by choroba (Cardinal)
on Jan 24, 2023 at 16:40 UTC ( [id://11149838]=note: print w/replies, xml ) Need Help??


in reply to Re^2: "symbol lookup error" message help
in thread "symbol lookup error" message help

Don't care about xsubpp. When you upgrade Perl, simply reinstall all the modules for the new version.

Alternatively, use PerlBrew to keep several Perl versions. Each version needs its own set of modules (again, in fact, only XS modules need to be different, but if you don't know which these are, just install all of them for each version).

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^4: "symbol lookup error" message help
by Special_K (Monk) on Feb 07, 2023 at 18:23 UTC

    Let's say I have a script that starts as follows:



    #!/usr/bin/perl use strict; use warnings; use lib '/home/foo/perl_modules/5.32.1/lib/perl5' use List::MoreUtils qw(uniq);


    Assume on one machine /usr/bin/perl points to perl version 5.32.1. Also assume the List::MoreUtils module is installed in /home/foo/perl_modules/5.32.1/lib/perl5 using perl 5.32.1.

    Now assume on another machine /usr/bin/perl points to perl 5.26.3. Also assume the List::MoreUtils module is installed in /home/foo/perl_modules/5.26.3/lib/perl5 using perl 5.26.3.

    Is there a way to manage this such that the script can be run on both machines, each with their respective perl versions, without having to make 2 copies of the script, one for each module path?

      If there's only one perl installed on each machine, it makes no sense to include its version into the path. Install the modules into the same path on both the machines and you can use the same script.

      If you insist on having the Perl version included in the path and not having Perl configured to search for modules there, you can use something like

      use lib '/home/foo/perl_modules/' . substr($^V, 1) . '/lib/perl5';

      But why?

      map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
Re^4: "symbol lookup error" message help
by Special_K (Monk) on Jan 31, 2023 at 22:20 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

Log In?
Username:
Password:

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

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

    No recent polls found