POE::Component::Server::MySQL - A MySQL POE Server
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.
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]]); }
Eriam Schaffter, eriam@cpan.org with original work done by Philip Stoev in the DBIx::MyServer module.
eriam@cpan.org
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.
This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.
To install POE::Component::Server::MySQL, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::Server::MySQL
CPAN shell
perl -MCPAN -e shell install POE::Component::Server::MySQL
For more information on module installation, please visit the detailed CPAN module installation guide.