Can't locate XML/ in @INC

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Here's one to watch out for. I recently install XML::Simple to do some
XML parsing. I did this from root..

# perl -MCPAN -e 'install XML::Simple'

...which ran through the usual install process OK (it seemed).
However, when I went to use the XML::Simple module in a script, I got
the dreaded "Can't locate..." error...

$ ./
Can't locate XML/ in @INC (@INC contains: /usr/lib/perl5/
site_perl/5.8.5/XML/ /usr/lib/pthread-multi /usr/lib/
perl5/5.8.5 /usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi /
usr/lib/perl5/siux-thread-multi /usr/lib/perl5/site_perl/5.8.3/i386-
linux-thread-multi /usr/lib/perl5/site_perl/5.8.2/i386sr/lib/perl5/
site_perl/5.8.1/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0/
i386-linux-thread-multperl/5.8.5 /usr/lib/perl5/site_perl/5.8.4 /usr/
lib/perl5/site_perl/5.8.3 /usr/lib/perl5/site_perl/5.8.2 /u/5.8.1 /usr/
lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl /usr/lib/perl5/
multi /usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi perl/
5.8.2/i386-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.1/i386-
linux-thread-multi /usr/lib/perl56-linux-thread-multi /usr/lib/perl5/
vendor_perl/5.8.5 /usr/lib/perl5/vendor_perl/5.8.4 /usr/lib/perl5/vend/
perl5/vendor_perl/5.8.2 /usr/lib/perl5/vendor_perl/5.8.1 /usr/lib/
perl5/vendor_perl/5.8.0 /usr/lib/perl5/bin/ line
BEGIN failed--compilation aborted at ./ line 18.

After a bit of googling I couldn't find why this was happening.  I did
notice however that the root user could run the script OK. So, that
make me think it must be permissions.  I was lucky enough to have
another box where this was working, so compared these directories
(where XML::Simple got installed)...


...and noticed that the problem box had files & directories WITHOUT
world read-access. So, to fix, I did this...

# cd /usr/lib/perl5/site_perl/5.8.5
# find XML -type d -exec chmod 755 {} \;
# find XML -type f -exec chmod o+r {} \;

...which fixed the problem - now non-root users can read the modules.
Hope that helps if you hit the same issue. I wonder why the perms
where wrong in the first place...?

Site Timeline