Perl 的 C 翻译后端有什么用?
除了纯粹明显的:“它将 Perl 翻译为 C。”; Perl 编译器的优化 C 翻译后端 B::CC 在现实世界中是否有任何用途(又名黑客)?
Other than the purely obvious: "It translates Perl to C."; are there any real world uses (a.k.a. hacks) for the Perl compiler's optimized C translation backend, B::CC?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
并不真地。这意味着您可以将(小)Perl 脚本转换为(大)C 程序,这对于接收者来说将更难进行逆向工程。在某些偏执的圈子里,这可能被认为是一种优势(例如,如果您的 Perl 代码糟糕得令人尴尬,而您宁愿向付费客户隐瞒这一事实)。但大多数情况下它仅限于负值。
Not really. It means you can convert a (small) Perl script into a (big) C program, which will be much harder for the recipient to reverse engineer. In some paranoid circles, this might be accounted an advantage (for example, if your Perl code is embarrassingly bad and you'd rather conceal that fact from your paying customers). But mostly it is of limited to negative value.
将 Perl 程序编译为 Optree,然后可以执行,有时可能需要一段时间。您可以通过将 perlcc 与其任何后端一起使用来节省一些时间。这将以一种或另一种方式序列化已编译的 optree,并在稍后执行已编译的二进制文件时加载它,速度会更快一些。我可以看到它在例如 CGI 环境中很有用,但是对于这些环境,可以使用更好的替代方案来避免启动成本。
与流行的看法相反,perlcc 并不会让对生成的二进制文件进行逆向工程变得非常困难,如 如何对使用 perlcc 编译的 Perl 程序进行逆向工程?
Compiling a Perl program to an optree, which can then be executed, can take a while sometimes. You can safe some of that time by using perlcc with any of its backends. That'll, in one way or another, serialise the compiled optree and make loading it later, when executing your compiled binary, somewhat faster. I can see that being useful in, for example, CGI environments, for which, however, much better alternatives of avoiding startup costs are available.
Contrary to popular believe, perlcc doesn't make it very hard to reverse-engineer the resulting binary, as discussed in How can I reverse-engineer a Perl program that has been compiled with perlcc?