in reply to RPC.pm and using eval to make a dummy client stub

You could do this using an AUTOLOAD:
# assumes connection is first arg sub AUTOLOAD { (my $name = $AUTOLOAD) =~ s/.*:://; eval "sub $AUTOLOAD { shift()->rpc( '$name', \@_) }"; goto &$AUTOLOAD; }

update: removed debugging print statement, unnecessary variable.

Replies are listed 'Best First'.
(jeffa) 2Re: RPC.pm and using eval to make a dummy client stub
by jeffa (Bishop) on Jun 01, 2001 at 23:58 UTC
    I just wanted to remind that one should include a dummy DESTROY subroutine if AUTOLOAD is implemented, because Perl will call AUTOLOAD when the object goes out of scope, very wasteful unless the clean up code will be implemented in the AUTOLOAD method.

    Jeff

    R-R-R--R-R-R--R-R-R--R-R-R--R-R-R--
    L-L--L-L--L-L--L-L--L-L--L-L--L-L--