Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^4: "symbol lookup error" message help

by Special_K (Monk)
on Feb 07, 2023 at 18:23 UTC ( [id://11150216]=note: print w/replies, xml ) Need Help??


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

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?

Replies are listed 'Best First'.
Re^5: "symbol lookup error" message help
by choroba (Cardinal) on Feb 07, 2023 at 19:45 UTC
    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]

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-20 07:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found