0

I've got a script that starts with

#! /usr/bin/perl
use strict;
use HTML::Tree;
use LWP::Simple;
use threads;
use threads::shared;

and when I run it I get this error

Can't locate HTML/Tree.pm in @INC (@INC contains: /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 parser.pl line 3. BEGIN failed--compilation aborted at parser.pl line 3.

How do I install the required stuff ?

mu is too short
  • 426,620
  • 70
  • 833
  • 800
WaterBearer
  • 229
  • 1
  • 5
  • 13
  • `$ man cpan` and do a bit of reading. – mu is too short Jan 25 '12 at 05:24
  • @muistooshort Tried in the Terminal and got `-bash: $: command not found` then tried after typing `perl` and got `Bareword found where operator expected at - line 2, near "$ man cpan" (Missing operator before cpan?)` – WaterBearer Jan 25 '12 at 05:39
  • The `$` indicates that you're supposed to type the rest at your shell prompt, it is pretty common notation. So just do `man cpan` at your shell prompt. – mu is too short Jan 25 '12 at 05:41
  • From the [Stack Overflow Perl FAQ](http://stackoverflow.com/questions/tagged/perl?sort=faq): [What's the easiest way to install a missing Perl module?](http://stackoverflow.com/questions/65865/whats-the-easiest-way-to-install-a-missing-perl-module) – daxim Jan 25 '12 at 12:14

1 Answers1

3

You need to run cpan utility:

# perl -MCPAN -e 'shell'

And next (in the cpan promp after the series of simple questions):

cpan> install HTML::Tree
gangabass
  • 10,607
  • 2
  • 23
  • 35
  • 1
    I followed http://www.cpan.org/modules/INSTALL.html and got it to work. Note for others: you need to be root with `sudo bash` then do `cpan App::cpanminus` then not `cpanm Module::HTML::Tree` but `cpan HTML::Tree` – WaterBearer Jan 25 '12 at 06:22