Sewi has asked for the wisdom of the Perl Monks concerning the following question:
This doesn't really require perl but it is sufficent for demonstation of the problem:use MasterProgram; MasterProgram::output("Hello World!"); MasterProgram::waitOK(); MasterProgram::clear(); MasterProgram::output("foo bar");
My idea was: Split the Perl code in blocks at every blocking command (like waitOK) either manually or using PPI, store each script in an array. Every array element is a anonymus sub-ref to a block including the blocking command. For our example:
Every script gets one Hash ref for storing all run-time variables which need to survive the whole script. my-variables will end at the next blocking command.@Script = ( sub { MasterProgram::output("Hello World!"); MasterProgram +::waitOK(); }, sub {MasterProgram::clear(); MasterProgram::output("foo ba +r"); });
Question 1: Even if the concept is still in a very early stage and many things need to be considered... would it be possible?
Question 2: Is there an easier way?
Thank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl as embedded script language
by Anonymous Monk on Sep 05, 2009 at 00:52 UTC | |
|
Re: Perl as embedded script language
by salva (Canon) on Sep 05, 2009 at 08:41 UTC | |
by james2vegas (Chaplain) on Sep 05, 2009 at 09:11 UTC |