Learning Perl: 1.3. How Can I Get Perl?

Previous Page

Next Page

 

1.3. How Can I Get Perl?

You probably already have it. At least,we find Perl wherever we go. It ships with many systems,and system administrators often install it on every machine at their site. If you can't find it on your system,you can get it free.

Perl is distributed under two different licenses. For most people who use Perl,either license is adequate. If you'll be modifying Perl,however,you'll want to read the licenses more closely because of the small restrictions on distributing the modified code. For people who won't modify Perl,the licenses say,"It's freehave fun with it."

So,it's free and runs rather nicely on nearly everything that calls itself Unix and has a C compiler. You download it,type a command or two,and it starts configuring and building itself. Better yet,get your system administrator to type those two commands and install it for you.[*] Besides Unix and Unix-like systems,people have become addicted enough to Perl to port it to other systems,like the Macintosh,[*] VMS,OS/2,MS/DOS,every modern species of Windows,and probably more by the time you read this.[

] Many of these ports of Perl come with an installation program that's easier to use than the process for installing Perl on Unix. Check for links in the "ports" section on CPAN.

[*] If system administrators can't install software,what good are they? If you have trouble convincing your admin to install Perl,offer to buy a pizza. We've never met a sys admin who could say no to a free pizza,or at least counteroffer with something as easy to get.

[*] MacPerl runs under the "classic" Mac OS. If you have Mac OS X,which is a Unix-based system,you have mainstream Perl.

[

] And no,as we write this,it won't fit in your Palm handheld. It's just too darn big,even stripped down. We've heard rumors that it runs on WinCE,though.

1.3.1. What Is CPAN?

CPAN is the Comprehensive Perl Archive Network,your one-stop shopping for Perl. It has the source code for Perl itself,ready-to-install ports of Perl to all sorts of non-Unix systems,[

] examples,documentation,extensions to Perl,and archives of messages about Perl. In short,CPAN is comprehensive.

[

] It's nearly always better to compile Perl from the source on Unix systems. Other systems may not have a C compiler or other tools needed for compilation,so CPAN has binaries for these.

CPAN is replicated on hundreds of mirror machines around the world. Start at http://search.cpan.org/ or http://kobesearch.cpan.org/ to browse or search the archive. If you don't have access to the Net,you might find a CD-ROM or DVD-ROM with all of the useful parts of CPAN on it. Check with your local technical bookstore. Look for a recently minted archive,though,since CPAN changes daily. An archive from two years ago is an antique. Better yet,get a kind friend with Net access to burn you one with today's CPAN.

1.3.2. How Can I Get Support for Perl?

Well,you get the complete source,so you get to fix the bugs yourself.

That doesn't sound so good,does it? But it is a good thing. Since there's no "source code escrow" on Perl,anyone can fix a bug. In fact,by the time you've found and verified a bug,someone else will probably have a fix for it. There are thousands of people around the world who help to maintain Perl.

Now,we're not saying that Perl has a lot of bugs,but it's a program,and every program has at least one bug. To see why it's so useful to have the source to Perl,imagine that instead of using Perl,you licensed a programming language called Forehead from a giant,powerful corporation owned by a zillionaire with a bad haircut. (This is all hypothetical. Everyone knows there's no such programming language as Forehead.) Now think of what you can do when you find a bug in Forehead. First,you can report it. Second,you can hopehopethat they fix the bug,hope that they fix it soon,and hope that they won't charge too much for the new version. You can hope the new version doesn't add new features with new bugs,and hope that the giant company doesn't get broken up in an anti-trust lawsuit.

But with Perl,you've got the source. In the rare and unlikely event you can't get a bug fixed any other way,you can hire a programmer or ten and get to work. For that matter,if you buy a new machine that Perl doesn't run on yet,you can port it yourself. Or,if you need a feature that doesn't exist yet,well,you know what to do.

1.3.3. Are There Any Other Kinds of Support?

Sure. One of our favorites is the Perl Mongers. This is a worldwide association of Perl users' groups; see http://www.pm.org/ for more information. There's probably a group near you with an expert or someone who knows an expert. If there's no group,you can start one.

Of course,for the first line of support,you shouldn't neglect the documentation. Besides the manpages,[*] you can find the documentation on the CPAN,http://www.cpan.org,as well as other sites,such as http://perldoc.perl.org that has HTML and PDF versions of the Perl documentation,http://www.perldoc.com that lets you search multiple versions of the documentation,or http://faq.perl.org/ that has the latest version of the perlfaq.

[*] The term manpages is a Unix-ism meaning documentation. If you're not on a Unix system,the manpages for Perl should be available via your system's native documentation system.

Another authoritative source is O'Reilly's book Programming Perl,commonly called "the Camel book" because of its cover animal. (This book is known as "the Llama book.") The Camel book contains the complete reference information,some tutorial stuff,and a bunch of miscellaneous information about Perl. There's also a separate pocket-sized Perl 5 Pocket Reference by Johan Vromans (O'Reilly) that's handy to keep at hand (or in your pocket).

