Operating System - Linux
1748185 Members
3888 Online
108759 Solutions
New Discussion юеВ

Perl module - works for root but not normal users?

 
SOLVED
Go to solution
Tony Walker_2
Frequent Advisor

Perl module - works for root but not normal users?

Hi Guys,

Recently installed a ParseExcel perl module using the perl -MCPAN option. All worked fine and can run the following as root successfully:
#perl -MSpreadsheet::ParseExcel -le'print
$Spreadsheet::ParseExcel::VERSION'
0.2603

However, if I su to another user I get this (please note there were permissions issues on the module directories which I have fixed)

#su - dwadm
[myhost:dwadm]$ perl -MSpreadsheet::ParseExcel -le'print $Spreadsheet::ParseExcel>
Can't find 'boot_IO' symbol in /dw/perl5/lib/5.6.1/PA-RISC2.0//auto/IO/IO.sl
at /dw/perl5/lib/5.6.1/PA-RISC2.0//IO.pm line 9
Compilation failed in require at /dw/perl5/lib/5.6.1/PA-RISC2.0//IO/Handle.pm line 256.
BEGIN failed--compilation aborted at /dw/perl5/lib/5.6.1/PA-RISC2.0//IO/Handle.pm line 256.
Compilation failed in require at /dw/perl5/lib/5.6.1/PA-RISC2.0//IO/Seekable.pm line 101.
BEGIN failed--compilation aborted at /dw/perl5/lib/5.6.1/PA-RISC2.0//IO/Seekable.pm line 101.
Compilation failed in require at /dw/perl5/lib/5.6.1/PA-RISC2.0//IO/File.pm line 112.
BEGIN failed--compilation aborted at /dw/perl5/lib/5.6.1/PA-RISC2.0//IO/File.pm line 112.
Compilation failed in require at /opt/perl/lib/site_perl/5.6.1/OLE/Storage_Lite.pm line 171.
BEGIN failed--compilation aborted at /opt/perl/lib/site_perl/5.6.1/OLE/Storage_Lite.pm line 171.
Compilation failed in require at /opt/perl/lib/site_perl/5.6.1/Spreadsheet/ParseExcel.pm line 176.
BEGIN failed--compilation aborted at /opt/perl/lib/site_perl/5.6.1/Spreadsheet/ParseExcel.pm line 176.
Compilation failed in require.
BEGIN failed--compilation aborted.

Any ideas?

Thanks,

Tony
9 REPLIES 9
Peter Godron
Honored Contributor

Re: Perl module - works for root but not normal users?

Tony,
by using the "-" with the su command you execute the environment setup scripts fot the user. Therefor you alter the environment to run the script in.
Can you please test:
su dwadm
then run your command (Should work, bar permissions problems)

Arunvijai_4
Honored Contributor

Re: Perl module - works for root but not normal users?

Hi Tony,

You can just use # su with "-" where it executes user's profile. I think, it should help you.

http://lists.trustix.org/pipermail/tsl-discuss/2004-August/011621.html
-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
Tony Walker_2
Frequent Advisor

Re: Perl module - works for root but not normal users?

OK,

That works in terms of proving its not permissions related but this user is being logged into and then running perl scripts so the problem remains. Does the error report give you any indication of what ENV variable is the problem. I've tried su - dwadm and then using the exact PATH variable that root uses and still no go.

Cheers,

Tony
H.Merijn Brand (procura
Honored Contributor
Solution

Re: Perl module - works for root but not normal users?

I'm almost sure this has nothing to do with who you are or as who you run it. I think the other user finds a different perl in his/her $PATH, and thus cannot find the required modules.

His path to perl is in /dw (looking at the errors), what is yours?

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
H.Merijn Brand (procura
Honored Contributor

Re: Perl module - works for root but not normal users?

Another thought: perl uses environment variables to look for modules in the locations stored in the array @INC, the default shows with

# perl -V

capital V. list is at the end.

a5:/u/usr/merijn 101 > perl -le'print for @INC'
/pro/lib/perl5/5.8.5/PA-RISC2.0
/pro/lib/perl5/5.8.5
/pro/lib/perl5/site_perl/5.8.5/PA-RISC2.0
/pro/lib/perl5/site_perl/5.8.5
/pro/lib/perl5/site_perl
.
a5:/u/usr/merijn 102 > /opt/perl/bin/perl -le'print for @INC'
/opt/perl/lib/5.8.7/PA-RISC2.0
/opt/perl/lib/5.8.7
/opt/perl/lib/site_perl/5.8.7/PA-RISC2.0
/opt/perl/lib/site_perl/5.8.7
/opt/perl/lib/site_perl
.
a5:/u/usr/merijn 103 > /opt/perl64/bin/perl -le'print for @INC'
/opt/perl64/lib/5.8.7/PA-RISC2.0-LP64
/opt/perl64/lib/5.8.7
/opt/perl64/lib/site_perl/5.8.7/PA-RISC2.0-LP64
/opt/perl64/lib/site_perl/5.8.7
/opt/perl64/lib/site_perl
.
a5:/u/usr/merijn 104 >

Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
Tony Walker_2
Frequent Advisor

Re: Perl module - works for root but not normal users?

procura, thanks, I'm getting closer. The user is manually setting PERL5LIB to the /dw directories in their profile!! I've no doubt they will complain about the need to change but there you go.

Thanks everyone for their help.

Rgds,

Tony
Ralph Grothe
Honored Contributor

Re: Perl module - works for root but not normal users?

Hi Tony,

I've never used Parse::Excel,
so I couldn't tell what its prerequisites are.
From your error messages I assume that your dwadm user is either referring to another Perl build or has a deviating environment as far as library paths are concerned (in case Parse::Excel introduced some XS code).

You first should check which Perl each of root and dwadm is using.
Simply issue "perl -V" when fully logged in as either.
This will also show you the @INC array's contents.

You could also check the autoloaded shared lib IO.sl for its dependencies and search paths (use chatr on it).
Madness, thy name is system administration
Ralph Grothe
Honored Contributor

Re: Perl module - works for root but not normal users?

Sorry, for seemingly repeating what procura already told you.
This isn't my fault.
When I clicked the submit button
the ITRC webserver wasn't anymore available,
and my POST request must have been pending for several minutes.
Madness, thy name is system administration
Tony Walker_2
Frequent Advisor

Re: Perl module - works for root but not normal users?

No worries! Your help is appreciated either way..