Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Invoking a pl file from a wft
abhishek_gupta
Hi,
I have written a perl file and I need to invoke this from my wft file. How can this be achieved?
Thanks,
Abhi
Find more posts tagged with
Comments
laj1
have written a perl file and I need to invoke this from my wft file. How can this be achieved?
The depends on what it is supposed to do for you and during which phase of the WFT processing you want to invoke it.
If you want it to be a workflow task, I suggest using an <external task>.
set a variable to contain the the entire command line. I do something like this.
$perlexec = "/path/to/iwperl";
$myperlcmd = "/path/to/my/perlscript.ipl -myswitches myparameters";
$mycmd = "$perlexec $myperlcmd";
$mycmdXML = "<qq(<command v=\'$od_cmd\' />);
Then down in the XML for the external task, between my <successors> and my <files> i have the following:
</successors>
__INSERT__($mycmdXML);
<files>
-----------------------------------
Now if all you want to do is run a script in the middle, perl gives you several ways to do that. Again, having your entire command in a variable is a good idea:
you can say:
system($mycmd);
or
`$mycmd`
or even use exec or open it on a pipe.
There's more than one way to do it.
Hope I've been helpful.
Len.
Len Jaffe
My Heart Is A Flower
Update your DevNet profile - let us know who you are!
Migrateduser
Take Interwoven's Workflow Developer class or go through the Tutorial in the manual. You can't learn how to write a workflow by osmosis.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
rollo
Seconded - I'd highly recommend the Workflow Developer class, sounds like you're at just the right point to take it.
abhishek_gupta
Thanks for the info..
I wrote the following ..
$perlexec = "$iwhome/iw-perl/bin/perl";
$myperlcmd = "$iwhome/local/config/wft/publish/write.pl test";
$mycmd = "$perlexec $myperlcmd";
And then I have an external task where I have put the following.
__INSERT__("<command v='$mycmd'/>");
The perl file which I have written executes fine. But this external task does not end and it does not transition to the next successor task.
Thanks,
Abhi
rollo
You probably need a callback in your Perl script.
$task->CallBack(0, "This is a comment");
Where the task is obtained from TeamSite::WFtask, and the (zero-based) number represents which successor you wish to execute. Incidentally, I believe IWOV recommends that you use their iwperl binary, and the standard for TeamSite Perl files is "filename.ipl".
Migrateduser
This should do the trick at the end of the perl file
$task->CallBack(0, "comment");
Migrateduser
Assuming he has created a variable called $task properly, this is potentially true, but based on some of his other posts he probably has more problems than that. You can't really say what the solution is without seeing his code.
Dave Smith
Sr. Software Engineer
Nike, Inc.
(503) 671-4238
DavidH.Smith@nike.com
abhishek_gupta
Well I got it! Created the ipl file and invoked it thru my WF too. Just a simple thing we have to do. Get the arguments correctly. Create the $task...and then callback.
my($wfid) = $ARGV[0];
my($taskid) = ($ARGV[1]);
my $task = new TeamSite::WFtask( $taskid ) ;
<the perl code goes here>
$task->CallBack(0, "Completed file writing");
Thanks for all the help, and ya..valuable suggestions!!
-Abhi