Re: writing sequential code in POE
Rocco Caputo <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
Would one of these work? http://search.cpan.org/~rcaputo/POE-1.006/lib/POE/Kernel.pm#run_one_timeslice http://search.cpan.org/~rcaputo/POE-1.006/lib/POE/Kernel.pm#run_while_SCALAR_REF -- Rocco Caputo - [email protected] On Jun 1, 2009, at 12:07, Josh803316 wrote: > Hopefully I'm reading your question correctly but if you need a way to > syncronously and sequnetially call things I believe you can use > "call": > > http://search.cpan.org/~rcaputo/POE-1.006/lib/POE/Kernel.pm#call_DESTINATION,_EVENT_NAME_ > [,_PARAMETER_LIST] > > On Mon, Jun 1, 2009 at 8:15 AM, jorge sanchez <[email protected]> > wrote: > >> Hi, >> >> I am writing a process spawner (utilizing POE::Wheel::Run) everything >> is OK but I also need >> to write sequential code and I simply don't know how to do that. The >> only way is to utilize >> the CALLER_STATE and call back the event which called another event. >> >> sub test >> { >> my ( $kernel, $heap, $caller_state ) = @_[ KERNEL, HEAP, >> CALLER_STATE ]; >> print "This is the test \n"; >> if ((defined $caller_state) and ($caller_state eq "test2")) { >> print "the caller state is $caller_state \n"; >> goto TEST; >> } >> $_[KERNEL]->yield("test2"); >> goto END; >> >> TEST: >> print "after the test2 \n"; >> >> END: >> } >> sub test2 >> { >> my ( $kernel, $heap ) = @_[ KERNEL, HEAP ]; >> #print $_[HEAP]{'test'}; >> print "This is the test2 \n"; >> >> $_[KERNEL]->yield("test"); >> >> >> } >> >> >> Is this the only way how to do that or is there any other way? >> >> >> Regards, >> >> Jorge >>