SlideShare a Scribd company logo
1 of 31
Download to read offline
POE
     Edgar Allan POE... POEtry ... Panel Of Experts ... Parallel Object Executor ... Parcel Out Execution ... Parenthetically Over-
   Engineered ... Parity Of Evil ... Part Of Elephant ... Particles Of Eternity ... Party On, Ebenezer ... Passed Out from Excitement ...
     Pathetically Over-Engineered ... Peace On Earth ... People Of Earth ... Perfect Orange Eater ... Perfectly Oblique Eggplant ...
  Periodically Orbits Earth ... Perl Obfuscation Engine ... Perl Object Environment ... Perl Objects for Enterprises ... Perl Objects for
Events ... Perl On Extasy ... Perl Operating Environment ... Perl Operator Extravaganza ... Perl Over Easy ... Perl Over Ethernet ... Perl
    Overdrive Engine ... Perl, Objects and Events ... Perl: Objectively Excellent ... Perlmud Offers Expansions ... Perpetual Orgone
      Energy ... Persistent Object Environment ... Persnickity Oblong Erudition ... Perversely Oriented Entities ... Philanthropic
Organization Enterprises ... Physician Order Entry ... Piece Of Eden ... Piece Of Eight ... Pigs, Owls, and Elephants ... Piles Of Eugh ...
 Pious Object Excelsior ... Piracy Over Ethernet ... Pissed Off Elephants ... Plain Old English ... Plastic Orbs Everywhere ... Platonic
 Object Engine ... Plenty Of Everything ... Plucky Object Engine ... Poe Oracle Environment ... Poe Organizes Everything ... Poe Over
    Earth ... Point Of Entry ... Polyolester ... Port of Embarkment ... Portal Of Evil ... Possibly Over-Engineered ... Post-Occupancy
Evaluation ... Potatoes Of Eternity ... Potentially Omnipotent Entity ... Pow! Oof! Eek! ... Power Operating Environment ... Power Over
  Ethernet ... Practical Over Extraction ... Practically Overengineered Environment ... Preponderance of Evidence ... Preserve Our
 Essences ... Pretty Obelisk, Excavated ... Pretty Obfuscation Engine ... Pretty Obtuse Engine ... Pretty Odd Environment ... Price Of
   Entity ... Princess On Ecstasy ... Probable Obese Elephant ... Product Of Experts ... Products Of Eccentricity ... Prognosis: Over-
 Engineered ... Program Office Estimate ... Programming Over Easy ... Proliferation Of Events ... Prolifically Over-Eaten ... Purity Of
                                                    Essence ... Purveyor Of Everything ...



                                            YAPC::Brasil::2009
                                             Thiago Rondon
FRAMEWORK
EVENT DRIVEN
MULTITASKING
FORKING &
THREADING ?
AD-HOC EVENTS
DISTRIBUTED
PROGRAMMING
     ::IKC
TESTED SYSTEM
1998-2000.........
GROWING
TOOLBOX
Layer 3    POE::Component

                POE::
                                  Layer 2
          [Wheel,Filter,Driver]


              POE::Session
Layer 1
              POE::Kernel
COMPONENT         POE::Kernel

            Disparador de eventos,
  WHEEL
            POE::Loop::Select

 SESSION    Singleton

            Post & yield
 KERNEL
            Timers
COMPONENT       POE::Session


  WHEEL      Responde aos eventos

            $_[OBJECT]
            $_[SESSION]
 SESSION
            $_[HEAP]
            $_[STATE]
 KERNEL     $_[SENDER]
            $_[ARG0..ARG9]
COMPONENT             POE::Wheel

             “Plugins” para a sessão.
  WHEEL      Encapsular conjuntos de
            manipuladores de eventos.

 SESSION    #Exemplo: POE::Wheel::Run
            #Executa um programa ou um conjunto de
            código em um subprocesso usando fork() e
            troca informações pelo stdin, stdout, stderr.
 KERNEL
