Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Can't locate Unicode/Map.pm but it's installed and I THINK in @INC

by cristj1 (Novice)
on Jun 14, 2017 at 16:41 UTC ( [id://1192810]=perlquestion: print w/replies, xml ) Need Help??

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

TIA for any help. I'm new to this site and need help after trying lots of online resolutions. My perl script is getting "Can't locate Unicode/Map.pm" when I run as user XXX but runs OK when run as root.

Here's the pertinent part of the script:
[XXX@n12 p1]$ cat -n xls2csv 1 #!/bin/perl -I/root/perl5/lib/perl5/x86_64-linux-thread-multi +/root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi /root/perl5/li +b/perl5/5.16.3 /usr/local/lib64/perl5 2 use strict; 3 use 5.006; 4 5 use lib '/root/perl5/lib/perl5'; 6 use Getopt::Std; 7 use Locale::Recode; 8 use Spreadsheet::ParseExcel; 9 use Spreadsheet::ParseExcel::FmtUnicode; 10 use Text::CSV_XS; 11
And the error:
Can't locate Unicode/Map.pm in @INC (@INC contains: /root/perl5/lib/pe +rl5 /root/perl5/lib/perl5/x86_64-linux-thread-multi /root/perl5/lib/p +erl5/5.16.3/x86_64-linux-thread-multi /root/perl5/lib/perl5/5.16.3 /u +sr/local/lib64/perl5 /root/perl5/lib/perl5/x86_64-linux-thread-multi +/root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi /root/perl /ho +me/XXX/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi /home/XXX/per +l5/lib/perl5/5.16.3 /home/XXX/perl5/lib/perl5/x86_64-linux-thread-mul +ti /home/XXX/perl5/lib/perl5 /usr/local/lib64/perl5 /usr/local/share/ +perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/ +lib64/perl5 /usr/share/perl5 .) at /home/XXX/perl5/lib/perl5/Spreadsh +eet/ParseExcel/FmtUnicode.pm line 22. BEGIN failed--compilation aborted at /home/XXX/perl5/lib/perl5/Spreads +heet/ParseExcel/FmtUnicode.pm line 22. Compilation failed in require at ./xls2csv line 9. BEGIN failed--compilation aborted at ./xls2csv line 9.
I've matched up XXX's @INC to root's @INC via the "#!/bin/perl -I..." line of the script. It SEEMS the critical directories match up. Here's root's @INC:
[root@n12 p1]# perl -e "print \"@INC\"" | sed 's/ /\n/g' | sort . /root/perl5/lib/perl5 /root/perl5/lib/perl5/5.16.3 /root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi /root/perl5/lib/perl5/x86_64-linux-thread-multi /usr/lib64/perl5 /usr/lib64/perl5/vendor_perl /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/share/perl5 /usr/share/perl5/vendor_perl
And here's XXX's @INC:
[XXX@n12 p1]$ echo <output from @INC erro> | sed 's/ /\n/g' | sort /home/XXX/perl5/lib/perl5 /home/XXX/perl5/lib/perl5/5.16.3 /home/XXX/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi /home/XXX/perl5/lib/perl5/x86_64-linux-thread-multi /root/perl /root/perl5/lib/perl5 /root/perl5/lib/perl5/5.16.3 /root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi /root/perl5/lib/perl5/5.16.3/x86_64-linux-thread-multi /root/perl5/lib/perl5/x86_64-linux-thread-multi /root/perl5/lib/perl5/x86_64-linux-thread-multi /usr/lib64/perl5 /usr/lib64/perl5/vendor_perl /usr/local/lib64/perl5 /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/share/perl5 /usr/share/perl5/vendor_perl
I THINK Map.pm is the file that needs to be found in @INC. Here's where it is:
[root@n12 p1]# find / | grep Unicode | grep Map.pm /root/.cpan/build/Unicode-Map-0.112-Pe4OUJ/Map.pm /root/.cpan/build/Unicode-Map-0.112-Pe4OUJ/blib/lib/Unicode/Map.pm /root/perl5/lib/perl5/x86_64-linux-thread-multi/Unicode/Map.pm
Since the .cpan directories are not in root's @INC, I didn't add them to XXX's @INC. I'm thinking I don't know everything I need to fix this. Can you help?

Replies are listed 'Best First'.
Re: Can't locate Unicode/Map.pm but it's installed and I THINK in @INC
by Crackers2 (Parson) on Jun 14, 2017 at 17:26 UTC
    Does XXX have enough permissions to read the files under /root/perl ?

      I would surely hope not.

      The real answer is install modules in the user's home directory or a directory that is shared amongst all users, then add it to @INC:

      use lib '/path/to/shared/dir';
        DUH! This is my first PERL install. Didn't know some of the best practices so I just installed as root. I followed your suggestion, installed the module to user's home directory, and pointed the "use lib..." to it. BINGO! Thanks!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-03-29 13:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found