user role creation in WFA--Perl


I want ot create the User role using the Perl in the WFA.I have written below code..but getting the error..

Can't locate object method "child_add" via package "WFAUtil" at ./ line 22, <STDIN> line 1.

My code is...


use strict;

use warnings;

use  NaServer;

use Getopt::Long;

use WFAUtil;

our $array;our $server;our $vfiler;our $RoleName;our $comment;our $CapaName;our $api;

GetOptions("array=s" => \$array,

                 "RoleName" => \$RoleName,

                       "comment"   =>  \$comment,

                       "CapaName"  =>  \$CapaName

             ) or die "Illigal Options";

if(!  defined $array){ die "Array Name/ip Address is mendatory";}

my $wfautil=WFAUtil->new();

$wfautil->sendLog('INFO','Connecting to array:',$array);


my $api = WFAUtil->new('useradmin-role-add');

my $xi = WFAUtil->new('useradmin-role');


my $xi2 = WFAUtil->new('allowed-capabilities');

my $xi1->child_add($xi2);

my $xi3 = WFAUtil->new('useradmin-capability-info');





my $xi4=$wfautil->checkFailure("Failed to run the command",$server->invoke($api));

$wfautil->sendLog('INFO','Create the role for the user failed'.$array);

Re: user role creation in WFA--Perl

This should work, however it only adds one capability and I have not figured out how loop it correctly to add more than one capability...


use strict;

use NaServer;

use Getopt::Long;

use WFAUtil;

my $array;

my $vfiler;

my $rolename;

my $comment;

my $capabilities;

GetOptions("array=s" => \$array,

          "vfiler:s" => \$vfiler,

                 "rolename:s" => \$rolename,

                       "comment:s"   =>  \$comment,

                       "capabilities:s"  =>  \$capabilities

             ) or die 'Illegal command parameters';

#my @capabilitieslist = split(',', $capabilities);

my $wfaUtil = WFAUtil->new();

$wfaUtil->sendLog('INFO','Connecting to array: '.$array);

my $server = $wfaUtil->connect($array, $vfiler);

my $add = new NaElement('useradmin-role-add');

my $role = new NaElement('useradmin-role');


my $roleinfo = new NaElement('useradmin-role-info');




my $allowed = new NaElement('allowed-capabilities');


my $capainfo1 = new NaElement('useradmin-capability-info');



$wfaUtil->sendLog('INFO','Creating Role Name : '.$rolename);

my $out = $server->invoke_elem($add);

if ( $out->results_status() eq "failed" )


                              $wfaUtil->sendLog('WARN',"Unable to add role '".$rolename."'. Reason: ".$out->results_reason());