COMPONENT   POE::Component

            564 componentes no
  WHEEL     CPAN até ontem.
            (30/Outubro/2009)

 SESSION     POE::Component::IRC,
             POE::Component::Server::Radius
             POE::Component::Server::TCP
             POE::Component::Server::HTTP
             POE::Component::Github
 KERNEL      POE::Component::Jabber
             (...)
ESTUDO DE
  CASOS
“Ping Múltiplo”
use POE;
use POE::Component::Client::Ping;
my @addresses = qw(200.219.201.245
200.219.201.246 200.219.201.247);

POE::Component::Client::Ping->spawn(
    Alias => 'pinger',
    Timeout => 5,                SESSION
);

POE::Session->create(          COMPONENT
    inline_states => {
        _start => &client_start,
        pong => &client_got_pong,
    }
);
sub client_start {
    my ($kernel, $session) =
      @_[KERNEL, SESSION];
    print "Starting to ping hosts.n";

    foreach my $address (@addresses) {
        $kernel->post(
          pinger => ping => pong => $address);
    }
}
sub client_got_pong {
    my ($kernel, $session) = @_[KERNEL, SESSION];
    my $request_packet = $_[ARG0];
    my ($request_packetest_address, $request_timeout, $request_time) =
        @{$request_packet};
    my $response_packet = $_[ARG1];
    my ($response_address, $roundtrip_time, $reply_time) =
        @{$response_packet};

    if (defined $response_address) {
        printf("Pinged %-15.15s - Response from %-15.15s in %6.3fsn",
            $request_address, $response_address, $roundtrip_time);
    }
    else {
        print "Time's up for responses from $request_address.n";
    }
}
KERNEL




$poe_kernel->run();
IRC
#!/usr/bin/perl
use warnings;
use strict;
use POE;
use POE::Component::IRC;

my ($irc) = POE::Component::IRC->spawn();

POE::Session->create(
   inline_states => {
     _start     => &bot_start,
     irc_001    => &on_connect,
     irc_public => &on_public,
   },
);
#!/usr/bin/perl
use warnings;                 COMPONENT
use strict;
use POE;
use POE::Component::IRC;

my ($irc) = POE::Component::IRC->spawn();

POE::Session->create(
   inline_states => {
     _start     => &bot_start,
     irc_001    => &on_connect,
     irc_public => &on_public,
   },
);
#!/usr/bin/perl
use warnings;                      SESSION
use strict;
use POE;
                              COMPONENT
use POE::Component::IRC;

my ($irc) = POE::Component::IRC->spawn();

POE::Session->create(
   inline_states => {
     _start     => &bot_start,
     irc_001    => &on_connect,
     irc_public => &on_public,
   },
);
COMPONENT
sub bot_start {
  $irc->yield(register => "all");
   $irc->yield(
    connect => {
      Nick      => 'maluco_yapc',
      Username => 'maluco',
      Ircname => 'YAPC Brasil 2009',
      Server    => 'irc.perl.org',
      Port      => '6667',
    }
  );
}
COMPONENT




sub on_connect {
  $irc->yield(join => “#yapcbrasil”);
}
KERNEL        COMPONENT

sub on_public {
  my ($kernel, $who, $where, $msg) =
             @_[KERNEL, ARG0, ARG1, ARG2];
  my $nick    = (split /!/, $who)[0];
  my $channel = $where->[0];
  my $ts      = scalar localtime;
  print " [$ts] <$nick:$channel> $msgn";
  if (my ($response) = $msg =~ /^$nick (.+)/) {
    $irc->yield(privmsg => $channel,
                           “estamos aqui.“);
  }
}
KERNEL




$poe_kernel->run();
Rocco Caputo
http://poe.perl.org
Obrigado!
            Thiago Rondon
            thiago@aware.com.br
            http://www.aware.com.br/

More Related Content

What's hot

Getting Started with iBeacons (Designers of Things 2014)
Getting Started with iBeacons (Designers of Things 2014)Getting Started with iBeacons (Designers of Things 2014)
Getting Started with iBeacons (Designers of Things 2014)Daniel Luxemburg
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansiblebcoca
 
What's New in PHP 5.5
What's New in PHP 5.5What's New in PHP 5.5
What's New in PHP 5.5Corey Ballou
 
Web Audio API + AngularJS
Web Audio API + AngularJSWeb Audio API + AngularJS
Web Audio API + AngularJSChris Bateman
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門lestrrat
 
QConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações WebQConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações WebFabio Akita
 
Isolated development in python
Isolated development in pythonIsolated development in python
Isolated development in pythonAndrés J. Díaz
 
EuroPython 2015 - Decorators demystified
EuroPython 2015 - Decorators demystifiedEuroPython 2015 - Decorators demystified
EuroPython 2015 - Decorators demystifiedPablo Enfedaque
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0bcoca
 
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)Péhápkaři
 
