是否存在默认未安装 Perl 的 Unix 平台?
我正在答复一份需要大量文本处理的合同招标请求。 主要的麻烦是客户希望能够在任何 UNIX(HPUX、Solaris、AIX、FreeBSD)或 Linux(SLES、RHEL)平台上运行它,这可能会限制我使用的平台。 他们不想将安装额外的工具作为先决条件。
我在 Perl 和 awk 之间左右为难。 我知道 Perl 是处理文本的理想工具(而且我相当擅长),但是,在我输入需要 Perl 的 RFT 响应之前,我想查明是否有人在某个平台上运行默认情况下不安装 Perl。
在 RFT 中列出这些平台并让客户选择他们想要的方式会很方便。 我模糊地记得它在默认安装的 FreeBSD 上没有,也可能非 Linux 平台也没有它。
可以建议任何其他工具,但考虑到我对 Perl 和 awk 的熟悉程度,它们可能是候选名单上唯一的工具。
I am in the process of answering a request for tender on a contract that requires a decent amount of text processing. The main trouble is that the customer wants to be able to run this on any UNIX (HPUX, Solaris, AIX, FreeBSD) or Linux (SLES, RHEL) platform, which may constrain what I use to do it. They don't want to make the installation of extra tools a pre-requisite.
I'm torn between Perl and awk. I know that Perl is an ideal tool for processing text (and I'm reasonably adept at it) but, before I put in the RFT response that Perl will be required, I'd like to find out if anyone is running on a platform where Perl is not installed by default.
It'd be handy to list those platforms in the RFT and give the client the option of which way they want to go. I have a vague recollection that it's not on FreeBSD in the default install and it may also be that the non-Linux platforms also don't have it.
Any other tools can be suggested but, given my familiarity with Perl and awk, they'll probably be the only ones on the shortlist.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
虽然我猜测您提到的所有当前版本的操作系统都安装了 Perl,但当然会有一些旧版本没有安装 Perl。 您还应该意识到,即使像 awk 这样的工具也不会定期安装在非常旧的 UN*X 版本上,因为它和其他编程工具是可选的附加功能(需要额外付费)。 我记得在 Altos 系统中,甚至 TCP/IP 堆栈都是额外的成本项目,但想必您不会走那么远:-)
底线:如果您的应用程序确实需要 Perl,您应该检查一下它已安装(通过 Bourne shell 脚本 - 如果剧院不起作用,你就真的完蛋了),如果没有提供某种安装方法。
Although I would guess that all current versions of the operating systems you mention install Perl, there will of course be older versions around that didn't and haven't. You should also be aware that even tools like awk were not routinely installed on very old UN*X versions, as it and other programming tools were optional extras (at extra cost). I remember Altos systems where even the TCP/IP stack was an extra cost item, but presumably you won't be going that far back :-)
Bottom line: If your app really needs Perl you should check it is installed (via a Bourne shell script - if theat doesn't work you are really screwed) and if not provide some way of installing it.
不是所有的都有 Perl :)
not all has perl :)
您可以获得为几乎任何 UNIX 变体编译的 Perl 版本。 Perl 不必“安装”,但可以在应用程序的目录内运行。 我会将 Perl 与我的发行版捆绑在一起,这样您就可以确保运行相同的版本。
如果没有在目标操作系统上进行测试,那么编写完全跨平台的 shell 脚本是非常困难的。 如果您开发 awk 脚本,您可能会在 Linux 上使用 GNU 变体进行开发,它是 POSIX awk。 我经常在 Solaris 上配置开源软件包,并且我不断发现人们假设您运行的是现代版本的工具的问题。 例如,在 Solaris 上,bash 不是标准的 bourne shell (/bin/sh),并且 echo 不带任何参数。 如果您尝试使用 POSIX awk 进行编码,您可能会发现自己受到正则表达式库或过时约定的限制。
Perl 的艺术许可证允许您将其与您的程序捆绑在一起,只要您遵循一些简单的事情,例如保持版权完好无损。
You can get a version of Perl compiled for just about any unix variant. Perl doesn't have to be 'installed', but can run inside of your application's directory. I would bundle Perl with my distribution, so you can ensure you're running the same version.
It is very difficult to write a completely cross platform shell script, without testing on the target OS. If you develop an awk script, you are probably going to develop using the GNU variant on Linux, which is a superset of the POSIX awk. I'm often configuring opening source packages on Solaris, and I'm constantly finding issues where people assume your running a modern version of a tool. For example, on Solaris bash is not the standard bourne shell (/bin/sh), and echo does not take any parameters. If you do try to code with POSIX awk, you may find yourself limited by the regex library, or out dated conventions.
Perl's artistic license allows you to bundle it with your program, as long as you follow a couple of simple things like keeping the copyright in tact.
几乎每个 *nix(除了一些磁盘空间非常有限的)都安装了 Perl。 AFAIK,甚至是 FreeBSD。 以防万一,您可以使用 PAR::Packer。
Almost every *nix (except some for very limited disk space) has Perl installed. AFAIK, even FreeBSD. Just in case it isn't, you can transform Perl program into an executable that will not need perl with PAR::Packer.
如果客户端的计算机上没有 Perl,您始终可以使用 Par: :Packer 为该平台创建可执行文件。 这也意味着您不必担心使用模块,因为它们也将包含在可执行文件中。
If the client does not have Perl on their machines you can always use Par::Packer to create an executable for that platform. This also means that you don't have to worry about using modules, since they will be included in the executable as well.
即使 Perl 可能安装在几乎所有 *nix 平台上,它们也可能不是同一版本,所以要注意这一点。 由于需要在大多数 *nix 上运行,您只需使用 shell+ 实用程序进行编码即可。 对于解析文件,awk+shell 也可以完成这项工作。 您只需以“便携式”格式编写它即可。 检查 此了解更多信息
even if Perl might be installed on almost every *nix platforms, they might not be the same version , so be aware of this. With the requirement that it needs to works on most *nix, you can just code with shell+ utilities. For parsing files, awk+shell can do the job as well. you just have to write it in a "portable" format. check this out for more info