SEARCH
NEW RPMS
DIRECTORIES
ABOUT
FAQ
VARIOUS
BLOG

BotDetect - Real-Time Bot Detection API
 
 

MAN page from Old RedHat 6.X perl-RPC-Simple-0.5-6.i386.rpm

Simple::AnyLocal

Section: User Contributed Perl Documentation (3)
Updated: perl 5.005, patch 03
Index 

NAME

RPC::Simple::AnyLocal - Perl extension defining a virtual SRPC client class 

SYNOPSIS

 package MyLocal ;
 use RPC::Simple::AnyLocal; use vars qw($VERSION @ISA @RPC_SUB) ; @ISA = qw(RPC::Simple::AnyLocal [other_class] ); @RPC_SUB = qw(remoteHello remoteAsk);
 sub new  {    my $type = shift ;
    my $self = {} ;    my $remote =  shift ;    bless $self,$type ;
    $self->createRemote($remote,'your_class_name') ;    return $self ;  }
 # Note that the 'remoteHello' method is not part of MyLocal
 package main;
 use Tk ; use RPC::Simple::Server ; use RPC::Simple::Factory ;
 my $pid = &spawn ; # spawn server if needed  # client part my $mw = MainWindow-> new ; my $verbose = 1 ;
 # create factory my $factory = new RPC::Simple::Factory($mw,\$verbose) ; my $local = new MyLocal($factory) ; $mw -> Button (text => 'quit', command => sub {exit;} ) -> pack ; $mw -> Button (text => 'remoteAct',   command => sub {$local->remoteHello();} ) -> pack ;
 MainLoop ; # Tk's
 

DESCRIPTION

This class must be inherited by a sub-class so this one can use the RPC facility.

Note that this class (and the Factory class) was designed to use Tk's fileevent facilities.

The child object must declare in the @RPC_SUB array the name of the methodsavailable on the remote side. 

Methods

 

createRemote(factory_object_ref, [remote_class_name], ... )

This method should be called by the child object during start-up. It willask the SRPC factory to create a ClientAgent class dedicated to this new object.

The server on the other side of the socket will load the code necessaryfor the remote class. By default the remote class name will be ...::Real<LocalClass>. I.e if your local class is Test::Foo the remoteclass name will be Test::RealFoo.

If the remote class name has no prefix, `.pm' will be appended to get thefile name to load

The remaining parameters will passed to the remote object's new methodduring its creation.

returns self. 

destroy()

Objects derived from AnyLocal must be explicitely destroy. If you just undefthe object reference, you will not release the memory and the remote objectwill not be destroyed. 

AUTOLOAD()

When this method is called (generally through perl mechanism), the call willbe forwarded with all parameter to the remote object. If the first parametersis : \&one_callback

the function &one_callback will be called when the remote side has finishedits function.

If you want to call-back an object method, use a closure. Such as

 $self->remote_method(sub {$self-> finished(@_)})
Note that if the remote method name is not declared in the @RPC_SUB array, AnyLocal will try to autoload this method.

returns self. 

instance variable

AnyLocal will create the following instance variables: 

_twinHandle

Will contains the ref of the RPC::Simple::Agent object. 

remoteHostName

Will contains the name of the remote host. 

Inheritance and Autoload

Since RPC::Simple uses the AUTOLOAD subroutine to delegate unknown calls to the remote class, you must pay attention if you use or inherit classes which use the AutoLoader mechanism.

The AUTOLOAD defined in this class will first check if the called functionis declared in the @RPC_SUB arrays of all inherited classes. If yes it will call the remote function. If not it will forward the call to the AutoLoader::AUTOLOAD routine. In this case you fall back on the usualAutoLoad mechanism.

For this scheme to work, it is important that RPC::Simple::AUTOLOAD is runBEFORE the AutoLoader::AUTOLOAD routine.

So when inheriting from RPC::Simple and another class (say Foo::Bar), you mustput RPC::Simple::AnyLocal BEFORE your class in the @ISA array.

For instance, you must declare :@ISA = qw(RPC::Simple::AnyLocal Foo::Bar);

BTW, if you are mixing autoloading, remote calls and inheritance, which is a recipe for a good headache, you really (I mean it) should use subroutinestubs for the auloaded functions. (It does really work better).See AutoLoad(3). 

AUTHOR

Dominique Dumont, Dominique_DumontAATTgrenoble.hp.com 

SEE ALSO

perl(1), RPC::Simple::Factory(3), RPC::Simple::AnyRemote(3)


 

Index

NAME
SYNOPSIS
DESCRIPTION
Methods
createRemote(factory_object_ref, [remote_class_name], ... )
destroy()
AUTOLOAD()
instance variable
_twinHandle
remoteHostName
Inheritance and Autoload
AUTHOR
SEE ALSO

This document was created byman2html,using the manual pages.
 
ICM Bot detect detector