Asynchronous Systems with Fn Flow
Asynchronous Systems with Fn FlowAsynchronous Systems with Fn Flow
Asynchronous Systems with Fn FlowJosé Paumard
 
Desenvolvendo em php cli
Desenvolvendo em php cliDesenvolvendo em php cli
Desenvolvendo em php cliThiago Paes
 
AST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaAST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaStephen Vance
 
Remote Notifications
Remote NotificationsRemote Notifications
Remote NotificationsJosef Cacek
 
Ethiopian multiplication in Perl6
Ethiopian multiplication in Perl6Ethiopian multiplication in Perl6
Ethiopian multiplication in Perl6Workhorse Computing
 

What's hot (20)

Getting Started with iBeacons (Designers of Things 2014)
Getting Started with iBeacons (Designers of Things 2014)Getting Started with iBeacons (Designers of Things 2014)
Getting Started with iBeacons (Designers of Things 2014)
 
Hacking ansible
Hacking ansibleHacking ansible
Hacking ansible
 
What's New in PHP 5.5
What's New in PHP 5.5What's New in PHP 5.5
What's New in PHP 5.5
 
Web Audio API + AngularJS
Web Audio API + AngularJSWeb Audio API + AngularJS
Web Audio API + AngularJS
 
Perl 6 by example
Perl 6 by examplePerl 6 by example
Perl 6 by example
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門
 
Elixir cheatsheet
Elixir cheatsheetElixir cheatsheet
Elixir cheatsheet
 
C to perl binding
C to perl bindingC to perl binding
C to perl binding
 
QConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações WebQConSP 2015 - Dicas de Performance para Aplicações Web
QConSP 2015 - Dicas de Performance para Aplicações Web
 
Isolated development in python
Isolated development in pythonIsolated development in python
Isolated development in python
 
EuroPython 2015 - Decorators demystified
EuroPython 2015 - Decorators demystifiedEuroPython 2015 - Decorators demystified
EuroPython 2015 - Decorators demystified
 
Ansible leveraging 2.0
Ansible leveraging 2.0Ansible leveraging 2.0
Ansible leveraging 2.0
 
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
 
Asynchronous Systems with Fn Flow
Asynchronous Systems with Fn FlowAsynchronous Systems with Fn Flow
Asynchronous Systems with Fn Flow
 
Desenvolvendo em php cli
Desenvolvendo em php cliDesenvolvendo em php cli
Desenvolvendo em php cli
 
AST Rewriting Using recast and esprima
AST Rewriting Using recast and esprimaAST Rewriting Using recast and esprima
AST Rewriting Using recast and esprima
 
Remote Notifications
Remote NotificationsRemote Notifications
Remote Notifications
 
Get your teeth into Plack
Get your teeth into PlackGet your teeth into Plack
Get your teeth into Plack
 
ssh.isdn.test
ssh.isdn.testssh.isdn.test
ssh.isdn.test
 
Ethiopian multiplication in Perl6
Ethiopian multiplication in Perl6Ethiopian multiplication in Perl6
Ethiopian multiplication in Perl6
 

Viewers also liked (9)

I can cook
I can cookI can cook
I can cook
 
IOTA
IOTAIOTA
IOTA
 
I can cook
I can cookI can cook
I can cook
 
