I've released a Perl API for CIM over http(s)

Paul Robert Marino <[email protected]> Fri, 24 Aug 2012 00:13:02 -0400
Newsgroups gmane.network.open-pegasus.general
Message-ID <CAPJdpdCXkNJa7Lqkxd0v_EeWbJLqLwqPJ4meuFPeznSEXCjhug@mail.gmail.com>
Hello every one

I've been promising it for a long time and I've finally done it. I've
posted the first publicly available alpha version of LCP ( Lib CIM
Perl ).
its available on git hub here https://github.com/prmarino1/Lib-CIM-Perl

The current version implements the following methods from DSP0200

GetClass
GetInstance
DeleteClass
EnumerateClasses
EnumerateClassNames
EnumerateInstances
EnumerateInstanceNames
Associators
AssociatorNames
GetProperty

Eventually all other methods from DSP0200 will be implemented before
1.0 is completed.

It is capable of generating both simple and multirec queries, however
multirec queries have not been thoroughly tested beyond validation of
the XML against the XML schema due to the fact that the OpenPegasus
versions I've tested with don't support them.

it can post via POST or M-POST over http or https.

has incrementing sequence numbers for each post it sends.

last but not least has a quick and easy to use simple result parser.

Lib CIM Perl is built completely on top of LWP (Lib WWW Perl ) and
XML::Twig there are no additional libraries other than their
dependencies required.
Lib CIM Perl its self is written in pure Perl so there is no need to
install any C based CIM client libraries to use it.

Most of the testing so far has been against OpenPegasus

keep in mind this is an alpha version and the list of things to do
with it is as long as my arm, and some of the API will change soon,
however the API will stabilize shortly once I release  version 0.01.
I would appreciate any constructive feedback people are willing to
give prior to working on the next release



here is a little code sample for any one who is interested to get
started using it


use LCP;
  use Data::Dumper;
  my $options={
        'username'=>'username',
        'password'=>'passwd',
        'protocol'=>'http',
        'Method'=>'POST'
  };
  my $post_counter=0;
  print "setting up the agent\n";
  my $agent=LCP::Agent->new('localhost',$options);
  print "setting up the session\n";
  my $session=LCP::Session->new($agent);
  print "constructing the query\n";
  my $test=LCP::Query->new();
  $test->EnumerateClasses('root/cimv2');
  print "posting the query\n";
  my $post=LCP::Post->new($session,$test);
  if (defined $post and $post->{'Result'}->is_success){
        print "post executed\n";
        print "@{[$post->{'Result'}->decoded_content]}\n";
        my $parser=LCP::SimpleParser->new($post->get_raw_xml);
        my $tree=$parser->buildtree;
        print Dumper($tree) . "\n";
  }