I am working on a Workflow which deploys DCRs attached to the workflow to Staging based on the value of LaunchDate item in that DCR itself. I want to call a Perl script that will go thru each DCR, parse it and push the value of LaunchDate item into an array and return the array to the workflow.
#!/iw-home/iw-perl/bin/iwperl
use TeamSite::WFtask;
use TeamSite::Config;
my $iwhome = TeamSite::Config::iwgethome();
my $area = $ARGV[2];
my $task = new TeamSite::WFtask($ARGV[1]);
my
@files;
my %LaunchDateTable;
if ($task->IsValid())
{
@files = $task->Getfiles();
for (my $i = 0; $i <
@files; $i++)
{
#system("$iwhome/bin/iwunlock", $area . "/" . $files[$i]);
print $files[$i];
$LaunchDateTable{'$files[$i]'} = &get_dcr_attr($files[$i]);
}
}
sub get_dcr_attr {
my ($dcr,$element_name) =
@_;
open(DCR, $dcr) or die("$! - Can't open DCR.Contact teamsite admin");
local $/=undef;
my $xml = <DCR>;
close DCR;
select STDOUT;
my $parser = TeamSite::XMLparser->new();
if (defined ($parser))
{
my $rootnode = $parser->parse($xml);
if (defined ($rootnode))
{
my $retvalue = $rootnode->value($element_name);
if (defined ($retvalue))
{
return $retvalue;
}
}
}
return 0;
}
How do I return %LaunchDateTable to the calling workflow?
Or is there any alternative way to do this?
Thanks