OGP: You, Me and Opendata
OGP: You, Me and OpendataOGP: You, Me and Opendata
OGP: You, Me and Opendata
 
Statim, time series interface for Perl.
Statim, time series interface for Perl.Statim, time series interface for Perl.
Statim, time series interface for Perl.
 
I cancook
I cancookI cancook
I cancook
 
You, me and Opendata - v2
You, me and Opendata - v2You, me and Opendata - v2
You, me and Opendata - v2
 
Meet jhojana
Meet jhojanaMeet jhojana
Meet jhojana
 
I can cook
I can cookI can cook
I can cook
 

Similar to POE: Perl Object Environment

Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hopeMarcus Ramberg
 
Buildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mindBuildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mindDylan Jay
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHPThomas Weinert
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionJoshua Thijssen
 
Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?Tushar Sharma
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Masahiro Nagano
 
Deploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard WayDeploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard WayAsko Soukka
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpmsom_nangia
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpmwilburlo
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perldeepfountainconsulting
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStackBram Vogelaar
 
PHP Performance Trivia
PHP Performance TriviaPHP Performance Trivia
PHP Performance TriviaNikita Popov
 

Similar to POE: Perl Object Environment (20)

Plack - LPW 2009
Plack - LPW 2009Plack - LPW 2009
Plack - LPW 2009
 
PSGI/Plack OSDC.TW
PSGI/Plack OSDC.TWPSGI/Plack OSDC.TW
PSGI/Plack OSDC.TW
 
Mojolicious - A new hope
Mojolicious - A new hopeMojolicious - A new hope
Mojolicious - A new hope
 
Plack at YAPC::NA 2010
Plack at YAPC::NA 2010Plack at YAPC::NA 2010
Plack at YAPC::NA 2010
 
New in php 7
New in php 7New in php 7
New in php 7
 
Buildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mindBuildout: How to maintain big app stacks without losing your mind
Buildout: How to maintain big app stacks without losing your mind
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHP
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
 
Does your configuration code smell?
Does your configuration code smell?Does your configuration code smell?
Does your configuration code smell?
 
Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015Rhebok, High Performance Rack Handler / Rubykaigi 2015
Rhebok, High Performance Rack Handler / Rubykaigi 2015
 
Deploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard WayDeploying Plone and Volto, the Hard Way
Deploying Plone and Volto, the Hard Way
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
infra-as-code
infra-as-codeinfra-as-code
infra-as-code
 
Asynchronous programming patterns in Perl
Asynchronous programming patterns in PerlAsynchronous programming patterns in Perl
Asynchronous programming patterns in Perl
 
Puppet and the HashiStack
Puppet and the HashiStackPuppet and the HashiStack
Puppet and the HashiStack
 
PHP Performance Trivia
PHP Performance TriviaPHP Performance Trivia
PHP Performance Trivia
 
How to ride a whale
How to ride a whaleHow to ride a whale
How to ride a whale
 

More from Thiago Rondon

AppCívico - Tecnologias cívicas estão impactando políticas públicas
AppCívico - Tecnologias cívicas estão impactando políticas públicasAppCívico - Tecnologias cívicas estão impactando políticas públicas
AppCívico - Tecnologias cívicas estão impactando políticas públicasThiago Rondon
 
Democracia nas eleições
Democracia nas eleiçõesDemocracia nas eleições
Democracia nas eleiçõesThiago Rondon
 
IOTA - Open Indicators of Transparency and Accountability
IOTA - Open Indicators of Transparency and AccountabilityIOTA - Open Indicators of Transparency and Accountability
IOTA - Open Indicators of Transparency and AccountabilityThiago Rondon
 
Dados abertos é inovação
Dados abertos é inovaçãoDados abertos é inovação
Dados abertos é inovaçãoThiago Rondon
 
YAPC::2014 Accountability
YAPC::2014 AccountabilityYAPC::2014 Accountability
YAPC::2014 AccountabilityThiago Rondon
 
Provisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com JujuProvisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com JujuThiago Rondon
 
