新的Snow Leopard用户的Perl策略? [英] Perl strategy for a new Snow Leopard user?

查看:93
本文介绍了新的Snow Leopard用户的Perl策略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将要购买一台新的iMac.这是我的第一台Intel Mac,大概会随Snow Leopard一起提供.其他用户会建议什么作为在此计算机上安装和使用perl的正确策略?

I'm about to get a new iMac. It's my first Intel mac and will presumably come with Snow Leopard. What would other users recommend as the right strategy for installing and using perl on this machine?

我知道我读过一些有关Leopard附带的Perl版本(或CPAN版本?)的投诉,尽管快速的google并没有提出太多建议.

I know I've read some complaints about the version of Perl (or was it the version of CPAN?) shipped with Leopard, although a quick google isn't coming up with much.

我假设一个好的策略是不让系统perl自己安装自己的系统,但是您会使用什么呢? Fink,Macports,也许是Mac的XAMPP?

I'm assuming that a good strategy is to leave the system perl alone and install my own, but what would you use? Fink, Macports, maybe XAMPP for Mac?

对于以前从未在Intel Mac上使用过Perl的人有什么特别的陷阱吗?

Are there any particular gotchas for someone who hasn't used Perl on Intel macs before?

我不是一个真正的开发人员,但是我有很多实用程序脚本和MySQL数据库应用程序,它们都将在我想保留的旧机器上运行,而我的主要工作是Web开发.

I'm not exactly a power developer, but I have quite a few utility scripts and MySQL database applications which run on my old machine I'm going to want to keep, and my main work is web development.

推荐答案

在使用Mac OS X和perl多年之后,我提出了一个简单的三部分计划:

After many years of using Mac OS X and perl, I've come up with a simple three-part plan:

  • 从源代码编译
  • /usr/local
  • 中安装
  • 切勿触摸系统perl
  • Compile from source
  • Install in /usr/local
  • Never touch the system perl

学习.知道.住吧.

哦,好的,我会尽力解释.由于我希望这是显而易见的原因,因此完全不谈系统Perl是一个坏主意. Apple的应用程序,第三方应用程序和OS本身期望系统perl的行为类似于系统perl,有时完全类似于系统perl.仅举一个例子,iTunes安装程序有时包含一个perl脚本,其中包含如下代码:

Oh, alright, I'll try to explain. Touching the system perl at all is a bad idea for what I hope are obvious reasons. Apple's applications, third-party applications, and the OS itself expect the system perl to behave like the system perl—sometimes exactly like the system perl. To give just one example, at one point an iTunes installer included a perl script that contained code like this:

if ($foo EQ $bar) {
    ....
}

是,EQ,而不是eq.信不信由你,它实际上可以在许多旧版本的perl中工作,但在我年轻的naiveté的系统版本之上安装的新版本的perl中却无法使用.结果是我双击iTunes安装程序,实际上什么也没发生. (嘿,它可能更糟.)

Yes, EQ rather than eq. Believe it or not, that actually works in many older version of perl—but not in the new version of perl I'd installed on top of the system version in my youthful naiveté. The result was that I'd double-click on the iTunes installer and literally nothing would happen. (And hey, it could have been a lot worse.)

我们可以谈论一下当时苹果显然曾经编写过perl代码的猴子(而且现在质量还更好),但是最重要的是/System是Apple的领域. 尝试在该处着陆. (多么热门).

We can talk about the kinds of monkeys Apple apparently had writing perl code back then (and wether the quality is any better now) but the bottom line is that /System is Apple's domain. Attempt no landing there. (How topical.)

另一方面,苹果公司长期以来一直承诺不将任何东西放入/usr/local中,同样重要的是,在系统更新期间不要触摸任何东西.这是您的安全区.在此处安装perl,CPAN模块所需的库等.

On the other hand, Apple has a longstanding promise not to ever put anything in /usr/local, and just as importantly, not to touch anything that's there during system updates. This is your safe zone. Install your perl there, your libraries required by CPAN modules there, etc.

最后,为什么要从源代码构建?为什么不使用包管理器?这似乎就像脾气暴躁的老人的推理,但我更喜欢将其视为来之不易的智慧".没有适用于Mac OS X的主流软件包管理系统,更不用说正式的/内置的了.所有各种第三方软件包管理器都与我使用过的每个软件包管理器都存在相同的问题:有时没有打包您想要的软件,有时没有按照您想要的方式打包,有时只是被破坏了等等.除了从源代码构建一些软件之外,尝试安装软件包也是灾难的根源.

Finally, why build from source? Why not use a package manager? This may just seem like Grumpy Old Man reasoning, but I prefer to think of it as Hard-Won Wisdom. There is no one dominant package management system for Mac OS X, let alone an official/built-in one. All of the various third-party package managers come with the same problems as every package manager I've used: sometimes the software you want isn't packaged, sometimes it's not packaged the way you want it to be, sometimes it's just plain broken, etc. And trying to install packages in addition to building some software from source is a recipe for disaster.

唯一可行的统一"方法是从源头构建所有内容.如今,几乎所有常用的Unix软件都可以在Mac OS X上构建,而无需付出任何特殊的努力. (这有助于许多Unix开发人员现在使用Mac OS X作为其个人系统.)通常只需解压缩,配置,进行和进行安装.您甚至很少需要指定/usr/local作为目的地;这是大多数软件的默认设置.

The only viable "unified" approach is to build everything from source. These days, nearly all commonly used Unix software builds on Mac OS X without any special effort. (It helps that so many Unix developers now use Mac OS X as their personal systems.) It's usually just untar, configure, make, make install. You rarely even need to specify /usr/local as the destination; it's the default for most software.

因此,您已具备:从源代码进行编译.在/usr/local中安装.切勿触摸系统perl.你不会后悔的.

So there you have it: Compile from source. Install in /usr/local. Never touch the system perl. You won't regret it.

这篇关于新的Snow Leopard用户的Perl策略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