[Cascavel-pm] Conexão com mysql em daemon

Igor Sutton igor.sutton em gmail.com
Terça Janeiro 2 10:47:06 PST 2007


> Estou verificando um código de exemplo. Assim que tiver, eu posto.


Isto é um bom começo:

 use strict;
use warnings;

use POE qw(Wheel::FollowTail Component::Daemon);

my $FILENAME = 'input.txt';

POE::Component::Daemon->spawn( detach => 1, max_children => 3 );

POE::Session->create(
    inline_states => {
        _start => sub {
            my ( $kernel, $heap, $session ) = @_[ KERNEL, HEAP, SESSION ];
            $heap->{tail} = POE::Wheel::FollowTail->new(
                Filename   => $FILENAME,
                InputEvent => 'got_line',
            );
        },

        got_line => sub {
            my ( $kernel, $input ) = $_[ KERNEL, ARG0 ];
            print "got_line(): $input\n";
        },
    }
);

POE::Kernel->run();

Agora só falta implementar a conexão ao banco de dados :)

-- 
Igor Sutton Lopes <igor.sutton em gmail.com>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://mail.pm.org/pipermail/cascavel-pm/attachments/20070102/cbd9cc7d/attachment.html 


Mais detalhes sobre a lista de discussão Cascavel-pm