introducción a la Red Latinoamericana
introducción a la Red Latinoamericanaintroducción a la Red Latinoamericana
introducción a la Red LatinoamericanaThiago Rondon
 
TDC 2012 - You, Me and Opendata
TDC 2012 - You, Me and Opendata TDC 2012 - You, Me and Opendata
TDC 2012 - You, Me and Opendata Thiago Rondon
 
Opendata - Não posso fazer tijolos sem barro !
Opendata - Não posso fazer tijolos sem barro !Opendata - Não posso fazer tijolos sem barro !
Opendata - Não posso fazer tijolos sem barro !Thiago Rondon
 
Dados abertos do wikipedia ao governo
Dados abertos do wikipedia ao governoDados abertos do wikipedia ao governo
Dados abertos do wikipedia ao governoThiago Rondon
 
Para onde foi o meu dinheiro ?
Para onde foi o meu dinheiro ?Para onde foi o meu dinheiro ?
Para onde foi o meu dinheiro ?Thiago Rondon
 
Datos abiertos, Gobierno y la sociedad en conjunto.
Datos abiertos, Gobierno y la sociedad en conjunto.Datos abiertos, Gobierno y la sociedad en conjunto.
Datos abiertos, Gobierno y la sociedad en conjunto.Thiago Rondon
 
OpenData-BR, [Captando] Dados públicos brasileiros
OpenData-BR, [Captando] Dados públicos brasileirosOpenData-BR, [Captando] Dados públicos brasileiros
OpenData-BR, [Captando] Dados públicos brasileirosThiago Rondon
 
Net::RabbitMQ(::Simple)
Net::RabbitMQ(::Simple)Net::RabbitMQ(::Simple)
Net::RabbitMQ(::Simple)Thiago Rondon
 
Cache, Concorrência e Sincronização.
Cache, Concorrência e Sincronização.Cache, Concorrência e Sincronização.
Cache, Concorrência e Sincronização.Thiago Rondon
 
HTTP, Requisição e Resposta
HTTP, Requisição e RespostaHTTP, Requisição e Resposta
HTTP, Requisição e RespostaThiago Rondon
 

More from Thiago Rondon (20)

AppCívico - Tecnologias cívicas estão impactando políticas públicas
AppCívico - Tecnologias cívicas estão impactando políticas públicasAppCívico - Tecnologias cívicas estão impactando políticas públicas
AppCívico - Tecnologias cívicas estão impactando políticas públicas
 
Democracia nas eleições
Democracia nas eleiçõesDemocracia nas eleições
Democracia nas eleições
 
IOTA - Open Indicators of Transparency and Accountability
IOTA - Open Indicators of Transparency and AccountabilityIOTA - Open Indicators of Transparency and Accountability
IOTA - Open Indicators of Transparency and Accountability
 
Dados abertos é inovação
Dados abertos é inovaçãoDados abertos é inovação
Dados abertos é inovação
 
YAPC::2014 Accountability
YAPC::2014 AccountabilityYAPC::2014 Accountability
YAPC::2014 Accountability
 
Docker
DockerDocker
Docker
 
Auto Scaling AWS
Auto Scaling AWSAuto Scaling AWS
Auto Scaling AWS
 
Provisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com JujuProvisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com Juju
 
introducción a la Red Latinoamericana
introducción a la Red Latinoamericanaintroducción a la Red Latinoamericana
introducción a la Red Latinoamericana
 
Iota
IotaIota
Iota
 
TDC 2012 - You, Me and Opendata
TDC 2012 - You, Me and Opendata TDC 2012 - You, Me and Opendata
TDC 2012 - You, Me and Opendata
 
Onde Acontece ?
Onde Acontece ?Onde Acontece ?
Onde Acontece ?
 
Opendata - Não posso fazer tijolos sem barro !
Opendata - Não posso fazer tijolos sem barro !Opendata - Não posso fazer tijolos sem barro !
Opendata - Não posso fazer tijolos sem barro !
 
Dados abertos do wikipedia ao governo
Dados abertos do wikipedia ao governoDados abertos do wikipedia ao governo
Dados abertos do wikipedia ao governo
 
