Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

poe::component::dbiagent::helper(3pm) [debian 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)

Check Out this Related Man Page

POE::Component::Connection::Keepalive(3pm)		User Contributed Perl Documentation		POE::Component::Connection::Keepalive(3pm)

NAME
POE::Component::Connection::Keepalive - a wheel wrapper around a kept-alive socket VERSION
version 0.271 SYNOPSIS
See the SYNOPSIS for POE::Component::Client::Keepalive for a complete working example. my $connection = $response->{connection}; $heap->{connection} = $connection; $connection->start( InputEvent => "got_input" ); delete $heap->{connection}; # When done with it. DESCRIPTION
POE::Component::Connection::Keepalive is a helper class for POE::Component::Client::Keepalive. It wraps managed sockets, providing a few extra features. Connection objects free their underlying sockets when they are DESTROYed. This eliminates the need to explicitly free sockets when you are done with them. Connection objects manage POE::Wheel::ReadWrite objects internally, saving a bit of effort. new Creates a new POE::Component::Connection::Keepalive instance. It accepts two parameters: A socket handle (socket) and a reference to a POE::Component::Client::Keepalive object to manage the socket when the connection is destroyed. my $conn = POE::Component::Connection::Keepalive->new( socket => $socket_handle, manager => $poe_component_client_keepalive, ); new() is usually called by a POE::Component::Client::Keepalive object. start Starts a POE::Wheel::ReadWrite object. All parameters except Handle for start() are passed directly to POE::Wheel::ReadWrite's constructor. Handle is provided by the connection object. start() returns a reference to the new POE::Wheel::ReadWrite object, but it is not necessary to save a copy of that wheel. The connection object keeps a copy of the reference internally, so the wheel will persist as long as the connection does. The POE::Wheel::ReadWrite object will be DESTROYed when the connection object is. # Asynchronous connection from Client::Keepalive. sub handle_connection { my $connection_info = $_[ARG0]; $_[HEAP]->{connection} = $connection_info->{connection}; $heap->{connection}->start( InputEvent => "got_input", ErrorEvent => "got_error", ); } # Stop the connection (and the wheel) when an error occurs. sub handle_error { delete $_[HEAP]->{connection}; } wheel Returns a reference to the internal POE::Wheel::ReadWrite object, so that methods may be called upon it. $heap->{connection}->wheel()->pause_input(); close Closes the connection immediately. Calls shutdown_input() and shutdown_output() on the wheel also. SEE ALSO
POE POE::Component::Client::Keepalive POE::Wheel::ReadWrite BUGS
None known. LICENSE
This distribution is copyright 2004-2009 by Rocco Caputo. All rights are reserved. This distribution is free software; you may redistribute it and/or modify it under the same terms as Perl itself. AUTHOR
Rocco Caputo <rcaputo@cpan.org> Special thanks to Rob Bloodgood. perl v5.14.2 2012-05-15 POE::Component::Connection::Keepalive(3pm)
Man Page