Hi monks, I am new to Perl and this community and still learning the amazing language. However, I have run into a roadblock while using CPAN modules. Every CPAN module that I install gets installed properly, but when I use it in my code, the compiler throws an error "Can't locate <module_name.pm in @INC", when @INC contains the path where the module has beebn installed. For example :
1. I installed Term::ANSIColor through CPAN
2. Running the UNIX command "sudo find / -name ANSIColor.pm -print" gives me the following output :
/home/amit/.cpan/build/Term-ANSIColor-3.02-qAhFw6/blib/lib/Term/ANSICo +lor.pm /home/amit/.cpan/build/Term-ANSIColor-3.02-qAhFw6/ANSIColor.pm /usr/local/share/perl/5.10.1/Term/ANSIColor.pm /usr/share/perl/5.10.1/Term/ANSIColor.pm
3. Executing the code
#!/usr/bin/perl use warnings; BEGIN { push @INC,"/usr/share/perl/5.10.1"; } use TERM::ANSIColor; print color("red"), "hello world\n", color("reset");
gives me the following output
Can't locate TERM/ANSIColor.pm in @INC (@INC contains: /etc/perl /usr +/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /u +sr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib +/site_perl . /usr/share/perl/5.10.1) at ./ansicol.plx line 8. BEGIN failed--compilation aborted at ./ansicol.plx line 8.
So, the directory which contains the .pm file is already in @INC still I get the error. Please help me out as this is quite frustrating and I have not been able to use any modules because of this error. Thanks!
In reply to Can't find <module> in @INC error by maanu2k
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |