On 10/13/2011 02:59 PM, Sean Carolan wrote:
> Hello friends:
>
> Could someone post a simple example of how to access the XMLRPC
> interface using perl? I'm able to do this just fine with Python but
> would also like to be able to do it with Perl as well. The example
> given on this page uses a session token, which I'd like to avoid:
>
> http://fedorahosted.org/cobbler/wiki/CobblerXmlrpc
Wow, perl SOAP::SOM seems pretty confusing, especially with the data returned
by cobbler. But perhaps this will get you started:
#!/usr/bin/perl
use strict;
use XMLRPC::Lite;
use Data::Dumper;
# Build the connection
my $xmlrpc = XMLRPC::Lite -> proxy('http://x.x.x/cobbler_api');
# Get the distros- return a SOM object
my $som = $xmlrpc->get_distros();
# This will return an array of the entries
my $params = $som->valueof('//params/param');
foreach my $distro (@$params) {
print $distro->{'name'} . "\n";
print Dumper($distro);
}
The dumper output will show you the other hash keys available in $distro.
--
Orion Poplawski
Technical Manager 303-415-9701 x222
NWRA/CoRA Division FAX: 303-415-9702
3380 Mitchell Lane [email protected]
Boulder, CO 80301 http://www.cora.nwra.com
_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler