I have do some example about POE;
but about this point on $_
OBJECT parameter, i can't know clear.
i make a baozi.pm, contains a object:
package baozi;
sub new{
my $class = shift;
my $self = bless {}, $class;
}
sub fun1{
my $self = shift;
print "fun1......baozi \n"
}
1
then try the $_
OBJECT in other pl,
use POE;
use baozi;
POE::Session->create(
inline_states => {
_start => sub { $_[KERNEL]->yield('next1')},
next1 => sub {
print "tick ... \n";
$_[KERNEL]->delay(next2 => 1);
},
next2 => \&next2,
next3 =>\&baozi,
},
);
POE::Kernel->run();
sub next2{
print "tick 0 ... \n";
$_[KERNEL]->yield('next3');
}
sub baozi{
my $self = $_[OBJECT];
print $self;
$self->baozi::fun1();
}
I think 'next2' call 'next3' handler, and run sub baozi.$self->baozi::fun1(); can call package baozi's fun1.
but I know my thinking is wrong, plz tell me more right, and help me understand $_
OBJECT, thank you.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.