By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Installing Perl CPAN Modules on Windows

This Tutorial shows how to install perl with the cpan maneger, and how to install cpan modules.

Created: 2012-02-25 17:19

If you don't know how to install perl and CPAN modules, and if you are using windows, then start by installing strawberryperl

Now, to install modules, you will first need to install the cpan manager, the command to do that is shown later. Lets just say for now, that this Tutorial will show how to install the Parse::RecDescent and Text::Balanced modules, just for an example. These modules are required to make your own lang definition files with the sh2js.pl script, for use with SHJS, which is a JavaScript Syntax Highlighter.

To install the cpan manager, open up the command line found in start - programs - Strawberry Perl. From this Command Line simply type in the below commands.

cpan App::cpanminus

Wait for the installation to finish, then enter the next command to install the Parse::RecDescent module.

cpanm Parse::RecDescent

Finally Parse::RecDescent states in its readme, that it requires the Text::Balanced module, so simply install that as well.

cpanm Text::Balanced

Basically this should get you started, whether you want to just learn how to install these modules, or came here to learn how to make your own language definition files. If the latter is the case, then you can use the below batch script to create the JS files used by SHJS.

perl sh2js.pl html.lang > sh_html.js
@pause

Finally be careful that you got the right version of the SHJS source package, as older versions of sh2js.pl appears to create incompatible files.