Created
August 19, 2014 11:40
-
-
Save mudler/376f0539169a25e6e8d5 to your computer and use it in GitHub Desktop.
Symbol table inquiry for registering rpc calls
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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