I've installed the Template module via CPAN on my MacBook Pro and it seemed to install correctly.
But, when I try to run a script that includes the Template module, I get the following:
Can't locate Template.pm in @INC (@INC contains: /Users/purinkle/Sites/rob/modules /Library/Perl/Updates/5.10.0/darwin-thread-multi-2level /Library/Perl/Updates/5.10.0 /System/Library/Perl/5.10.0/darwin-thread-multi-2level /System/Library/Perl/5.10.0 /Library/Perl/5.10.0/darwin-thread-multi-2level /Library/Perl/5.10.0 /Network/Library/Perl/5.10.0/darwin-thread-multi-2level /Network/Library/Perl/5.10.0 /Network/Library/Perl /System/Library/Perl/Extras/5.10.0/darwin-thread-multi-2level /System/Library/Perl/Extras/5.10.0 .) at ./index.pl line 12.
BEGIN failed--compilation aborted at ./index.pl line 12.
I then think that something must have gone wrong during installation and try to install again via CPAN but receive the following message:
Template is up to date (2.22).
I've then ran the instmodsh command to try and find where the module is installed. instmodsh lists these directories:
/opt/local/bin
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/Template
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/Template/Manual
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/Template/Namespace
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/Template/Plugin
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/Template/Stash
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/Template/Tools
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/Template/Tutorial
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level/auto/Template/Stash/XS
/opt/local/share/man/man1
/opt/local/share/man/man3
It looks like I have some how got two different versions of Perl installed (5.8.9 and 5.10.0) and this is causing confusion between CPAN and other Perl scripts.
How can I verify this and how can this issue be resolved?
I've ran the commands
which perl
which cpan
and they both return /opt/local/bin
Running
find / -name perl
returns
find: /dev/fd/3: Not a directory
find: /dev/fd/4: Not a directory
/opt/local/bin/perl
/opt/local/etc/bash_completion.d/perl
/opt/local/var/macports/software/bash-completion/1.2_0/opt/local/etc/bash_completion.d/perl
/opt/local/var/macports/software/perl5.8/5.8.9_3/opt/local/bin/perl
/opt/local/var/macports/sources/rsync.macports.org/release/ports/perl
/usr/bin/perl
/usr/local/bin/perl
/usr/share/file/magic/perl
and
find / -name cpan
returns
/opt/local/bin/cpan
/opt/local/var/macports/software/perl5.8/5.8.9_3/opt/local/bin/cpan
/Users/purinkle/.cpan/build/CPAN-1.9402-KtN827/blib/script/cpan
/Users/purinkle/.cpan/build/CPAN-1.9402-KtN827/scripts/cpan
/Users/purinkle/.cpan/build/CPAN-1.9402-zb0AeX/blib/script/cpan
/Users/purinkle/.cpan/build/CPAN-1.9402-zb0AeX/scripts/cpan
/usr/bin/cpan
Running
perl -e 'print join "\n", @INC'
returns
/Users/purinkle/Sites/rob/modules
/opt/local/lib/perl5/site_perl/5.8.9/darwin-2level
/opt/local/lib/perl5/site_perl/5.8.9
/opt/local/lib/perl5/site_perl
/opt/local/lib/perl5/vendor_perl/5.8.9/darwin-2level
/opt/local/lib/perl5/vendor_perl/5.8.9
/opt/local/lib/perl5/vendor_perl
/opt/local/lib/perl5/5.8.9/darwin-2level
/opt/local/lib/perl5/5.8.9