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

Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門
lestrrat
 
Desenvolvendo em php cli
Desenvolvendo em php cliDesenvolvendo em php cli
Desenvolvendo em php cli
Thiago Paes
 

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 YAPC::Brasil 2009, POE

Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHP
Thomas Weinert
 
Puppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG editionPuppet for dummies - PHPBenelux UG edition
Puppet for dummies - PHPBenelux UG edition
Joshua Thijssen
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
som_nangia
 
Psgi Plack Sfpm
Psgi Plack SfpmPsgi Plack Sfpm
Psgi Plack Sfpm
wilburlo
 

Similar to YAPC::Brasil 2009, POE (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

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
Thiago Rondon
 
Dados abertos é inovação
Dados abertos é inovaçãoDados abertos é inovação
Dados abertos é inovação
Thiago Rondon
 
Provisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com JujuProvisionamento orquestrado nas nuvens com Juju
Provisionamento orquestrado nas nuvens com Juju
Thiago Rondon
 
introducción a la Red Latinoamericana
introducción a la Red Latinoamericanaintroducción a la Red Latinoamericana
introducción a la Red Latinoamericana
Thiago 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 governo
Thiago 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 brasileiros
Thiago 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
 

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

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 

Recently uploaded (20)

Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
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
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 

YAPC::Brasil 2009, POE

  • 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/