If you need to ask a question,there are newsgroups on Usenet and any number of mailing lists.[

] At any hour of the day or night,there's a Perl expert awake in some time zone answering questions on Usenet's Perl newsgroups; the sun never sets on the Perl empire. This means that if you ask a question,you'll often get an answer within minutes. If you didn't check the documentation and FAQ first,you'll get flamed within minutes.

[

] Many mailing lists are listed at http://lists.perl.org.

The official Perl newsgroups on Usenet are located in the comp.lang.perl.* part of the hierarchy. As of this writing,there are five of them,but they change from time to time. You (or whoever is in charge of Perl at your site) should generally subscribe to comp.lang.perl.announce,which is a low-volume newsgroup with important announcements about Perl,including especially any security-related announcements. Ask your local expert if you need help with Usenet.

A few web communities have sprung up around Perl discussions. One popular one,known as The Perl Monastery (http://www.perlmonks.org) has seen quite a bit of participation from many Perl book and column authors,including at least two of the authors of this book. You can also check out http://learn.perl.org/ and its associated mailing list,beginners@perl.org.

If you find yourself needing a support contract for Perl,a number of firms are willing to charge as much as you'd like. Most other support avenues will take care of you free.

1.3.4. What if I Find a Bug in Perl?

The first thing to do when you find a bug is to check the documentation[*] again.[

] Perl has so many special features and exceptions to rules that you may have discovered a feature and not a bug. Check that you don't have an older version of Perl; maybe you found something that's been fixed in a more recent version.

[*] Even Larry admits to consulting the documentation from time to time.

[

] Maybe even twice or three times. Many times,we've gone into the documentation looking to explain a particular unexpected behavior and found some new nuance that ends up on a slide or in a column.

When you're almost certain that you've found a real bug,ask around. Ask someone at work,at your local Perl Mongers' meeting,or at a Perl conference. Chances are,it's still a feature and not a bug.

Once you're certain you've found a real bug,cook up a test case. (What,you haven't done so already?) The ideal test case is a tiny self-contained program that any Perl user could run to see the same (mis-)behavior as you've found. Once you've got a test case that clearly shows the bug,use the perlbug utility (which comes with Perl) to report the bug. That will normally send email from you to the Perl developers,so don't use perlbug until you've got your test case ready.

Once you've sent off your bug report,if you've done everything right,you may get a response within minutes. Typically,you can apply a simple patch and get right back to work. Of course,you may (at worst) get no response at all since the Perl developers are under no obligation to even read your bug reports. But all of us love Perl,so nobody likes to let a bug escape our notice.

Previous Page

Next Page

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


1. 如何去重 #!/usr/bin/perl use strict; my %hash; while(<>){ chomp; print "$_n" unless
最近写了一个perl脚本,实现的功能是将表格中其中两列的数据进行拼凑,然后将拼凑后的数据用“|”连接在一起。表格内容如下: 员工号码员工姓名职位入职日期1001张三销售1980/12/17 0:00:
表的数据字典格式如下:如果手动写MySQL建表语句,确认麻烦,还不能保证书写一定正确。写了个Perl脚本,可快速构造MySQL脚本语句。脚本如下:#!/usr/bin/perluse strict;m
巡检类工作经常会出具日报,最近在原有日报的基础上又新增了一个表的数据量统计日报,主要是针对数据库中使用较频繁,数据量又较大的31张表。该日报有两个sheet组成,第一个sheet是数据填写,第二个sh
在实际生产环境中,常常需要从后台日志中截取报文,报文的形式类似于.........一个后台日志有多个报文,每个报文可由操作流水唯一确定。以前用AWK写过一个,程序如下:beginline=`awk &
最近写的一个perl程序,通过关键词匹配统计其出现的频率,让人领略到perl正则表达式的强大,程序如下:#!/usr/bin/perluse strict;my (%hash,%hash1,@arra
忍不住在 PerlChina 邮件列表中盘点了一下 Perl 里的 Web 应用框架(巧的是 PerlBuzz 最近也有一篇相关的讨论帖),于是乎,决定在我自己的 blog 上也贴一下 :) 原生 CGI/FastCGI 的 web app 对于较小的应用非常合适,但稍复杂一些就有些痛苦,但运行效率是最高的 ;) 如果是自己用 Perl 开发高性能的站,多推荐之。 Catalyst, CGI::A
bless有两个参数:对象的引用、类的名称。 类的名称是一个字符串,代表了类的类型信息,这是理解bless的关键。 所谓bless就是把 类型信息 赋予 实例变量。 程序包括5个文件: person.pm :实现了person类 dog.pm :实现了dog类 bless.pl : 正确的使用bless bless.wrong.pl : 错误的使用bless bless.cc : 使用C++语言实
gb2312转Utf的方法: use Encode; my $str = "中文"; $str_cnsoftware = encode("utf-8", decode("gb2312", $str));   Utf转 gb2312的方法: use Encode; my $str = "utf8中文"; $str_cnsoftware = encode("gb2312", decode("utf-8
  perl 计算硬盘利用率, 以%来查看硬盘资源是否存在IO消耗cpu资源情况; 部份代码参考了iostat源码;     #!/usr/bin/perl use Time::HiRes qw(gettimeofday); use POSIX; $SLEEPTIME=3; sub getDiskUtl() { $clock_ticks = POSIX::sysconf( &POSIX::_SC_
1 简单变量 Perl 的 Hello World 是怎么写的呢?请看下面的程序: #!/usr/bin/perl print "Hello World" 这个程序和前面 BASH 的 Hello World 程序几乎相同,只是第一行换成了 #!/usr/bin/perl ,还有显示的时候用的是 print,而不是 echo。有了前面 BASH 基础和 C 语言的基础,许多 Perl 的知识可以很
本文介绍Perl的Perl的简单语法,包括基本输入输出、分支循环控制结构、函数、常用系统调用和文件操作,以及进程管理几部分。 1 基本输入输出 在 BASH 脚本程序中,我们用 read var 来实现从键盘的输入,用 echo $var 来实现输出。那么在 Perl 中将有一点变化。Perl 中将标准输入用关键词 表示;标准输出用 表示,标准错误输出用 表示。故而从标准输入读取数据可以写成: $
正则表达式是 Perl 语言的一大特色,也是 Perl 程序中的一点难点,不过如果大家能够很好的掌握他,就可以轻易地用正则表达式来完成字符串处理的任务,当然在 CGI 程序设计中就更能得心应手了。下面我们列出一些正则表达式书写时的一些基本语法规则。 1 正则表达式的三种形式 首先我们应该知道 Perl 程序中,正则表达式有三种存在形式,他们分别是: 匹配:m/<regexp>/ (还可以简写为 /
在学习Perl和Shell时,有很多人可能会问这样一个问题,到底先学习哪个或者学习哪个更好! 每个人都有自己的想法,以下是个人愚见,请多多指教! Perl是larry wall为解决日常工作中的一个编程问题而产生的,它最初的主要功能是用于分析基于文本的数据和生成这些数据的统计和结果;尽管初衷很简单,但是后来发展了很多特点: 1、Perl是一种借鉴了awk、C、sed、shell、C++、Java等
Perl 有很多命令行参数. 通过它, 我们有机会写出更简单的程序. 在这篇文章里我们来了解一些常用的参数. (重点提示:在window下执行命令行程序的方式为 : perl -e "some code", 注意:是双引号啊,不是单引号,linux下执行时单引号) Safety Net Options 在使用 Perl 尝试一些聪明( 或 stupid) 的想法时, 错误难免会发生. 有经验的 P
转自: http://bbs.chinaunix.net/thread-1191868-1-1.html# 让你的perl代码看起来更像perl代码,而不是像C或者BASIC代码,最好的办法就是去了解perl的内置变量。perl可以通过这些内置变量可以控制程序运行时的诸多方面。 本文中,我们一起领略一下众多内置变量在文件的输入输出控制上的出色表现。 行计数 我决定写这篇文章的一个原因就是,当我发现
2009-02-02 13:07 #!/usr/bin/perl # D.O.M TEAM - 2007 # anonyph; arp; ka0x; xarnuz # 2005 - 2007 # BackConnectShell + Rootlab t00l # priv8! # 3sk0rbut0@gmail.com # # Backconnect by data cha0s (modifica
转自: http://bbs.chinaunix.net/thread-1191868-1-1.html# 让你的perl代码看起来更像perl代码,而不是像C或者BASIC代码,最好的办法就是去了解perl的内置变量。perl可以通过这些内置变量可以控制程序运行时的诸多方面。 本文中,我们一起领略一下众多内置变量在文件的输入输出控制上的出色表现。 行计数 我决定写这篇文章的一个原因就是,当我发现
黑莓 手机 屏幕发展历程对比 blackberry 各型号屏幕大小   黑莓手 机 一直在不断发展且新机型 也在不断上市. 因此,不同黑莓机型的屏幕分辨率也在不断变化着. 总的来说,屏幕分辨率一直在提高并且越来越清晰.我们对所有的黑莓 机型的屏幕分辨率做了个对比.~51blackberry ~com     可能大家特别感兴趣是新发布的黑莓机型,它的分辨率也是黑莓 机型中前所未有的.   黑莓 b
      公司里没有我用惯的UltraEdit的lisence了, 只能无奈转向开源的Notepad++, 找了半天才知道配置运行Perl的办法。         1,用Notepad++打开.pl文件,         2, F5或者Run->Run,打开运行窗口,在下面的框框里输入:Perl -w "$(FULL_CURRENT_PATH)", 然后Save,保存成一个命令就行,名字比如叫R