Hi, I've decided to skip the "Lurk before you leap" phase of list
membership, because I'm *not* a newbie.  I just want to interact with some
experts on this subject, so if you can bear with me, here I go!

I've just released my first CPAN module (Yay, me!),
POE::Component::DBIAgent.  It runs as a forked child process off of a POE
program, accepting queries and returning results via two-way pipe.  The
purpose, of course, is to have non-blocking DBI. (for those of you who have
no idea what POE is, it's a state-machine framework in Perl that provides
for multiple concurrent sessions running around a select-based event loop).

Now, my component, which isn't very POE-ish at all because of the way it's
invoked, is mainly a while() loop:

while (<>) {
   chomp;

   ####
   #### parse query/parameters
   ####

                ####
            #### run the query
                ####
            unless ( $self->{$id}->execute( @params ) ) {

                print "ERROR|", $self->{$id}->errstr, CRLF;

            } else {

                if ($self->{$id}{Active}) {
                ####
        #### Fetch rows and send them to parent process
                ####

                    while (defined ($row = $self->{$id}->fetchrow_arrayref)) {

                    }
                }

                # End of query
                print "$package|$state|EOF", CRLF;

            }
}


Now, my question is,
if my query execution barfs
(because, for example, I've restarted the database)

is there a "reasonably standard" formula for recovering and moving on?
Like,
"save what you were doing.  reconnect.  try the query again?"

Specifically, among you folks who discuss this, are there any code snippets
you use to handle that you're willing to share?

TIA

L8r,
Rob

Reply via email to