poe::component::dbiagent::queue(3pm) [debian man page]
DBIAgent::Queue(3pm) User Contributed Perl Documentation DBIAgent::Queue(3pm)NAME
POE::Component::DBIAgent::Queue -- Helper class for managing a round-robin queue of Po:Co:DBIAgent:Helper's.
SYNOPSIS DESCRIPTION
Methods
This are the methods we recognize:
init
init the queue (currently noop)
add append argument to the queue
clear
Clear the queue
find_by_pid
Find the index of helper with specified pid
find_by_wheelid
Find the index of helper with specified wheel id
remove_by_pid
Remove helper with specified pid
remove_by_wheelid
Remove helper with specified wheel id
next
Get next helper off the head of the queue (and put it back on the end (round robin))
make_next
Force the helper with the specified wheel id to the head of the queue.
exit_all
Tell all our helpers to exit gracefully.
kill_all
Send the specified signal (default SIGTERM) to all helper processes
AUTHOR
This module has been fine-tuned and packaged by Rob Bloodgood <robb@empire2.com>. However, most of the code came directly from Fletch
<fletch@phydeaux.org> and adapted for the release of POE::Component::DBIAgent. Thank you, Fletch!
However, I own all of the bugs.
This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2008-01-18 DBIAgent::Queue(3pm)
Check Out this Related Man Page
DBIAgent::Helper(3pm) User Contributed Perl Documentation DBIAgent::Helper(3pm)NAME
POE::Component::DBIAgent::Helper - DBI Query Helper for DBIAgent
SYNOPSYS
use Socket qw/:crlf/;
use POE qw/Filter::Line Wheel::Run Component::DBIAgent::Helper/;
sub _start {
my $helper = POE::Wheel::Run ->new(
Program => sub {
POE::Component::DBIAgent::Helper->run($self->{dsn},
$self->{queries}
);
},
StdoutEvent => 'db_reply',
StderrEvent => 'remote_stderr',
ErrorEvent => 'error',
StdinFilter => POE::Filter::Line->new(),
StdoutFilter => POE::Filter::Line->new( Literal => CRLF),
StderrFilter => POE::Filter::Line->new(),
)
or carp "Can't create new DBIAgent::Helper: $!
";
}
sub query {
my ($self, $query, $package, $state, @rest) = @_;
$self->{helper}->put(join '|', $query, $package, $state, @rest);
}
sub db_reply {
my ($kernel, $self, $heap, $input) = @_[KERNEL, OBJECT, HEAP, ARG0];
# $input is either the string 'EOF' or a Storable object.
}
DESCRIPTION
This is our helper routine for DBIAgent. It accepts queries on STDIN, and returns the results on STDOUT. Queries are returned on a row-
by-row basis, followed by a row consisting of the string 'EOF'.
Each row is the return value of $sth->fetch, which is an arrayref. This row is then passed to Storable for transport, and printed to
STDOUT. HOWEVER, Storable uses newlines ("
") in its serialized strings, so the Helper is designed to use the "network newline" pair CR
LF as the line terminator for STDOUT.
When fetch() returns undef, one final row is returned to the calling state: the string 'EOF'. Sessions should test for this value FIRST
when being invoked with input from a query.
Initialization
The Helper has one public subroutine, called "run()", and is invoked with two parameters:
The DSN
An arrayref of parameters to pass to DBI->connect (usually a dsn, username, and password).
The Queries.
A hashref of the form Query_Name => "$SQL". See POE::Component::DBIAgent for details.
BUGS
I have NO idea what to do about handling signals intelligently. Specifically, under some circumstances, Oracle will refuse to acknowledge
SIGTERM (presumably since its libraries are non-reentrant) so sometimes SIGKILL is required to terminate a Helper process.
AUTHOR
This module has been fine-tuned and packaged by Rob Bloodgood <robb@empire2.com>. However, most of the code came directly from Fletch
<fletch@phydeaux.org>, either directly (Po:Co:DBIAgent:Queue) or via his ideas. Thank you, Fletch!
However, I own all of the bugs.
This module is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
perl v5.10.1 2008-01-18 DBIAgent::Helper(3pm)