My updated code works for single inputs and for all but planning to extend this functionality by accepting comma seperated values. Need help with this. Thanks in advance!
host();
my $it=1;
my %appHash=();
if($it == 1){
open(INPUTFILE,"<Services.conf")or die("unable to Services fiel");
while (<INPUTFILE>) {
chomp;
push @svcArray, (split /:/, $_, 3)[2];
}
foreach my $svc (@svcArray){
$appHash{it} = $svc;
print "\n\t\t\t$it. $appHash{$it}\n";
$size = $it;
$it++;
}
print "\n";
print "\t\t\tA for All \n";
print "Please choose a number from the list above: ";
chop($input=<STDIN>);
$input=trim($input);
print " The input after chopping:$input\n";
}
my $appCmnStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><env:Envelo
+pe xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\">
<env:Body> <oos:req xmlns:oos=\"http:
+//www.ecomm.com\">;
send_svc($input);
exit(0);
#################
sub send_svc{
my @aArray;
if(@_[0] && (lc @_[0] ne 'z')){
@aArray = (@_[0]);
}else{
@aArray= (1 .. $size);
}
foreach $svcObjNum (@aArray){
if($appHash{$svcObjNum}){
$appsStr = $appsStr."<oos:obj class=\"$appHash{$svcObjNum}"/>";
}
}
from here I concatenate the XML lines and make a post to service. All working well for single input or z which is for all. But need some assistance how can I achieve this for multiple input values comma or space separated. With the fact that need to from those XML lines based on the options users select and then post it to my service
On console it looks like below option
1. Recruitment
2. Payments
3. Retail
4. Legal
z. all
Please choose a number from the list above:
|