是否有一些小型 Perl 可以在大小很重要的嵌入式系统中使用?
是否有一些小型 Perl 可以在大小很重要的嵌入式系统中使用?
Is there some tiny perl that I can use in embedded system where the size would matter?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅 Simon Cozens 关于 Microperl 的文章。
另请参阅 README.micro:
根据大小限制,您可能不需要走那么远,只需使用
miniperl
(它是在编译perl
的过程中构建的)就足够了。See Simon Cozens' article on Microperl.
See also README.micro:
Depending on size constraints, you may not need to go that far, just using
miniperl
—which is built in the process of compilingperl
— might be enough.不想这么说,我可能会得到很多反对票,但是...
如果大小是一个问题,请选择 C。如果您想要 Perl 的特定功能,您会发现一个 C 库,通过一些搜索可以给出你类似的功能。
如果需要简单的脚本能力和快速周转,您可能应该获得能够运行 perl 的更大的 CPU 或尝试占用空间较小的语言,例如 Lua。
Hate to say it and I will probability get lots of down votes but ...
If size is a problem go with C. If there is a specific functionality you want from perl you will find a C library with a bit of searching that will give you similar functionality.
If easy script-ability and quick turn around is required may be you should get a larger CPU able to run perl or try a language with a smaller footprint like Lua.
现代 Perl 是一种用于快速创建问题解决方案的出色语言。
然而,它并不完全很小。
Perl 的早期版本有点小……谷歌搜索“16 位 perl”显示一些疯狂的人设法获得了 perl 版本 3 和 4 来编译 16 位 dos。
Perl 4 的源代码仍然在网络上流传,如果您确实需要,您可能可以重新创建那些人的工作,并使 Perl 在新的 16 位嵌入式系统上运行。
然而,这种古老的语言和现代 Perl 之间存在足够的差异,因此不值得这么麻烦。最明显的区别是包分隔符是
'
而不是::
,除此之外还有更多区别。我建议不要乱搞像 perl4 这样古老而神秘的东西,我建议只用现代 perl(最新版本 5.22)编写程序,然后用可移植的 C 或 C++ 重写它,并将其交叉编译到您的嵌入式系统。
我意识到原来的问题有点老了,但我想我应该为其他考虑在嵌入式系统上运行 perl 的人提供一个扩展的答案。
Modern Perl is a fantastic language for quickly creating solutions to problems.
However, it's not precisely tiny.
The earlier versions of perl were a bit smaller ... googling for "16 bit perl" shows that some crazy people managed to get versions 3 and 4 of perl to compile for 16 bit dos.
The source for perl 4 is still floating around the web, and if you really really needed to, you could probably recreate the work of those people, and make perl run on a new 16 bit embedded system.
However, there are enough differences between that ancient language and modern perl to make it not worth the trouble. The most visible difference is that the package separator was
'
instead of::
, and there are many more differences besides that.Instead of messing around with something as ancient and arcane as perl4, I would suggest just writing your program in modern perl (version 5.22 is the latest), and then rewrite it in portable C or C++ , and cross compile it to your embedded system.
I realize that the original question is a bit old, but I figured I'd provide an expanded answer for others considering running perl on embedded systems.