Building Perl modules on Windows

CPAN

Software

Setup

You must paste my script to directory above your Perl installation. Script was written for Perl installed in MozillaBuild directory: C:\mozilla-build\perl-5.18\x64 or \x86, so script must be in perl-5.18 dir, if your Perl installation dir is in another place you must edit PATHs in lines 13 & 16.

MSYS can be extracted to any directory you want, you just need to edit PATH in SET MSYS=I:\MSYS\bin, fg. SET MSYS=C:\MSYS\bin

Usage

To use script you must open cmd (Win+R, type cmd), navigate to directory where you pasted cpan.bat. Type cpan.bat x86 if you’re using 32bit Hexchat & Perl or cpan.bat x64 for 64bit version. After that you can use all cpan commands.

Old depreciated method

Software

To start building Perl modules you need to download and install this software (in their default install paths):

Downloading and Extracting

Start MozillaBuild console (it’s in C:\mozilla-build) start-msvc11.bat (if you’re using Hexchat x86) or start-msvc11-x64.bat (if you’re using Hexchat x64).

Type:

mkdir perl; cd perl

(we will work in perl directory).

All Perl modules can be downloaded from CPAN site.

Now we can download the module which can be done using wget http://link command. Later we extract it using tar -zxvf module.tar.gz.

In this guide we will build Net::Telnet module. So we are downloading it and extracting:

wget http://search.cpan.org/CPAN/authors/id/J/JR/JROGERS/Net-Telnet-3.03.tar.gz
tar -zxvf Net-Telnet-3.03.tar.gz

Type cd Net-Telnet-3.03 and we can start building.

Note on Perl module dependencies

This building method isn’t perfect so if you’re building modue which depends on other module, you need to build it before repeating all steps in this guide.

Building

Fist thing we must do is to configure module and point it to our Perl installation using:

c:/perl/bin/perl.exe Makefile.pl

Note: It really depends if it is Makefile.pl or Build.pl, just check in folder and read README.

You should get something like this:

Checking if your kit is complete...
Looks good
Writing Makefile for Net::Telnet
Writing MYMETA.yml and MYMETA.json

It means that module was properly configured. Now we can move to compilation which can be done using:

nmake

After it we can install module using:

nmake install

Now if you didn’t get any error you should have Perl module installed and it can be used with Perl script in Hexchat.

Whole operation should look like this:

http://i.imgur.com/2phxzxr.png