简体   繁体   English

如何在Perl中使用客户端和服务器传输哈希?

[英]How can I transfer a hash using client and server in Perl?

I just want to transfer (send or receive) a hash from client to server. 我只想从客户端向服务器传输(发送或接收)哈希。

Can you tell me which is a preferable way in Perl or can you suggest any CPAN modules? 你能告诉我在Perl中哪种方式更好吗?或者你能推荐任何CPAN模块吗?

You can encode the hash using JSON on the client side and send the encoded string to the server. 您可以在客户端使用JSON对哈希进行编码,并将编码后的字符串发送到服务器。

Then, decode the received string (again using JSON ) on the server side and you can get back your hash. 然后,在服务器端解码收到的字符串(再次使用JSON ),您可以取回您的哈希值。

See Storable and Data::Dumper . 请参阅StorableData :: Dumper Both are core modules. 两者都是核心模块。

插座模块?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM