Thanks for the reply T.Rob. Yes I was looking for the procedural version (being the 
old stick-in-the-mud I am) but I admit I'd forgotten about the OO one.

After sending my note I took another look at the latest MQ-Perl docs and found that 
they've now added an example so for future reference here's my slightly modified 
version of this:

- - - - - - - - - - - - - - - - - -
use MQClient::MQSeries;

$QMgrName = "*";
$ConnOption =
  { 'ChannelName'    => 'SYSTEM.DEF.SVRCONN'
   ,'TransportType'  => 'TCP'
   ,'ConnectionName' => 'localhost(1414)'
  };

$SSLOption = { 'KeyRepository' => '/var/mqm/ssl/key' };

$HConn = MQCONNX($QMgrName, { 'ClientConn' => $ConnOption, 'SSLConfig'  => 
$SSLOption}, $CompCode, $Reason);
- - - - - - - - - - - - - - - - - -

-----Original Message-----
From: MQSeries List [mailto:[EMAIL PROTECTED] Behalf Of Wyatt,
T.rob
Sent: 06 August 2004 15:29
To: [EMAIL PROTECTED]
Subject: Re: Perl MQCONNX example


Paul,

Here's one that uses the MQSeries::QueueManager object to connect.  I think it uses 
MQCONNX under the covers but it sounds like you wanted the procedural version anyway.  
If the attached example doesn't help, feel free to email me your code off-list and 
I'll get it working for you.

This version creates the QMgr object in one step and then does the CONNECT.  This is 
so you can tell the difference between a Perl error creating the object in the first 
step and an MQ error failing to connect in the second.  Either way, I print the error 
to an XML tree in &CmdErr but you could just as easily print it to the console with 
something like...

sub CmdErr {
        die join(' ', @_);
}

-- T.Rob


sub DoConnect {
    $QMgr = MQSeries::QueueManager->new (
        QueueManager => $QMName,
        ClientConn   => { 'ChannelName'    => $Channel,
                          'TransportType'  => 'TCP',
                          'ConnectionName' => "$IPAddress($Port)",
                        },
        AutoConnect     => 0,
        Carp            => \&CmdErr,
    ) or &CmdErr("<!-- Unable to instantiate QMgr object for $QMName -->\n");
    $QMgr->Connect()
        or &CmdErr("Unable to connect to $QMName: ", MQReasonToText($QMgr->Reason()), 
"\n");
}

sub CmdErr {
    my $message = join(' ', @_);
    $Tree->{EXCEPTION}{'content'} = $message;
    $Fatal++;
}

-----Original Message-----
From: MQSeries List [mailto:[EMAIL PROTECTED] Behalf Of Meekin,
Paul
Sent: Thursday, August 05, 2004 10:59 AM
To: [EMAIL PROTECTED]
Subject: Perl MQCONNX example


Hi list,

Does anyone have an wokring example of a Perl program calling MQCONNX to make a client 
connection that they would be willing to share? I've tried to get this to work but am 
probably hampered by not really understanding how to use Perl hashes!

Cheers,
Paul

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive

Instructions for managing your mailing list subscription are provided in
the Listserv General Users Guide available at http://www.lsoft.com
Archive: http://vm.akh-wien.ac.at/MQSeries.archive

Reply via email to