On 27-Jun-2001 Rocco Caputo wrote:
> On Tue, Jun 26, 2001 at 09:35:39PM -0400, [EMAIL PROTECTED] wrote:
>> The idea of POE scripting has been floating around for some time now.
>> Here are some other ideas on it.
>
> [...]
>
>> Another way of looking at this is to have semaphores between each
>> state.
>> () get_sequence (A)
>> (A) validate (B)
>> (B) create_dir (C)
>> (B) mail_buyer (C)
>> (B) mail_merchant (C)
>> (3C) send_response ()
>
> [...]
>
> It also looks like a makefile:
Oh cool!
> I guess ARG0 (the pseudo-heap) would be where all these steps
> accumulate information like the sequence, buyer, and merchant?
Yes.
> Anyway, I've attached some code.
Herm... interesting way of implementing this. And, instead of just a
delay() for each state, the state in question would call
$kernel->post($_[SENDER], 'finished')... But this would run into GC
problems. Or we could put in
if($kernel->call(...)) {
$kernel->yield('finished');
} else {
# requeue the event
}
But this would simply be polling....
I don't like the syntax, however. (I realise it's a first draft) I would
really like to see this implemented using a generalised object
interactions.
So, say we turn POE::Session->create inside out :
POE::Session::Script->create(
state1=>{inline=>sub {....},
prereq=>'$A==1',
postreq=>'$B=1',
},
state2=>{package=>'SomePackage',
prereq=>'$B==1',
postreq=>'$C=1',
},
state3=>{object=>$some_object,
prereq=>'$C==1',
},
args=>[.....]
);
But even here, I don't know what form prereq and postreq should really
have. I don't like coderefs (because they can't be serialised),
eval()ing strings of perl code seems wrong and inventing a whole new
scripting language is bad... *sigh* And then again, we need to find out
when a task is finished, so that we can scan all the prereqs. Also,
should it be possible to trigger a task in another script? EEP!
Let me hack some code.
-Philip