Using CPAN version of WWW::Mechanize with ActiveState Perl on Windows

I end up doing this each time I reinstall windows, and every time I forget how I did it, so I figured I’ll archive the process here. Perhaps it will help some of you. And I know, someone will say why don’t you use the PPM repository. Let’s just say i don’t want to. I want to grab the latest WWW::Mechanize package from CPAN and run with it.

Why am I posting it now? Because I needed to reinstall windows once again on my desktop, and now I need to get my blackboard scrips to work again.

This is really a multi step process. I’ll assume you have perl installed already. If not, you can get Activestate Perl which works pretty well on windows. Just grab the MSI package, install it and all the useful tools including perl, cpan and ppm will land in your path. From there follow these 3 easy steps:

Step 1: Get nmake

You will need nmake – the windows version of the make utility to compile most of the CPAN packages. How do you get nmake? There are several ways to do it, but probably easiest one is to grab the Microsoft version of the tool from their knowledge base. Once you download it, dump it somewhere in your path. It doesn’t really matter where it is, but I stuck it in the bin directory of my Perl install.

Step 2: Get YAML from CPAN

You will need YAML to build WWW::Mechanize. What is YAML? Sort answer is: do you care? Long answer: look it up. All you need to know is that you need it. So run cpan from your console and type in:

install YAML

This should cause some streaming text on the screen as the package is fetched and compiled. If it fails, make sure nmake is in your path, and that it is named nmake.exe and not something else.

Step 3: Install WWW::Mechanize

Final step is the easy one – just fetch and install the WWW::Mechanize package using the traditional method:

install WWW::Mechanize

Make sure you do step 1 and 2 before you try this. If you have tried this before you installed YAML the build will fail for some reason. To avoid that, just quit cpan, and run it again. This will clear the local cache and will re-fetch the package for a clean build.

So, there you have it. I know it’s a bit of a dry and uninteresting post for Monday morning. But this is more of a reminder to myself than anything else. I never remember where to grab nmake or what is that other package without which nothing ever builds on windows. Hopefully some of you will find it helpful. :)

[tags]perl, activestate perl, activestate, yaml, nmake, www::mechanize, windows[/tags]

This entry was posted in programming and tagged , , . Bookmark the permalink.

3 Responses to Using CPAN version of WWW::Mechanize with ActiveState Perl on Windows

  1. Wendelmaques BRAZIL Mozilla Firefox Windows says:

    Thanks, this tip is very useful to install the new version of Mech.
    You need to update if you want use the new “find_all_inputs” to automate CPANEL/WHM access (DNS).

    Reply  |  Quote
  2. life saving CANADA Opera Windows says:

    dude!! your post is a life saving awesomeness…i know my choice of words makes me look like an idiot, but that’s how i’ve been feeling for the past 2 days looking online trying to get the damn mechanize to work…

    Reply  |  Quote
  3. Junk212 INDONESIA Mozilla Firefox Windows says:

    hey… that’s cool….
    thank’s for the solution….

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *