Skip to content

Instantly share code, notes, and snippets.

@mudler
Created August 19, 2014 11:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mudler/376f0539169a25e6e8d5 to your computer and use it in GitHub Desktop.
Save mudler/376f0539169a25e6e8d5 to your computer and use it in GitHub Desktop.
Symbol table inquiry for registering rpc calls
sub register_rpc {
my $symbol = { eval( '%' . caller . "::" ) };
my @RPC_PUBLIC;
foreach my $entry ( keys %{$symbol} ) {
no strict 'refs';
if ( defined &{ caller . "::$entry" } ) {
push( @RPC_PUBLIC, $entry ) if $entry =~ /^\_/;
}
}
use strict 'refs';
caller->register_rpc_method_names(@RPC_PUBLIC);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment