On Fri, Nov 28, 2003 at 06:23:57PM -0600, Jay Strauss wrote:
> Hi,
> 
> I'd like to write a little poe script that will query a database table.  I'm
> using Class::DBI.  I saw some prebuilt components that use plain old DBI,
> but thats not really what i want.
> 
> I'd like to do something like:
> 
> - connect to some external server
> - read table continously (maybe once a second)
> - if I find something interesting in the table talk to the external server
> - meanwhile, do some other stuff with the external server
> 
> and I want to poll the database till I cancel the program
> 
> But I'm having sort of a hard time getting started.  Are there any examples
> of something like this I can look at?

I would use POE::Wheel::Run to start with.  Spawn off the database
poller to a separate process (it's probably the only way to cooperate
with Class::DBI at the moment).

It would inject messages back into the parent POE process as data
becomes available.  The parent would also be connected to the external
server.  As database messages arrive, they're used to trigger actions
with the external server.

The client in the parent process can also react to server messages, as
well as timers and other things.

http://poe.perl.org/?POE_Cookbook has examples of managing child
processes and talking to external servers.  Your application might start
out as a combination of two or more recipes.

-- 
Rocco Caputo - [EMAIL PROTECTED] - http://poe.perl.org/

Reply via email to