user3035874
user3035874

Reputation:

How to install perl module and include in Perl script?

I am new to the Perl. I've downloaded HTML-TreeBuilder-XPath-0.14.tar.gz I want to know how to install it.

I am using Windows.

How to include this in my perl script?

I've opened cpan using run command and installed HTML-TreeBuilder-XPath-0.14 using the command install HTML-TreeBuilder-XPath-0.14, but I got the following error:

Writing C:\Perl\cpan\Metadata
Warning: Cannot install HTML-TreeBuilder-XPath-0.14, don't know what it is.
Try the command

    i /HTML-TreeBuilder-XPath-0.14/

to find objects with matching identifiers.

Upvotes: 2

Views: 2028

Answers (3)

Deepak Dhakad
Deepak Dhakad

Reputation: 1

The easiest way that i found to install any perl module is :

Step 1 : open your os terminal

Step 2 : change path to bin folder path. example(windows) -> cd C:\Strawberry\perl\bin

Step 3 : now run a command : perl cpan

Step 4 : type below command to check installation is working or not. example(windows) -> install App::cpanminus

Step 5 : now for installing any perl module do like this(for Convert::EBCDIC module) : example(windows) -> install Convert::EBCDIC

Awesome, you are done!!

Upvotes: 0

Quentin
Quentin

Reputation: 944210

You need to give the module name, not the distribution name:

install HTML::TreeBuilder::XPath

You don't need to download the distribution first, cpan will do that for you.

Upvotes: 4

user1418706
user1418706

Reputation: 202

Its easiest if you just run the CPAN shell from your machine ( type "cpan" ) and then just type "install HTML-TreeBuilder-XPath-0.14" from that shell.

It will go off and find the module and take care of the installation.

To then use it in your script just add:

use HTML-TreeBuilder-XPath-0.14;

before you make use of it

Upvotes: -2

Related Questions