Eriam Schaffter > POE-Component-DBIx-MyServer-0.01_06 > POE::Component::DBIx::MyServer::Client

Download:
POE-Component-DBIx-MyServer-0.01_06.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Report a bug
Module Version: 0.01_06   Source   Latest Release: POE-Component-DBIx-MyServer-0.01_07

NAME ^

POE::Component::DBIx::MyServer::Client - A client connection to our server

DESCRIPTION ^

This class is instantiated each time a client connects to our PoCo::DBIx::MyServer.

It provides a system resolver for a few base mysql queries (select @version_comment ..).

It also provides the methods with which you can send data to the client, send ok and send errors.

SYNOPSYS ^

Then you can create various classes (that subclass the PoCo::DBIx::MyServer::Client class) that will behave as databases in your mysql server.

    package MyServer::HelloWorld;

    use POE;

    sub resolve_query {
        my ($self, $query) = @_;
        return 'hello_world_event';
    }

    sub hello_world_event {
        my ( $kernel, $session, $heap, $self ) = @_[ KERNEL, SESSION, HEAP, OBJECT];
        my $data = $_[ARG0];

        $self->send_results(['column1'], [['Hello World from a perl mysql DB !']]);
    }

    1;

In those classes you have to redefine the resolver method in which you can resolve queries to events name (by returning the event name). Then you implement events as methods (with special POE stuff, check the samples).

METHODS ^

send_results

This actually send results and columns name to the client.

send_ok

This send an ok to the client.

send_error

This returns an error to the client.

AUTHORS ^

Eriam Schaffter, eriam@cpan.org and original work done by Philip Stoev in the DBIx::MyServer module.

COPYRIGHT ^

This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.