Re: Loading inline states from a hash

Josh803316 <[email protected]>
Newsgroups gmane.comp.lang.perl.poe
Message-ID <[email protected]>
Well to answer my own question I saw this example:

POE::Session->create
(
package_states =>
## extract all subroutines that don't start with "__"
## and allocate them as states:
[ (__PACKAGE__) => [ do {
no strict 'refs';
grep { !/^__/ and defined &$_ } keys %{ __PACKAGE__ . "::" };
} ] ],
## pass args into _start:
args => [@_],
);

On Fri, May 1, 2009 at 12:58 PM, Josh803316 <[email protected]> wrote:

> If I want to call a single session with states loaded from a hash.....what
> is the best way to do this?
>
> inline_states => [
> _start => sub {},
> _stop => sub{},
> %subs
> ]
>
> inline_states => [
> _start => sub {},
> _stop => sub{},
> $key => $subs{$key}
> ]
>
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.