我正在寻找一个使用 JSON-RPC 的 API 的 Perl 客户端。为此使用的最佳模块是什么?使用 Mojolicious 可能/有效吗?
最佳答案
Mojolicious 具有非常好的 JSON 编码/解码功能,虽然以下示例并不完全是 JSON-RPC,但使其完全兼容很简单:
post '/prefetch' => sub {
my ($self) = @_;
my $post = $self->req->json;
my %row;
for my $key (qw(country state city district suburb address number complement latitude longitude)) {
$row{$key} = $post->{$key} if exists $post->{$key};
}
关于perl - 使用 JSON-RPC 协议(protocol)的 Perl Client to API 使用哪些模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14055316/