1

I'm very new to programming so I apologise if I've missed something obvious.

I'm following the directions at https://github.com/keeth/Net-OAuth/blob/master/README and got the following error:

Can't locate MIME/Types.pm in @INC
(@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 
/usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10
/usr/local/lib/site_perl .) at /usr/local/share/perl/5.10.1/Dancer/MIME.pm line 7.

It sounds like there's an error in the perl module Dancer/MIME.pm? If so I don't know how I could ever debug that.

Addendum: more error messages.

$ ./mayor-emanuel.pl Can't locate HTTP/Body.pm in @INC (@INC contains: /etc/perl 
/usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 
/usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at 
/usr/local/share/perl/5.10.1/Dancer/Request.pm line 12. BEGIN failed--compilation aborted at 
/usr/local/share/perl/5.10.1/Dancer/Request.pm line 12. Compilation failed in require at 
/usr/local/share/perl/5.10.1/Dancer/Route.pm line 11. BEGIN failed--compilation aborted at 
/usr/local/share/perl/5.10.1/Dancer/Route.pm line 11. Compilation failed in require at
/usr/local/share/perl/5.10.1/Dancer/Route/Registry.pm line 5. BEGIN failed--compilation 
aborted at /usr/local/share/perl/5.10.1/Dancer/Route/Registry.pm line 5. Compilation failed 
in require at /usr/local/.../Dancer/App.pm line 10. BEGIN failed--compilation aborted at 
/usr/local/share/perl/5.10.1/Dancer/App.pm line 10. Compilation failed in require at 
/usr/local/share/.../Dancer.pm line 13. BEGIN failed--compilation aborted at 
/usr/local/share/perl/5.10.1/Dancer.pm line 13. Compilation failed in require at ./mayor-
emanuel.pl line 5. BEGIN failed--compilation aborted at ./mayor-emanuel.pl line

By the way I use Ubuntu 10.04.

Question: what does this mean and what should I do about it?

isomorphismes
  • 8,233
  • 9
  • 59
  • 70
  • 1
    http://stackoverflow.com/questions/65865/whats-the-easiest-way-to-install-a-missing-perl-module – daxim Mar 10 '11 at 09:46

3 Answers3

4

Either the MIME::Types module is not installed on your system or it's not in your path. If it's the former, then install it (you can do this with cpan). If it is present but not in a normal location (read: one of the directories listed in the "@INC contains:" error), you can add that directory by adding

use lib '/path/to/library';

ahead of the use MIME::Types; statement.

caw
  • 421
  • 1
  • 3
  • 11
  • I did `$cpan> install MIME::Types` as below in response to @Ted Hopp. I didn't put anything in a weird location but I added my current directory with `use lib '/home/me/project/'` just in case. Still getting the error message in comments of the OP. – isomorphismes Mar 10 '11 at 01:59
  • Thanks also for responding so quickly! – isomorphismes Mar 10 '11 at 02:00
1

The thegeekStuff link perfectly explains the procedures of installing a perl module. Please go through the link.

To install a individual perl module:

  1. Download the perl module, you can find it on CPAN.

  2. Extract it and then make

$ gzip -d XML-Parser-2.36.tar.gz  
$ tar xvf XML-Parser-2.36.tar

now make

$ perl Makefile.PL  
Checking if your kit is complete...  
Looks good  
Writing Makefile for XML::Parser::Expat  
Writing Makefile for XML::Parser  
$ make  
$ make test  
$ make install

By this method you'll install a single module, but if it has any dependent module, you'll need to install it manually. Alternatively the best way to install perl modules is cpan

First get the cpan installed once

 $ yum install perl-CPAN

and after configuring, use cpan to install any module. It'll take care of installing all the dependant modules as well.

mtk
  • 13,221
  • 16
  • 72
  • 112
1

It sounds like you need to install the MIME::Types module.

Ted Hopp
  • 232,168
  • 48
  • 399
  • 521
  • cpan[35]> install MIME::Types Running install for module 'MIME::Types' Running make for M/MA/MARKOV/MIME-Types-1.31.tar.gz Has already been unwrapped into directory Has already been made Running make test Has already been tested successfully Running make install Already tried without success – isomorphismes Mar 10 '11 at 01:50
  • @Ted Hopp Thanks for the fast response! But when I try to install MIME::Types I got the above (lots of [...] left out) – isomorphismes Mar 10 '11 at 01:51
  • 1
    If make install failed, you may not have permission, especially if you are installing in the system perl as a regular user. You can tell cpan to run make install as 'sudo make install' and it will prompt you for a password. In cpan type 'o conf make_install_make_command = 'sudo make install'. – Jim Brandt Mar 10 '11 at 01:55
  • Thanks @Jim Brandt. I did `cpan> o conf make_install_make_command='sudo make install'` earlier tonight and then did `cpan> clean MIME::Types` as well as `cpan> clean Dancer`. still getting the error in OP comments above. – isomorphismes Mar 10 '11 at 02:01
  • 1
    Did you do them in the same cpan session? If not, that o conf configuration setting will be lost. o conf commit will save it for good. You probably also want to do o conf mbuild_install_build_command = 'sudo ./Build' to handle the other style of installing perl modules. – Jim Brandt Mar 10 '11 at 02:06
  • @Jim Brandt I did do them in the same `cpan` session. Just did `cpan > o conf mbuild_install_build_command = 'sudo ./Build'` and I remember that I did `o conf commit` so these should last across CPAN sessions. Still didn't fix the problem in the OP though. – isomorphismes Mar 10 '11 at 02:16
  • Can you post all of the messages from the cpan shell back up in your question? – Jim Brandt Mar 10 '11 at 23:34
  • @Jim Brandt Sure, I've moved them from the comments to the question body. – isomorphismes Mar 14 '11 at 23:02