SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.
SlideShare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.
Successfully reported this slideshow.
Activate your 14 day free trial to unlock unlimited reading.
18.
Un programma tipico
• Istanzia una o più sessioni
• Esplicitamente, eventualmente usando
delle Wheel
• Implicitamente, con Componenti già
pronti
• POE::Kernel->run()
POE - A Perl Object Environment
19.
sub POE::Kernel::TRACE_EVENTS() { 1 }
POE - A Perl Object Environment
21.
for ( 1 .. 3 ) {
POE::Session -> create(
inline_states => {
_start => sub { print quot;Start!nquot; },
_stop => sub { print quot;Stop!nquot; }
} );
}
POE - A Perl Object Environment
22.
POE::Kernel->run();
POE - A Perl Object Environment
23.
_start
Session
Kernel
POE - A Perl Object Environment
24.
_start
Session
_start =>
sub {
print quot;Start!nquot;
Kernel
}
POE - A Perl Object Environment
25.
Passaggio di messaggi
Accoda un evento, da inoltrare
post() alla session specificata
Accoda un evento, da inoltrare
yield() alla session stessa
Invoca - in maniera
sincrona - un evento per una
call()
sessione specificata
POE - A Perl Object Environment
26.
Passaggio di messaggi
post()/yield()
POE - A Perl Object Environment
27.
Passaggio di messaggi
call()
POE - A Perl Object Environment
28.
Comunicazione
tra sessioni
POE - A Perl Object Environment