The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Pots::Thread::MethodServer - Perl ObjectThreads server class for exposing classes to other threads.

SYNOPSIS

    use Pots::Thread::MethodServer;

    my $ms = Pots::Thread::MethodServer(cclass => 'Some::Class');
    $ms->start();

    my $cli = $ms->client();

    $cli->method1($arg1);
    $cli->method2();

    $ms->stop();

DESCRIPTION

This class starts a thread and exposes an object to other threads through a Pots::Thread::MethodClient object. Using that client object, you can call methods as if your were using a locally created object. All method calls are transparently forwarded to the server thread.

This class is a subclass of Pots::Thread.

METHODS

new (cclass => 'Some::Class')

Creates a new thread which will load and instantiate an object of class "Some::Class".

start ()

Following the behavior of the Pots::Thread class, you must call "start()" to start the server thread.

stop ()

Calling this method will stop the server thread.

client ()

This method returns an object of class Pots::Thread::MethodClient, which allows you to transparently call methods of the "Some::Class" object in the server thread.

AUTHOR and COPYRIGHT

Remy Chibois <rchibois at free.fr>

Copyright (c) 2004 Remy Chibois. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.