NAME
POE::Component::Server::MySQL - A MySQL POE Server
DESCRIPTION
This modules helps building a MySQL proxy in which you can write handler to deal with specific queries.
You can modifiy the query, write a specific response, relay a query or do wahtever you want within each handler.
This is the evolution of POE::Component::DBIx::MyServer, it uses Moose and POE.
SYNOPSYS
First you create a server class that extends POE::Component::Server::MySQL.
package MyMySQL;
use Moose;
extends 'POE::Component::Server::MySQL';
with 'MooseX::Getopt';
Then in a perl script you can instantiate your new server
use MyMySQL;
my $server = MyMySQL->new_with_options();
$server->run;
In the MyMySQL namespace you can add roles which will act as handlers for your trapped queries:
package MyMySQL::OnSteroids;
use MooseX::MethodAttributes::Role;
sub fortune : Regexp('qr{fortune}io') {
my ($self) = @_;
my $fortune = `fortune`;
chomp($fortune);
$self->send_results(['fortune'],[[$fortune]]);
}
AUTHORS
Eriam Schaffter, eriam@cpan.org
with original work done by Philip Stoev in the DBIx::MyServer module.
BUGS
At least one, in specific cases the servers sends several packets instead of a single one. It works fine with most clients but it crashes Toad for MySQL for example.
COPYRIGHT
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.