writing sequential code in POE

jorge sanchez <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.