Subscribe

Writing WFA commands to invoke existing Perl scripts

I'm considering various WFA design options for a customer. Over several years this customer has developed a number of Perl scripts which perform functions (provisioning volumes, qtrees, exports, security, etc.). We now want to bring the functionality of those scripts into the WFA environment. One approach would be to clone copies of these Perl scripts and bring them into the WFA environment as WFA Perl commands by re-factoring the code with WFA parameter definitions up front and then invoke them through WFA workflows as normal WFA Perl commands. An alternative approach would be to just write new small wrapper WFA commands in Perl and have these new WFA commands call/invoke the existing Perl scripts as they stand without modification. This seems the more modular and hence preferred option.

However, these scripts request user input values by asking questions and receiving user input via STDIN (I haven't looked at code yet but I have seen documentation describing such). I'm wondering if anyone here can advise if invoking and controlling these scripts will be possible within the context of a WFA Perl command. I believe in a normal UNIX/Perl environment the solution to this issue would be to use the Expect tool to invoke the Perl script as a sub-process and pass parameters using Expect mechanisms. Is that same, or similar, capability possible inside a WFA Perl command? Is Expect built in or would that have to be downloaded and installed to the WFA server? Are there special instructions for installing Perl modules on the WFA server so they are available to the WFA Perl command environment?

Re: Writing WFA commands to invoke existing Perl scripts

@However, these scripts request user input values by asking questions and receiving user input via STDIN

===

WFA runs in non-interactive mode. So an interactive session of user-inputs is not possible.

@I'm wondering if anyone here can advise if invoking and controlling these scripts will be possible within the context of a WFA Perl command. I believe in a normal UNIX/Perl environment the solution to this issue would be to use the Expect tool to invoke the Perl script as a sub-process and pass parameters using Expect mechanisms.

===

Looks definitely possible, but let me try it once to confirm this.

@Is Expect built in or would that have to be downloaded and installed to the WFA server?

=====

Expect module is not provided with WFA package, you need to get it from CPAN or some other source.

@Are there special instructions for installing Perl modules on the WFA server so they are available to the WFA Perl command environment?

====

Not absolutely certain but I don't think there are any special instructions. Downloading and Installing modules with Active Perl via ppm would have been very easy but WFA doesn't bundle the ppm. So either you need to download it manually and install it or use another perl like strawberry perl who provide cpan package manager.

If this post resolved your issue, help others by selecting ACCEPT AS SOLUTION or adding a KUDO.