Para onde foi o meu dinheiro ?
Para onde foi o meu dinheiro ?Para onde foi o meu dinheiro ?
Para onde foi o meu dinheiro ?
 
Datos abiertos, Gobierno y la sociedad en conjunto.
Datos abiertos, Gobierno y la sociedad en conjunto.Datos abiertos, Gobierno y la sociedad en conjunto.
Datos abiertos, Gobierno y la sociedad en conjunto.
 
OpenData-BR, [Captando] Dados públicos brasileiros
OpenData-BR, [Captando] Dados públicos brasileirosOpenData-BR, [Captando] Dados públicos brasileiros
OpenData-BR, [Captando] Dados públicos brasileiros
 
Net::RabbitMQ(::Simple)
Net::RabbitMQ(::Simple)Net::RabbitMQ(::Simple)
Net::RabbitMQ(::Simple)
 
Cache, Concorrência e Sincronização.
Cache, Concorrência e Sincronização.Cache, Concorrência e Sincronização.
Cache, Concorrência e Sincronização.
 
HTTP, Requisição e Resposta
HTTP, Requisição e RespostaHTTP, Requisição e Resposta
HTTP, Requisição e Resposta
 

Recently uploaded

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Recently uploaded (20)

Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

POE: Perl Object Environment

  • 1. POE Edgar Allan POE... POEtry ... Panel Of Experts ... Parallel Object Executor ... Parcel Out Execution ... Parenthetically Over- Engineered ... Parity Of Evil ... Part Of Elephant ... Particles Of Eternity ... Party On, Ebenezer ... Passed Out from Excitement ... Pathetically Over-Engineered ... Peace On Earth ... People Of Earth ... Perfect Orange Eater ... Perfectly Oblique Eggplant ... Periodically Orbits Earth ... Perl Obfuscation Engine ... Perl Object Environment ... Perl Objects for Enterprises ... Perl Objects for Events ... Perl On Extasy ... Perl Operating Environment ... Perl Operator Extravaganza ... Perl Over Easy ... Perl Over Ethernet ... Perl Overdrive Engine ... Perl, Objects and Events ... Perl: Objectively Excellent ... Perlmud Offers Expansions ... Perpetual Orgone Energy ... Persistent Object Environment ... Persnickity Oblong Erudition ... Perversely Oriented Entities ... Philanthropic Organization Enterprises ... Physician Order Entry ... Piece Of Eden ... Piece Of Eight ... Pigs, Owls, and Elephants ... Piles Of Eugh ... Pious Object Excelsior ... Piracy Over Ethernet ... Pissed Off Elephants ... Plain Old English ... Plastic Orbs Everywhere ... Platonic Object Engine ... Plenty Of Everything ... Plucky Object Engine ... Poe Oracle Environment ... Poe Organizes Everything ... Poe Over Earth ... Point Of Entry ... Polyolester ... Port of Embarkment ... Portal Of Evil ... Possibly Over-Engineered ... Post-Occupancy Evaluation ... Potatoes Of Eternity ... Potentially Omnipotent Entity ... Pow! Oof! Eek! ... Power Operating Environment ... Power Over Ethernet ... Practical Over Extraction ... Practically Overengineered Environment ... Preponderance of Evidence ... Preserve Our Essences ... Pretty Obelisk, Excavated ... Pretty Obfuscation Engine ... Pretty Obtuse Engine ... Pretty Odd Environment ... Price Of Entity ... Princess On Ecstasy ... Probable Obese Elephant ... Product Of Experts ... Products Of Eccentricity ... Prognosis: Over- Engineered ... Program Office Estimate ... Programming Over Easy ... Proliferation Of Events ... Prolifically Over-Eaten ... Purity Of Essence ... Purveyor Of Everything ... YAPC::Brasil::2009 Thiago Rondon
  • 10. Layer 3 POE::Component POE:: Layer 2 [Wheel,Filter,Driver] POE::Session Layer 1 POE::Kernel
  • 11. COMPONENT POE::Kernel Disparador de eventos, WHEEL POE::Loop::Select SESSION Singleton Post & yield KERNEL Timers
  • 12. COMPONENT POE::Session WHEEL Responde aos eventos $_[OBJECT] $_[SESSION] SESSION $_[HEAP] $_[STATE] KERNEL $_[SENDER] $_[ARG0..ARG9]
  • 13. COMPONENT POE::Wheel “Plugins” para a sessão. WHEEL Encapsular conjuntos de manipuladores de eventos. SESSION #Exemplo: POE::Wheel::Run #Executa um programa ou um conjunto de código em um subprocesso usando fork() e troca informações pelo stdin, stdout, stderr. KERNEL
  • 14. COMPONENT POE::Component 564 componentes no WHEEL CPAN até ontem. (30/Outubro/2009) SESSION POE::Component::IRC, POE::Component::Server::Radius POE::Component::Server::TCP POE::Component::Server::HTTP POE::Component::Github KERNEL POE::Component::Jabber (...)
  • 15. ESTUDO DE CASOS
  • 17. use POE; use POE::Component::Client::Ping; my @addresses = qw(200.219.201.245 200.219.201.246 200.219.201.247); POE::Component::Client::Ping->spawn( Alias => 'pinger', Timeout => 5, SESSION ); POE::Session->create( COMPONENT inline_states => { _start => &client_start, pong => &client_got_pong, } );
  • 18. sub client_start { my ($kernel, $session) = @_[KERNEL, SESSION]; print "Starting to ping hosts.n"; foreach my $address (@addresses) { $kernel->post( pinger => ping => pong => $address); } }
  • 19. sub client_got_pong { my ($kernel, $session) = @_[KERNEL, SESSION]; my $request_packet = $_[ARG0]; my ($request_packetest_address, $request_timeout, $request_time) = @{$request_packet}; my $response_packet = $_[ARG1]; my ($response_address, $roundtrip_time, $reply_time) = @{$response_packet}; if (defined $response_address) { printf("Pinged %-15.15s - Response from %-15.15s in %6.3fsn", $request_address, $response_address, $roundtrip_time); } else { print "Time's up for responses from $request_address.n"; } }
  • 21. IRC
  • 22. #!/usr/bin/perl use warnings; use strict; use POE; use POE::Component::IRC; my ($irc) = POE::Component::IRC->spawn(); POE::Session->create( inline_states => { _start => &bot_start, irc_001 => &on_connect, irc_public => &on_public, }, );
  • 23. #!/usr/bin/perl use warnings; COMPONENT use strict; use POE; use POE::Component::IRC; my ($irc) = POE::Component::IRC->spawn(); POE::Session->create( inline_states => { _start => &bot_start, irc_001 => &on_connect, irc_public => &on_public, }, );
  • 24. #!/usr/bin/perl use warnings; SESSION use strict; use POE; COMPONENT use POE::Component::IRC; my ($irc) = POE::Component::IRC->spawn(); POE::Session->create( inline_states => { _start => &bot_start, irc_001 => &on_connect, irc_public => &on_public, }, );
  • 25. COMPONENT sub bot_start { $irc->yield(register => "all"); $irc->yield( connect => { Nick => 'maluco_yapc', Username => 'maluco', Ircname => 'YAPC Brasil 2009', Server => 'irc.perl.org', Port => '6667', } ); }
  • 26. COMPONENT sub on_connect { $irc->yield(join => “#yapcbrasil”); }
  • 27. KERNEL COMPONENT sub on_public { my ($kernel, $who, $where, $msg) = @_[KERNEL, ARG0, ARG1, ARG2]; my $nick = (split /!/, $who)[0]; my $channel = $where->[0]; my $ts = scalar localtime; print " [$ts] <$nick:$channel> $msgn"; if (my ($response) = $msg =~ /^$nick (.+)/) { $irc->yield(privmsg => $channel, “estamos aqui.“); } }
  • 31. Obrigado! Thiago Rondon thiago@aware.com.br http://www.aware.com.br/