Re: POE and DBI database question

[email protected] (Nick Perez) Thu, 17 Feb 2011 14:43:27 -0600
Newsgroups perl.poe
Message-ID <20110217144327.69219f1e@nicklaptop>
When the pre-packaged POE+DBI solutions don't work for you, you can
always spin up a child that talks to you via STDIN/STDOUT using
POE::Wheel::Run and performs the various DBI actions on your behalf.
Then define a simple command/reply interface using dumb hashes and
something like POE::Filter::Reference to transport between the child
and parent process.

And like Andy also said, you won't be able to deal with an ORM unless
you do some fancy footwork to serialize the data into a digestible
format and then reconstitute it across the process boundary. So you
could use DBIx::Class in the child to perform the specific queries for
you based on a set of parameterized Command objects you define. Then
use HashRefInflator on the results to build a Result object and send it
back down the wire.

Something like this:

Parent -> Command -> Filter -> | <- Filter <- Result <- Child
                               |
                        process boundary


On Thu, 17 Feb 2011 21:07:40 +0100
Markus Jansen <[email protected]> wrote:

> Hi POE experts,
>=20
> is there someone who has used POE in an asynchronous way with DBI,
> without the necessity to reinvent the wheel, with some example or
> recipe at hand?
>=20
> To illustrate my problem:
> PoCo::SimpleDBI looks nice, but I am not too sure how well this
> behaves inside a forking environment (prefork server).
> DBIx::Connector claims to be great on the prefork matter, but I don't
> see an asynchronous POE example or recipe somewhere. DBIx::Class
> claims to be even greater for non-SQL addicts, and seems to have some
> code in common with DBIx::Connector, but again I fail how to
> integrate that best into a POE environment ...
>=20
> Any hints / comments are highly welcome!
>=20
> Best regards,
>         Markus
>=20
>=20
>=20
>=20
> Markus Jansen
>=20
> Ericsson GmbH
> Eurolab R&D
> Ericsson Allee 1
> 52134 Herzogenrath, Germany
> Phone +49 2407 575 5157
> Fax +49 22407 575 150
> Mobile +49 172 2742003
> [email protected]
> www.ericsson.com
>=20
>=20
>=20
> Ericsson GmbH. Sitz: D=C3=BCsseldorf. Registergericht: Amtsgericht
> D=C3=BCsseldorf, HRB 33012. Gesch=C3=A4ftsf=C3=BChrer: Stefan Koetz (Vors=
.), Nils de
> Baar, Bernd Schmidt. Aufsichtsratsvorsitzender: Anders Runevad.
>=20
> This Communication is confidential. We only send and receive email on
> the basis of the terms set out at
> www.ericsson.com/email_disclaimer<http://www.ericsson.com/email_disclaime=
r>.
>=20
>=20


--=20

Nicholas Perez
XMPP/Email: [email protected]
http://search.cpan.org/~nperez/
http://github.com/nperez