PoCo Generic packages question
Josh803316 <[email protected]>
| Newsgroups | gmane.comp.lang.perl.poe |
|---|---|
| Message-ID | <[email protected]> |
If I'm wrapping a long running module with poco generic(see below), how do I
access the "packages" methods?
$heap->{$alias} = POE::Component::Generic->spawn(
package => 'LongRunning::Test',
alias => $alias,
object_options => [ 'long_running_options' => 1 ],
methods => [ qw( create_message send)],
packages => {
'Other::Module' => {
# only these methods are exposed
methods => [ qw( other_method ) ],
},
},
);
Example based on the code above:
1)I wrap LongRunning::Test which has methods (create_message send_message)
inside of $heap->{$alias} and then call create message.
$heap->{$alias}->create_message( {event=>'send_message',alias => $alias},
'param', 'param2', { id => 1 } );
2)After create message returns I jump to send_message,
I call $heap->{$alias}->send( {event=> 'next_step', alias => $alias}
);.........now I return from send message to the registered event next_step
3)Inside of next_step Is there any way to call a method
Other::Package->other_method with $heap->{$alias}->other_method
*I guess I'm confused on what packages are........underneath the main
wrapped package.....and how I access the methods of those wrapped packages.
(From the docs does Other::Package mean a sub package of Net::Telnet or does
it mean I'm just wrapping two different long running packages)
packages => {
'Net::Telnet' => {
# Methods that require coderefs, and keep them after they
# return.
# The first arg is converted to a coderef
postbacks => { option_callback=>0 }
},
'Other::Package' => {
# only these methods are exposed
methods => [ qw( one two ) ],
# Methods that require coderefs, but don't keep them
# after they return
callbacks => [ qw( two ) ]
}
}