http://qs321.pair.com?node_id=649904

bschmer has asked for the wisdom of the Perl Monks concerning the following question:

At my place of employment, we have a several "command interpreters" that take a files such as
command1 param1=value1 param2=value2 command2 param3=value3 param4=value4
or even
parallel { command1 param1=value1 param2=value2 command2 param3=value3 param4=value4 }
there are some other constructs in the "language" but those are the basics. The problem is that I'd like to be able to intersperse Perl amongst the commands such that I can have "scripts" such as
command1 param1=value1 param2=value2 <?perl if ($last_command_status == FAIL){ ?> debugging_command debug_param1=debug_value1 <?perl } ?> command2 param1=value1 param2=value2
without changing the format of files that don't have embedded Perl code.

The more complex of the interpreter uses Parse::RecDescent but I'd like to avoid pulling all of the Perl syntax into the interpreter. I've also poked around with Filter::Simple to wrap the non-perl lines by calls to subroutines to handle things but it doesn't "feel" right.

How would you handle this situation?