sub readDatacapture
{
debug("ENTERING READ DATACAPTURE FUNCTION");
my $dctFile = shift;
open INPUT, "<$dctFile";
my @output_string = ;
close INPUT;
#debug("\n\n");
foreach my $line(@output_string) {
if ( $line =~ /.*command.*/ ) {
#grab just the command itself
my @fields2 = split /=/, $line;
my $inlineCmd = @fields2[$#fields2] ;
$inlineCmd =~ s/\/\>//; #strip off trailing tag
$inlineCmd =~ s/\"//g; #strip off quotes
#print "XXX" . $inlineCmd . "XXX\n";
my @Results = `$inlineCmd 2>&1`;
my $Result = join ('', @Results);
chomp ($Result);
#remove the double substitution tags, since it maybe a normal inline that has substitution on it
$Result =~ s/\
$Result =~ s/\<\/substitution\>//;
#remove xml declaration that would normally come across an inline
$Result =~ s/\<\?xml.*\>?//;
#Now substitute result for inline command
print $Result;
#debug("The result of $inlineCmd ");
#debug("$Result");
}
else
{
#print " IN ELSE ========== > $line\n";
print $line;
#debug("$line");
}
}
#debug("\n\n");
debug("EXITING READ DATACAPTURE FUNCTIONNNNNNN");
}
No comments:
Post a Comment