Today I managed to finally get Perl to put and get messages to MQ Series. It’s something that I’ve been wanting to do for quite some time, but didn’t have the time or even MQ knowledge to do so.
This post is intended for those who, like me, aren’t MQSeries gurus and can’t make much of the documentation of the MQSeries module in CPAN. I hope it serves you well and in the end you will be able to use MQSeries with Perl. Continue Reading…
Installing MQSeries module on Windows XP is a piece of cake, as long as you get the right tools before you even try.
Update: July 2, 2009 I had to install the module on a new computer running Windows XP and it looks like I had missed a few steps in the original how-to below. It’s been updated with the manual editing steps. From step 3 down, it’s all new.
This is what you need:
MQSeries installed (get the 90-day trial version here. You will need to register, but there’s no charge for that)
Microsoft Visual C++ (it’s free, and you can get it here)
(Extremely important!!)Set up your build environment by running vcvarsall.bat. Mine is under C:Program FilesMicrosoft Visual Studio 9.0VC An alternative to this step is to open a Visual Studio 2008 Command Prompt (Start->All Programs->Microsoft C++ 2008 Express Edition->Visual Studio Tools->Visual Studio 2008 Command Prompt)
Make sure your environment variables are set with MQ data: INCLUDE=pathtotoolscinclude directory, LIB=pathtotoolslib directory (typing set will show you your env vars)
Install pre-requisite Params::Validate by running perl -MCPAN -e “install Params::Validate”
Download MQSeries manually by running perl -MCPAN -e “get MQSeries”
cd into the directory where you have your cpan (mine is c:Perlcpanbuild) and enter MQSeries-x.xx-* (where * is a series of random chars if you’re using the latest CPAN)
With a decent text editor (I’m using Notepad++ and also like Crimson Editor and Programmer’s Notepad 2), edit CONFIG file: uncomment MQMTOP = … and replace the path with the path to your MQ Tools directory. It’s OK to use long directory and file names (e.g c:Program FilesIBMWebsphere MQTools)
Now cd into the utils directory, open parse_headers file and comment out or delete the line near the top where it says “my $include = ‘/opt/mqm/inc';”. The reason for this is that my overwrites the $include variable previously populated by parse_config file.
Save your changes and in the base directory for the MQSeries build, run perl Makefile.PL. It might complain about some libs not being found, but that wasn’t a show stopper for me.
Run nmake. It came with your MS Visual C++ install and should be in your PATH.
Run nmake test. It’ll fail, since you didn’t set any valid data in the CONFIG file. If you have any valid data such as QM and Queues to test it with, go ahead and set them in the CONFIG file and run nmake test again. If not, that’s OK.
If nmake test was the only place where it failed, then you’re good to run nmake install.
That’s it – Perl MQSeries module should now be installed.