MQSeries::Config::Machine -- Interface to read the machine configuration file


  use MQSeries::Config::Machine;

  my $conf = MQSeries::Config::Machine->new();

  print "All configuration sections: ", join(', ', $conf->stanzas()), "\n";

  my $default = $conf->lookup('DefaultQueueManager');
  if (defined $default) {
      print "Default queue manager: $default->{'Name'}\n";

  my $local = $conf->localqmgrs();
  print "All local queue managers:\n";
  while (my ($name, $data) = each %$local) {
      print "  $name - $data->{'Directory'}\n";


The MQSeries::Config::Machine class is an interface to the machine configuration file, typically /var/mqm/mqs.ini. This class will parse the file and allow you to lookup any group of settings in the class. A utility function based on this will return a full list of all local queue managers and their base directory name.

An MQSeries::Config::Machine object will cache the parsed configuration file for efficiency, but will check the timestamp of the file at every lookup. Should the file change, it will be re-parsed, so that up-to-date information is always returned.



Create a new MQSeries::Config::Machine object. The constructor takes an optional filename parameter, used when your configuration file is not at the default location of /var/mqm/mqs.ini.


Return an array with all stanza names. These can then be used as a parameter to lookup.


Lookup a stanza in the configuration file. Depending on the context, this returns either an array with one entry for each instance of the stanza found, or the latest stanza with that name. Each entry is a hash-reference with key-value pairs. For example, using $conf-lookup('QueueManager')> returns an array with one hash-reference for each locally-defined queue manager; each hash-reference will contain a 'Name' and 'Directory' field and whatever other fields the configuration file will contain.


A convenience function written on top of lookup. This function returns a hash-reference mapping local queue manager names to configuration settings.




MQSeries(3), MQSeries::Config::QMgr