CHAIN<%=$chain_num%>_EN [<%=$lsb%>:<%=$lsb++%>] = 1'h0;
Even the format spec document suggests this approach "wrap all non-Perl chunks with prints, leaving the code snippets as is, and let Perl evaluate the whole thing".
The reason a simple eval() doesn't work is because there is Perl variable state that needs to be honored across the entire file (e.g. $lsb in the example above is set to 0 at the start and incremented a number of times through the file. Hence, we will need a full Perl process to evaluate the whole file.
In any case, after understanding the REPL issue, I broke up the processing into 2 sections:
* send the entire file to the Perl child process, and close the child's input filehandle
* then read back the generated output in a while loop
* if we encounter an "include" statement, then recursively restart the process with the new file.
This works perfectly. Thanks for all the suggestions.Pankaj
In reply to Re^4: Running Perl in an Expect loop
by StoneLeopard
in thread Running Perl in an Expect loop
by StoneLeopard
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |