• Solaris 问答集 at 2008年10月31日

    ufsrestore

    ufsrestore 用于恢复使用 ufsdump 命令备份的文件系统。命令格式为: /usr/lib/fs/ufs/ufsrestore options [arguments] [filename ...] options 包括: t:备份列表; x:只恢复命令行中指定的文件; r:恢复整个备份; f:指定备份文件所在的设备或目录; v:verbose mode,列出备份文件的路径。 例如: 对备份文件进行列表: pioneer# ufsrestore tvf ddd Verify volume and initialize maps Media block size is 126 Extract directories from tape Initialize symbol table. Dump date: Mon Sep 07 22:37:16 1998 Dumped from: the epoch Level 0 dump of / on pioneer:/dev/dsk/c0t0d0s0 Label: none dir 2 . dir 3 ./lost+found dir 5696 ./usr dir 11392 ./var dir 5697 ./export dir 11393 ./export/home dir 5698 ./opt leaf 4 ./bin dir 11394 ./dev dir 5699 ./dev/sad leaf 5879 ./dev/sad/admin leaf 5825 ./dev/sad/user leaf 11592 ./dev/be leaf 11496 ./dev/conslog ... 从备份中恢复指定文件: pioneer# cd /tmp pioneer# ufsrestore xvf ddd ./etc/passwd Verify volume and initialize maps Media block size is 126 Dump date: Mon Sep 07 22:37:16 1998 Dumped from: the epoch Level 0 dump of / on pioneer:/dev/dsk/c0t0d0s0 Label: none Extract directories from tape Initialize symbol table. Make node ./etc Extract requested files You have not read any volumes yet. Unless you know which volume your file(s) are on you should start with the last volume and work towards the first. Specify next volume #: 1 extract file ./etc/passwd Add links Set directory mode, owner, and times. set owner/mode for .\? [yn] n 执行该操作需要指定所要恢复的文件在备份文件中的位置。由于备份文件从卷 1 开始, 所以可以指定从卷 1 开始搜索。恢复整个文件系统下例将一个老的文件系统(/opt)移 到一个新的磁盘分区(/dev/rdsk/c0t3d0s5)中。首先,卸载老的文件系统并实施备 份: #umount /opt #fsck /opt #ufsdump 0uf /dev/rmt/0 /opt 其次,生成新的文件系统,将其安装到一个临时目录(/mnt),并实施恢复: #newfs /dev/rdsk/c0t3d0s5 #fsck /dev/rdsk/c0t3d0s5 #mount /dev/dsk/c0t3d0s5 /mnt #cd /mnt #ufsrestore rvf /dev/rmt/0 #rm restoresymtable 最后,卸载新的文件系统,用 fsck 检查其一致性。 #cd / umount /mnt #fsck /dev/rdsk/c0t3d0s5

    选择性备份,备份指定的文件和目录;

    tar

    系统备份:tar -cvf 目标文件名/设备名 备份文件,例如: tar -cvf backup.tar * 命令将当前目录下的所有文件(包括各级子目录)都打包在 backup.tar 文件中。 tar -cvf /dev/rmt/0 * 命令将当前目录下的所有文件(包括各级子目录)都打包到磁带上。查看 tar 文件的内 容:tar tvf 目标文件名/设备名,例如: tar -tvf backup.tar tar -tvf /dev/rmt/0 将 tar 文件中的内容恢复到指定目录中去:tar xvf 目标文件名/设备名 [目录名],例 如: tar -xvf backup.tar /home tar -xvf /dev/rmt/0 /home 如果不指定目录名则表示当前目录。

    1. Q: 如何在 Soraris 下面安装 ATM 网卡? A: 网卡型号:FORE PCA-200EUX/OC3 操作系统:Solaris 2.7 工作站:SUN Ultra60

    一、硬件安装 1、工作站关电后,将网卡妥善安装在一个 PCI 插槽中; 2、工作站上电,按 STOP and A 中断 boot process,到 ok 提示符; 3、输入命令 show-devs,显示系统配置,FORE 网卡的 device-pathname 应出现在 配置列表中,形式可能如下: /pci@1f,2000/FORE,PCA-200E@2 4、设备提供光口自环测试(media loopback) 和内部自环测试(internal loopback), 供检查设备及安装是否完好。根据经验用内部自环测试即可,方法: 输入命令 test /pci@1f,2000/FORE,PCA-200E@2 待出现:pass 0 说明硬件及安装都正确; 5、输入 boot 命令 ,启动系统。 二、软件安装 1、软件安装需要 root 权限; 2、网卡支撑软件一般是一个.tar 文件提供,解开后在其目录下有 8 个子目录,分 别为: FORECore ForeThought ATM Core Software FOREDrv ForeThought ATM Card Drivers FORESpans ForeThought SPANS Signalling Software FOREUni ForeThought UNI Signalling Software FOREclip ForeThought Classical IP Software FOREip ForeThought FORE IP Software FOREmpoa ForeThought MPOA / LAN Emulation Software FORExti ForeThought XTI Application Programming Interface 3、例如.tar 文件解开后在/home/FORE 下,则该目录下就有上述 8 个子目录,我们要 用的程序在 FOREDrv、FOREip 下,但各个模块之间有一定的依赖关系,需要安装的模块 有 6 个: FORECore、FORESpans、FOREDrv、FOREip、FOREUni、FOREclip。安装过程:

    pkgadd -d /home/FORE The following packages are available: 1 FORECore ForeThought ATM Core Software .........(sparc) 5.1 2 FOREDrv ForeThought ATM Card Drivers .........(sparc) 5.1 3 FORESpans ForeThought SPANS Signalling Software .........(sparc) 5.1 4 FOREUni ForeThought UNI Signalling Software .........(sparc) 5.1 5 FOREclip ForeThought Classical IP Software .........(sparc) 5.1 6 FOREip ForeThought FORE IP Software .........(sparc) 5.1 7 FOREmpoa ForeThought MPOA / LAN Emulation Software .........(sparc) 5.1 8 FORExti ForeThought XTI Application Programming Interface

    Select package(s) you wish to process (or \all\ to process all packages). (default: all) [?,??,q]: 选择要安装的模块,根据提示安装。 4、安装后的软件在/opt/FOREatm /bin(使用的配置命令所在目录) /conf /examples /include /lib /man 三、网卡配置 1、网络接口名配置

    configure_atm 选择配置 ip 模块,得到一个 ip interface 名,默认为 fa0。重启工作站,可以看到在 /dev 下有 fa0 接口,而网卡的设备名为 fatm0。 2、>adinfo fatm0 可查询设备硬件信息 adconfig fatm0 可进行设备配置 adstat fatm0 可查询设备状态 这三个命令较少用到。 3、接口 ip 地址配置 ifconfig fa0 netmask broadcast up 4、IPOA 配置 atmarp -s hostname device vpi vci aal encapsulation(outgoing PVC 配置) atmarp -l device vpi vci aal encapsulation (incoming PVC 配置) 例:分配给工作站的 pvc 为 vpi 0 vci 150 工作站的 IPOA 地址为 200.200.200.101 MUSA 设备的 IPOA 地址为 201.200.200.100 AAL 类型为 5 encapsulation 为 llc_routed atmarp -s 201.200.200.100 fa0 0 150 5 llc_routed atmarp -l fa0 0 150 5 llc_routed [在 MUSA 设备上要做:add nms、act nms、add route、add atm arp、add ipaccess] ping 200.200.200.101 如果 ping 通,则已配置成功。

    1. Q: 在哪里能得到有关 Solaris 的较全面的文档? A: http://docs.sun.com

    21 .Q: 请教 sun 小型机上的路由跟踪命令是什么?(HP 上是 traceroute)谢谢! A:这个命令也是 traceroute.在/usr/sbin 目录下.

    1. Q: 一个 GUI 程序,在换个不同的 SUN 环境时界面就变的难看了,主要是字体影响 (还有其它影响么?)SUN 的字体都有哪些,如 -sun-screen-bold-r-normal--14-140-72-72-m-90-iso8859-1 都有哪些可选? A: If a font can not be found in the system, the system will select another font which might be not so elegent as you expect. The correct way is to insure the font you want is correctly installed in system. In solaris answer book, there is a perfect reference talking about the font administration \"font administration\" in System Administration Vol1. You can get solaris answer book by accessing sunlibrary.huawei.com. Chen Zhexue(4924) is responsible for maintain. it.

    23 Q: Solaris 启动过程是如何的?启动的时候读那些文件启动一些服务比如我要在系 统启动的时候自动启动 Apache(httpd) 服务,应该在哪个文件里面配? A: Solaris 的启动是典型的 ATT UNIX 启动过程, 在普通的 UNIX 书记和 SUN 公司的文 档中都有详细的介绍,这里就不详谈了. 要点室内核引导后启动 init 进程, init 按照/etc/inittab 的控制加载各子系统, 一般是执行 /etc/rc* 之类的脚本. 这些脚本再执行 /etc/rc*.d/ 下的脚本,其中 /etc/rc2.d/S72inetsvc 运行 inetd, 该后台进程根据/etc/inetd.conf 控制网络服务,所以要自动启动 Apache,需要在 inetd.conf 中修改或增加 80 端口的启动命令。(如果不是用 80 ,还要修改/etc/services 文件)

    24 Q: 有一个问题要请教一下,谢谢! 一台 SUN 服务器,更换 IP 地址。 原来地址为 10.11.43.137,现在更换为 10.108.22.247

    我的操作步骤如下: 1:修改/etc/hosts 文件,修改后的文件内容如下: 127.0.0.1 localhost 10.108.22.247 westsnow loghost SYBASE 10.109.22.247 eastsnow /etc/hostname.hme0 文件内容: westsnow /etc/hostname.hme0:1 文件内容: eastsnow 2:修改/etc/netmasks 文件,修改后的文件内容如下: 10.0.0.0 255.255.0.0 3:修改网关/etc/defaultrouter 文件,修改后的文件内容如下: 10.108.22.1

    按照上面步骤修改完后 REBOOT 机器,启动过程中没有任何异常,但是机器启动 后和别的机器连不上,而且连网关都 PING 不通,请问是什么原因?谢谢! A: /etc/hostname.hme0:1 中应当写你想用的 IP 地址,而不是机器名. 如果只改 IP 地址,就不需要这个文件.

    25 Q: UTF-8 和 US-ASCII 之间的区别在那里?请举例说明。 A: UTF-8 包括 US-ASCII 和多字节编码。与普通的多字节编码不同,UTF-8 的字节 长度不固定,对于 ASCII, 字节长度为 1, 对于中文,阿拉伯文等,可以是 2,3 或更 多字节,这样能有效节省存储空间. 它还与很多传统编码标准兼容,所以很受欢 迎.

    26 Q: 如何在脚本里实现修改用户口令? A: 由于修改口令需要从终端读取用户口令,所以不能用重定向的办法,但可以采用 expect 之类的工具,这些工具建立一个伪终端来模拟输入, 所以起到用脚本控 制终端的效果.

    27 Q: 我在用 EXCEED 连到工作站时,开了一个 root 权限 term,网络突然中断,请问如 何能够 kill 该 term 的进程? A: 用 xkill 连 dtterm 一起杀掉。在桌面上是可以的,在 exceed 中不知是否可以。

    28 Q: 在 Solaris 下可用什么命令查看 system software info? A: 用/usr/bin/pkginfo . 或者 /usr/bin/prodreg,有图形界面将注册过的产品显示成树的形状.

    29 Q: 请问:在 SOLARIS 8 中,用什么命令看 port id? A: 我曾就这个问题问过不少人, 有的说 fuser 可以做,但我查 fuser 的手册 没有见到相关选项。lsof 是一个比较理想的工具,可以从 sunfreeware.com 下 载。还有一个简单的办法是这样的: /usr/proc/bin/pfiles /proc/* > result.txt 在到 result.txt 中搜索相应 socket port. 也可以自己用 awk 过滤 pfiles 的 结果

    30 Q: 使用 FTP 时,不能以 root 用户登录系统,应修改什么配置文件? A: 看一下 /etc/ftpusers ,如果有 root, 删掉就可以了。

    31 Q: 我们的系统需要计算 solaris 的负载,可以使用 uptime 输出的 load average 吗, 如果不用 uptime,使用 libkstat 的 load average 可以吗? A: 可以.

    32 Q: 请问 uptime 的 load average 是如何计算出来的? A: 这个问题满复杂的,我们知道, unix 内核里有许多种结构,如 user,proc 等, 有的还 mount 到 文件系统中 ,比如 /proc /dev/kstat /dev/ksysm, uptime, kstat,sar ,vmstat, prstat 等命令都是通过分析这些结构来进行计算的有 一个系统函数叫 getloadavg ,uptime 就是直接调用这个函数的,你也可以试试.

    33 Q: 如何得到和设置操作系统内核参数。 A: 通常,这些参数在 /etc/system 中配置。

    34 Q: 如何得到系统当前动态运行指标,如 CPU 占有率、IO 量、硬盘剩余空间等。 A: 检查的命令则有许多,可用 vmstat 和 sar 命令,还有 iostat ,df ,du 用 于检查磁盘的情况。

    35 Q: How can I get a Workshop6\s licence? A: get a new one from www.sun.com and install it again. URL is http://www.sun.com/forte/cplusplus/buy.html cp licence-file install_dir/SUNWspro/licencse_dir/sunpro.lic,node

    36 Q: 请问能否在一个 slice 里挂两个文件系统? A: 不可以.

    37 Q: 请问修改了/etc/nodename 后,UNIX 工作站启动不了,该如何是好? A: 单纯修改 nodename 不够,还应修改 /etc/net/*/hosts

    38 Q: Solaris 的/usr/lib/dmi/snmpXdmid 是干什么用的? A: Sun Solstice Enterprise SNMP-DMI mapper subagent man snmpXdmid 可得.

    39 Q: 我的工作站上没有光驱,想通过远程安装,可否? A: 可以,有两种方式: 1。 将 solaris 光盘内容以 ftp 上传,本地安装 2。 做一个 install server ,远程直接安装。

    1. 用 remote 光驱安装

    (在 remote 机器)

    ps -ef | grep nfsd

    mkdir /dummy

    vi /etc/dfs/dfstab (share -F nfs -o ro /dummy)

    eject cdrom0

    chmod 644 /etc/rmmount.conf

    vi /etc/rmmount (share cdrom*)

    chmod 444 /etc/rmmount.conf

    (Load a CD.) share

    • /dummy ro \"\"
    • /cdrom/sol_7_sparc/s5 ro \"\"

    (在本地) $ showmount -e starbug

    mount -F nfs -o ro starbug:/cdrom/sol_8_sparc /cdrom

    $ ls /cdrom $

    40 Q: 我们想了解一下 SUN 公司年机器在并行程序运算方面的能力和相应的平台。 A: 您知道,SUN 公司在 SMP 技术上居于领导地位,所设计的体系结构具有良好的可 扩展性。只对硬件升级,不改动代码,往往就可以得到接近线性增长的性能, 如果有开发工具的帮助,会取得更好的效果,sun 公司提供的 Forte C/C++ workshop 包含许多工具帮助开发者分析软件性能病进行优化,Solaris 也包含专 门的库函数以提高计算效率,SUN 公司有一本白皮书专门介绍高性能计算 您可 以从 docs.sun.com 得到.书的名字叫: UltraConputing:How to Achieve Peak Performance from Solaris Applications..

    41 Q: 我在/etc/skel/local.profile 作的环境变量的修改但没有在新增用户时候得到 验证,为什么?这不是一个模板吗?(用 EXIT 退出窗口, 再用新用户登录) A: 如果是从终端登录,.profile 会起作用,但如果从 CDE 登录,则系统执行 .dtprofile,要想执行 .profile, 还要修改 .dtprofile 一般情况下,如果想设 置一个环境变量使其对所有用户生效,可以修改 /etc/profile

    42 Q: /etc/system 文件中的 namespace 指的是什么,与 Modules 有何关系?system 文 件中哪些参数将对机器性能有较大影响? A: 所有的手册都警告说修改 system 文件应当慎重,事实上,也只有在安装数据库, 增加新的设备时,才有可能需要修改此文件.所改的参数,也就是你附件中改过的 那几个线程数,信号量之类的. 修改参数值,会影响整个系统的开销,因为这些值 所涉及的空间分配是在系统启动时进行的 namespace 用于对 modules 分类, 说明 中指出了目前支持的几种 namespace,用户不能增加新的种类.

    43 Q: I am a programer work with SUN C++. Can I use STL(stand template library) in program. I can\t find any help in SUN C++\s document.Thank you. A: Sun 的 C/C++ WorkShop 中的 C++ 类库好像包含 STL, 可以参考一下. docs.sun.com 上有完整的文档,可以参考一下.

    44 Q: 原来的系统中/usr 与 / 在同一个硬盘分区上,由于安装了许多软件,此分区已满 ,现在系统增加了硬盘,如何将/usr 目录挪到新的硬盘上? A: 1.在新的硬盘上将文件系统建好, 2.mv /usr /usr.bak 3.mkdir /usr 4.mount newdriverpath /usr 5.cp -r /usr.bak /usr 6.修改/etc/vfstab 文件.

    45 Q: 运行下面这段程序并用 vmstat 观察内存的使用情况: int main(){ int *p[100]; int c; printf(\"before new!\"); c=getc(stdin); for(int i=0;i<100;i++) p=(int *) malloc(sizeof(int)*32000); printf(\"after new!\"); //1..... c=getc(stdin); for(int i=0;i<100;i++) free((void *) p); printf(\"after delete!\"); //2...... c=getc(stdin); return 0; } 发现在 2 处系统的空闲内存块并没有增加,free 调用到底有没有释放内存? A: malloc 调用引起进程堆空间增长,但 free 调用不会导致该堆空间立即缩小, 系统只是简单记录这一变化,就继续运行程序,只有系统出现内存短缺时, 系统才收集这些内存块重新分配,这样实现是为了减少系统开销,提高效率.

    46 Q: 请问在 kstat 的输出中,类似 avenrun_15min 这种内核动态参数有没有介绍材料? A: 通常, kstat 输出的是内核模块中的一些链表或数组,按照 SUN 公司的文档,这些 输出结果是自解释型的,根据他们的名字就可以猜到其含义.但实际上并不是这 样.这些链表中包含的结构是在下的一些头文件中定义的,比如 kmem_cache 模块的结构由 kmem_impl.h 定义,hme 模块的结构由 hme.h 定义,等等. 翻看这些头文件,可以得到稍微详细一点的资料. 参数名字通常与某结构的成员 变量同名,头文件中由简单的注释指出其作用. 比如:hme 模块输出中包含如下字 段: brdcstrcv 1094670 我们就可以查 hme.h,hme.h 中有一个很大的结构:hme, 其中有: uint32_t hme_brdcstrcv; /* # broadcast packets received */

  • 最近在整 solaris。。。。。

    Linux 以前还接触点,还比较顺手。。。。这个 Solaris 跟 Linux 又有很多不同。在 linux 下可以跑的东西,在 Solaris 下就不行。。。。

    头大的很。ft:Q

  • Linux cron 的使用 at 2008年10月31日

    看了两天的,终于觉得把这个 Cron 看得稍微明白点了,总结一下。 刚开始的时候对于后台进程,守护进程,以及 cron 进程的关系根本没弄清楚,现在了解了。就像我前面的文字里面写的: 后台进程:[color=#ff0000] 运行时无须用户输入的程序。可以在诸如 UNIX/Linux 之类的多任务操作系统上运行多个后台进程,而用户则与前台进程交互(例如,数据输入)。有些后台进程(例如守护程序)从来都不需要用户输入。其它一些进程只是在用户忙于目前运行于前台的程序时才临时处于后台。
    守护进程是一种后台进程。Cron 进程是众多守护进程中的一种,看看 Cron 这个单词在字典里面的解释:
    cron = chronograph,【unix】(时钟) 守护程序,(精密) 计时程序
    从字面意思就可以大概了解,它是一种和时间有关系的程序,简单的说, cron 守护进程执行预定的命令,他会在预定的时间执行预订的命令或者脚本。 好,知道了他是干嘛的,现在就来了解他是怎么工作的。 “以一定的时间间隔运行作业需要使用 [i] cron 进行管理,它由 crond 守护进程和一组表(描述执行哪些操作和采用什么样的频率)组成。[color=#ff0000] 这个守护进程每分钟唤醒一次,并通过检查 crontab 判断需要做什么。用户使用 crontab 命令管理 crontab。 crond 守护进程常常是在系统启动时由 init 进程启动的。” 注:上文摘自网络,实际上,在我的机器上,安装的是 Vixie-Cron,所以我的电脑上不是 crond,而是 Vixie-Cron 关于 crontab 这个表的内容,以及如何写这个表,前面一篇文字已经有讲过,不再赘述。有一点新的内容需要补充,时间后面的字段,也就是第六个字段:[color=#ff0000] 第 6 个字段包含前 5 个字段之后的所有内容,它是要传递给 shell 的字符串。百分号(%)将转换为空行,所以如果要使用 % 或其他任何特殊字符,就要在前面加上反斜线(\)。第一个 % 之前的一行传递给 shell,这个 % 之后的所有行都作为标准输入传递。 一般来说,只有 root 用户才有权限去运行 cron 进程,若管理员允许或者禁止其他用户使用,则应编辑/etc/下面的 c r o n . d e n y 和 c r o n . a l l o w 这两个文件来禁止或允许用户拥有自己的 c r o n t a b 文件。 每一个用户都可以有自己的 c r o n t ab 文件,但在一个较大的系统中,系统管理员一般会禁止这些文件,而只在整个系统保留一个这样的文件。系统管理员是通过 c r o n . d e ny 和 c r o n . a l l o w 这两个文件来禁止或允许用户拥有自己的 c r o n t a b 文件。 若没有自己的 crontab 文件,则第一次使用时可能应该手动创建一个文件,然后使用 $crontab <你的 crontab 文件名>来提交你的 crontab,之后就可以用 crontab 命令来修改,删除,列出你的 crontab 的内容了。关于如何此命令如何使用也参见上一篇关于 cron 的博客日志。 注:crontab 这个词的意思,本身他是一个表,里面记录预订时间预定执行的命令或脚本;第二,他也是个命令,用户使用 crontab 命令管理 crontab 这个表。 cron 在运行的时候要查看 crontab 来进行作业的调度。这里上文有几句话非常重要,解释了我碰到过的问题:[color=#ff0000] 这个守护进程每分钟唤醒一次,并通过检查 crontab 判断需要做什么。 [color=black] 每分钟检查一次 crontab,然后做一次运行命令或脚本的安排。 用户自己创建的 crontab 在哪儿呢?在这里:/var/spool/cron/crontabs 。其实,cron 检查的 crontab 不只包括用户自己创建的 crontab,还有系统的 crontab,包括 [url=][b] /etc/crontab [/b][/url] 和/etc/cron.d 目录中的文件(/etc/cron.d 下有可能会存在 at 调度的作业)。其中 [url=][b] /etc/crontab [/b][/url] 有必要解释一下,一个典型的例子: [url=][b]/etc/crontab[/b][/url]

    [table=80%][tr][td]
    SHELL=/bin/bash PATH=/sbin:/bin:/usr/sbin:/usr/bin MAILTO=root HOME=/

    run-parts

    01 * * * * root run-parts /etc/cron.hourly 02 4 * * * root run-parts /etc/cron.daily 22 4 * * 0 root run-parts /etc/cron.weekly 42 4 1 * * root run-parts /etc/cron.monthly [/td][/tr][/table] 在这些系统 crontab 中,在第五个时间字段(星期)和命令之间增加了一个字段。这个字段指定哪个用户应该运行这个命令,一般情况下是根用户。然后解释下后面的命令:在/etc/下会有 cron.hourly,cron.daily,cron.weekly,cron.monthly 这四个文件夹,他们下面分别放着一些文件,用来指定每小时,每天,每个星期,每个月要执行的操作,命令 run-parts 的意思是执行下面目录里面的程序和脚本,例如 run-parts/etc/cron.hourly 意思就是执行/etc/cron.hourly 文件夹下的程序以及脚本。 在这个示例中,真正的工作由 run-parts 命令执行,它运行/etc/cron.hourly、/etc/cron.daily 等目录中的脚本;/etc/crontab 仅仅控制执行作业的时间。注意,这里的所有命令都作为根用户运行。还要注意,crontab 可以包含 shell 变量赋值,这些赋值会在运行命令之前执行。 [url=][b] 输出 [/b][/url] 您可能想知道对来自命令的输出会如何处理。为使用 cron 而设计的大多数命令会使用 syslog 在日志中记录输出(参见教程 “[url=http://www.ibm.com/developerworks/cn/edu/l-dw-l-lpi1111.html] LPI 102 考试准备:管理任务 [/url]” 中的讨论)。但是,定向到 stdout 的输出会通过电子邮件发送给用户。 对上面这段还不是很明白。但是我们可以在系统日志/var/log/messages 里面看到你 cron 调度的命令或者脚本有么有执行。然后,目前测试,如果是 GUI 的应用程序,似乎用 cron 不能良好的运行,所谓不能良好的运行,举例来说:不能使用 mp3blaster 播放音乐,因为他需要使用 ncurses 去绘制他的界面;在比如,使用 mplayer 去播放视频,我下午的测试,只能播放出音乐,不能显示出视频。 参考资料: [url=http://www.ibm.com/developerworks/cn/linux/l-job-scheduling.htmlhttp://www.ibm.com/developerworks/cn/linux/l-job-scheduling.html[/url]] [url=http://blog.163.com/kissinger_1984/blog/static/16899252008990236709/edit/http://blog.163.com/kissinger_1984/blog/static/16899252008990236709/edit/[/url]] 在 gentoo 里面用 eix -s cron 看了下,cron 这种程序还是有很多种的,不同的人开发的不同特色的 cron 程序。比如 dcron,fcron 等等,详细就自己去看下 description 了。 对于 cron 的学习,可能这也算是告一段落了,总结一下,以示庆祝

    转载自:http://blog.163.com/kissinger_1984/blog/static/1689925200891131436237/

  • Linux cron 的使用 at 2008年10月31日

    cron 是一个 linux 下的定时执行工具,可以在无需人工干预的情况下运行作业。由于 Cron 是 Linux 的内置服务,但它不自动起来,可以用以下的方法启动、关闭这个服务:

      /sbin/service crond start //启动服务

      /sbin/service crond stop //关闭服务

      /sbin/service crond restart //重启服务

      /sbin/service crond reload //重新载入配置

      你也可以将这个服务在系统启动的时候自动启动:

      在/etc/rc.d/rc.local 这个脚本的末尾加上:

      /sbin/service crond start

      现在 Cron 这个服务已经在进程里面了,我们就可以用这个服务了,Cron 服务提供以下几种接口供大家使用:

      1.直接用 crontab 命令编辑

      cron 服务提供 crontab 命令来设定 cron 服务的,以下是这个命令的一些参数与说明:

      crontab -u //设定某个用户的 cron 服务,一般 root 用户在执行这个命令的时候需要此参数

      crontab -l //列出某个用户 cron 服务的详细内容

      crontab -r //删除没个用户的 cron 服务

      crontab -e //编辑某个用户的 cron 服务

      比如说 root 查看自己的 cron 设置:crontab -u root -l

      再例如,root 想删除 fred 的 cron 设置:crontab -u fred -r

      在编辑 cron 服务时,编辑的内容有一些格式和约定,输入:crontab -u root -e

      进入 vi 编辑模式,编辑的内容一定要符合下面的格式:/1 * * * * ls >> /tmp/ls.txt 这个格式的前一部分是对时间的设定,后面一部分是要执行的命令,如果要执行的命令太多,可以把这些命令写到一个脚本里面,然后在这里直接调用这个脚本就可以了,调用的时候记得写出命令的完整路径。时间的设定我们有一定的约定,前面五个号代表五个数字,数字的取值范围和含义如下:

      分钟 (0-59)

      小時 (0-23)

      日期 (1-31)

      月份 (1-12)

      星期 (0-6)//0 代表星期天

      除了数字还有几个个特殊的符号就是""、"/"和"-"、",",代表所有的取值范围内的数字,"/"代表每的意思,"*/5"表示每 5 个单位,"-"代表从某个数字到某个数字,","分开几个离散的数字。以下举几个例子说明问题:

      每天早上 6 点

      0 6 * * * echo "Good morning." >> /tmp/test.txt //注意单纯 echo,从屏幕上看不到任何输出,因为 cron 把任何输出都 email 到 root 的信箱了。

      每两个小时

      0 */2 * * * echo "Have a break now." >> /tmp/test.txt

      晚上 11 点到早上 8 点之间每两个小时,早上八点

      0 23-7/2,8 * * * echo "Have a good dream:)" >> /tmp/test.txt

      每个月的 4 号和每个礼拜的礼拜一到礼拜三的早上 11 点

      0 11 4 * 1-3 command line

      1 月 1 日早上 4 点

      0 4 1 1 * command line

      每次编辑完某个用户的 cron 设置后,cron 自动在/var/spool/cron 下生成一个与此用户同名的文件,此用户的 cron 信息都记录在这个文件中,这个文件是不可以直接编辑的,只可以用 crontab -e 来编辑。cron 启动后每过一份钟读一次这个文件,检查是否要执行里面的命令。因此此文件修改后不需要重新启动 cron 服务。

      2.编辑/etc/crontab 文件配置 cron

      cron 服务每分钟不仅要读一次/var/spool/cron 内的所有文件,还需要读一次/etc/crontab,因此我们配置这个文件也能运用 cron 服务做一些事情。用 crontab 配置是针对某个用户的,而编辑/etc/crontab 是针对系统的任务。此文件的文件格式是:

      SHELL=/bin/bash

      PATH=/sbin:/bin:/usr/sbin:/usr/bin

      MAILTO=root //如果出现错误,或者有数据输出,数据作为邮件发给这个帐号

      HOME=/ //使用者运行的路径,这里是根目录

      # run-parts

      01 * * * * root run-parts /etc/cron.hourly //每小时执行/etc/cron.hourly 内的脚本

      02 4 * * * root run-parts /etc/cron.daily //每天执行/etc/cron.daily 内的脚本

      22 4 * * 0 root run-parts /etc/cron.weekly //每星期执行/etc/cron.weekly 内的脚本

      42 4 1 * * root run-parts /etc/cron.monthly //每月去执行/etc/cron.monthly 内的脚本

      大家注意"run-parts"这个参数了,如果去掉这个参数的话,后面就可以写要运行的某个脚本名,而不是文件夹名了。

    原文链接:http://soft.yesky.com/os/lin/287/2011787_1.shtml

  • Perl 命令行应用介绍 at 2008年10月31日

    Too late for "-T" option at C:\Program Files\Apache2.2\htdocs\ch17\startup.pl li ne 1.

    把文件的第一行的-T 选项去掉就 OK 了。

  • 首先要确定是否配置问题: 相关指令 AddHandler Options ScriptAlias

    CGI(公共网关接口 [Common Gateway Interface]) 定义了网站服务器与外部内容协商程序之间交互的方法,通常是指 CGI 程序或者 CGI 脚本,是在网站上实现动态页面的最简单而常用的方法。本文将对如何在 Apache 网站服务器上建立 CGI 以及如何编写 CGI 程序作介绍。

    配置 Apache 以允许 CGI

    要让 CGI 程序能正常运作,必须配置 Apache 以允许 CGI 的执行,其方法有多种。

    ScriptAlias ScriptAlias 指令使 Apache 允许执行一个特定目录中的 CGI 程序。当客户端请求此特定目录中的资源时,Apache 假定其中文件都是 CGI 程序并试图运行。

    ScriptAlias 指令形如:

    ScriptAlias /cgi-bin/ /usr/local/apache/cgi-bin/

    如果 Apache 被安装到默认的位置,默认的配置文件 httpd.conf 中则会有上述配置。ScriptAlias 指令定义了映射到一个特定目录的 URL 前缀,与 Alias 指令非常相似,两者一般都用于指定位于 DocumentRoot 目录以外的目录,其区别是 ScriptAlias 又多了一层含义,即其 URL 前缀中任何文件都被视为 CGI 程序。所以,上述例子会指示 Apache,/cgi-bin/应该指向/usr/local/apache /cgi-bin/目录,且视之为 CGI 程序。

    举例,如果有 URL 为http://www.example.com/cgi-bin/test.plApache 会试图执行/usr/local/apache/cgi-bin/test.pl 文件并返回其输出。当然,这个文件必须存在而且可执行,并以特定的方法产生输出,否则 Apache 返回一个出错消息。的请求,

    ScriptAlias 目录以外的 CGI 由于安全原因,CGI 程序通常被限制在 ScriptAlias 指定的目录中,如此,管理员就可以严格地控制谁可以使用 CGI 程序。但是,如果采取了恰当的安全方法措施,则没有理由不允许其他目录中的 CGI 程序运行。比如,你可能希望用户在 UserDir 指定的宿主目录中存放页面,而他们有自己的 CGI 程序,但无权存取 cgi-bin 目录,这样,就产生了运行其他目录中 CGI 程序的需求。

    用 Options 显式地允许 CGI 的执行 可以在主服务器配置文件中,使用 Options 指令显式地允许特定目录中 CGI 的执行:

    Options +ExecCGI

    上述指令使 Apache 允许 CGI 文件的执行。另外,还必须告诉服务器哪些文件是 CGI 文件。下面的 AddHandler 指令告诉服务器所有带有 cgi 或 pl 后缀的文件是 CGI 程序:

    AddHandler cgi-script cgi pl

    .htaccess 文件 .htaccess 文件是针对目录进行配置的一种方法。Apache 在提供一个资源时,会在此资源所在目录中寻找.htaccess 文件,如果有,则使其中的指令生效。AllowOverride 指令决定了.htaccess 文件是否有效,它指定了哪些指令可以出现在其中,或者根本不允许使用。为此,需要在主服务器配置中如此配置:

    AllowOverride Options

    在.htaccess 文件中,需要如此配置:

    Options +ExecCGI

    以使 Apache 允许此目录中 CGI 程序的执行。

    另外要注意: cgi 程序一定要先输出 Content-type: text/html 这样一行 并且下面有一个空行。

  • Perl 对于一个 CM 太重要了 at 2008年10月30日

    learning perl 的中文看的差不多了,整了一会 CGI

  • Perl 编程入门 at 2008年10月30日

    --CGI[font=宋体] 编程 [/font]--Perl[font=宋体] 中使用 [/font] CGI[font=宋体] 模块/font— [font=宋体] 今天算是进入正题了,因为我们这个教程的名字就叫做 “[/font] CGI[font=宋体] 编程” 吗。在 [/font] CGI[font=宋体] 模块诞生之前,写 [/font] CGI[font=宋体] 程序是一件很令人自豪的事情,因为只有那么一小撮人会。但是后来 [/font] CGI[font=宋体] 模块诞生了,整个世界发生了令人感到恐怖的变化,人人都可以编 [/font] CGI[font=宋体] 程序了 [/font],555...[font=宋体]。在 [/font] Perl[font=宋体] 中我们使用一个名为 [/font] CGI.pm[font=宋体] 的模块来进行 [/font] CGI[font=宋体] 的编程,在其中提供了许多现成的东西供我们使用,下面我们通过两个简单的例子对 [/font] CGI[font=宋体] 模块的基本功能有一个初步的了解。[/font]

    [font=宋体]  先来看一看一个基本的 [/font] Perl-CGI[font=宋体] 程序。这个程序和我们以前见到的 [/font] Perl[font=宋体] 程序有点不太一样,但是熟悉 [/font] c++[font=宋体] 的朋友应该不会有问题的。[/font]

    #!/usr/bin/perl -w

    use CGI;

    {

    my $q = new CGI;

    print $q->header(),

    $q->start_html("hello perl world!"),

    $q->h1('hello perl world'),

    $q->end_html();

    }

    [font=宋体]  这里出现了一句 “[/font] use CGI;[font=宋体]” 这一句是非常重要的。我们通过 [/font] use[font=宋体] 这个关键字引入了 [/font] CGI[font=宋体] 模块,注意一定要用大写。这里绝大部分工作都是由 [/font] CGI[font=宋体] 模块来完成的。[/font]

    [font=宋体]  然后我们进行了这么一项工作:“[/font] my $q= new CGI;[font=宋体]” 这一句产生了一个新的 [/font] CGI[font=宋体] 对象。[/font] new[font=宋体] 是一个新的语句,这个语句是由 [/font] CGI[font=宋体] 模块提供的,[/font] Perl[font=宋体] 语言并不提供 [/font] new[font=宋体] 这个语句。但是受到 [/font] C++[font=宋体] 的影响,很多 [/font] perl[font=宋体] 模块都提供 [/font] new[font=宋体] 语句。我们可以通过 [/font] new[font=宋体] 创建一个新的 [/font] CGI[font=宋体] 模块。[/font]

    [font=宋体]  随后是一个很长的 [/font] print[font=宋体] 语句,注意这里面用的是逗号,[/font] Perl[font=宋体] 里面可以通过逗号顺序执行一系列的语句。我们执行的第一句是 “[/font]$q->header();[font=宋体]” 这一句将会产生一个 [/font] http[font=宋体] 反应头,这个函数是可以使用参数的,通过不同的参数我们可以给浏览器返回不同的状态,例如下面的语句将会使浏览器以为发生了内部错误:“[/font]$q->header(500);[font=宋体]” 这里 [/font] 500[font=宋体] 是 [/font] http respons[font=宋体] 的一个代号,代表服务器发生内部错误。[/font]

    [font=宋体]  然后下面一句是 “[/font]$q->start_html("hello perl world!"),[font=宋体]” 这一句将会产生如下的 [/font] Html[font=宋体] 代码:[/font]

    [font=宋体]  我们还可以通过给 [/font] start_html[font=宋体] 参数来进行其他的 [/font] html[font=宋体] 文件 [/font] head[font=宋体] 段设置。[/font]

    [font=宋体]  然后我们运行了 “[/font]$q->h1('hello perl world'),[font=宋体]” 这一句可以得到如下 [/font] Html[font=宋体] 代码 [/font]:

    hello Perl world

    [font=宋体]  最后一句是 “[/font] $q->end_html();[font=宋体]” 这一句产生如下下代码 “[/font][font=宋体]”[/font],[font=宋体] 一个 [/font] Html[font=宋体] 文件就这么结束了。[/font]

    [font=宋体]  下面我们用一个例子解释 [/font] CGI[font=宋体] 模块怎么处理用户的输入:[/font]

    #!/usr/bin/perl -w

    use CGI qw/:standard/;

    {

    my $cgi= new CGI;

    print $cgi->header,

    $cgi->start_html('A Simple Example'),

    $cgi->h1('A Simple Example');

    if ( $cgi->param())

    {

    print "Your name is ",

    $cgi->param('name');

    }

    $cgi->end_html();

    }

    [font=宋体]  如果在这个程序地 [/font] url[font=宋体] 后面加上 “[/font]?name=cyfer[font=宋体]” 就会打印出来 “[/font] your name is cyfer[font=宋体]”,呵呵。这里通过 “[/font]$cgi->param("name");[font=宋体]” 这一句可以得到传递给 [/font] CGI[font=宋体] 程序的参数。这个参数在没有 [/font] CGI[font=宋体] 模块的时代要费多大劲才可以得到啊![/font] 555...

    [font=宋体] 好了今天就到这里吧!我们这两个简单的例子实际上已经可以展现 [/font] CGI[font=宋体] 模块的优势了。呵呵,有问题一定要问啊![/font]

    --CGI[font=宋体] 编程 [/font]--Perl[font=宋体] 中使用 [/font] CGI[font=宋体] 模块/font— [font=宋体] 今天我们看看 [/font] CGI.pm[font=宋体] 的两种使用模式,因为今后我们要经常和它打交道了。调用 [/font] CGI[font=宋体] 模块的模式有两种,一种是面相对象方式的,另一种是面向过程的。下面的例子说明这两种调用方式,首先是面向过程的:[/font]

    !/usr/bin/perl -w

    use strict;

    use CGI;

    {

    print header(),

    start_html(),

    h1("[font=宋体] 你好 [/font]");

    print end_html();

    }

    [font=宋体]  然后是面向对象方式的:[/font]

    !/usr/bin/perl -w

    use strict;

    use CGI;

    {

    my $cgi = new CGI;

    print$cgi->header(),

    $cgi->start_html(),

    $cgi->h1("[font=宋体] 你好 [/font]"),

    $cgi->end_html();

    }

    [font=宋体]  这两段代码是随手写的没有经过测试,我们可以不去管这两种代码是如何实现的,仅仅知道有这么两种方式就可以了。另外,我建议使用面向对象的方式,因为面向对象方式的要比面向过程的方式效率高。[/font]

    [font=宋体]  然后我们讲一讲 [/font] CGI.pm[font=宋体] 中的函数调用方式。[/font] CGI[font=宋体] 模块经常使用下面的调用方式。[/font]

    print$q->header(-type=>'image/gif',-expires=>'+3d');

    header[font=宋体] 里面的参数实际上是一个 [/font] hash[font=宋体] 类型,这里面每个参数前面都有一个 “[/font]-[font=宋体]”/font[font=宋体],可能看着有点不顺眼,但是看惯了就好了。由于这些带 “[/font]-[font=宋体]” 的参数是一个 [/font] hash,[font=宋体] 因此我们可以使用下面的调用方式:[/font]

    print$q->header({-type=>'image/gif',-expires=>'+3d'}); #[font=宋体] 多了一个 “[/font]{[font=宋体]”[/font]

    [font=宋体]  然后是看看 [/font] header()[font=宋体] 函数。[/font] header[font=宋体] 函数生成的部分是我们在浏览器里面看不到的。但是也是不能没有的。这一部分是告诉浏览器应该对返回的信息进行什么处理,做什么事情的部分。下面是几个标准的 [/font] header[font=宋体] 使用的例子:[/font]

    $cgi->header("text/html");#[font=宋体] 后面是一个标准的 [/font] html[font=宋体] 文件,它是一种 [/font] text[font=宋体] 文件。[/font]

    $cgi->header("image/gif");#[font=宋体] 后面是一幅 [/font] gif[font=宋体] 图。[/font]

    [font=宋体]  在接下来的学习中我们会通过几个实际的例子来加深和巩固以上的内容,今天就到这里吧。[/font]

  • Perl 编程入门 at 2008年10月30日

    今天继续剩余的程序流程控制,有 next、last、redo 这么几个语句。next 相当于 c 语言中的 continue,就是中止本次循环的过程,开始下一次循环。我们可以参照下面 的例子来理解它: [align=left]    #!/usr/bin/perl -w    use strict;    {    my $x;    for($x=0;$x<10;$x++)      {       if($x==3)          { next;}          print "$x ";      }    } [/align] [align=left]   会打印出 0 1 2 4 5 6 7 8 9,当到了 3 的时候就 next 了,呵呵。next 还可以和标号结合使用退出某一层循环。如下面的例子。 [/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $x;    my $y;    here:       # here 是一个标号     for($x=0;$x<5;$x++)      {       for($y=1;$y<3;$y++)         { if($x==3)            { next here; }            print "$x ";         }       print "\n";      }    } [/align] [align=left]  将会打印 0 0 1 1 2 2 4 4,到 3 的时候跳过标有 here 标号的循环。 [/align] [align=left]  last 相当于 c 语言中的 break,就是跳出循环。例如下面的代码:[/align] [align=left]    #!/usr/bin/perl -w    use strict;    { my $x;    for($x=0;$x<10;$x++)       {        last if($x==3);        print "$x ";       }    } [/align] [align=left]  将会打印 0 1 2。当 $x 增加到 3 的时候就退出了。last 同 next 一样也具有标号的功能。例如下面的代码:[/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $x;    my $y;    there:     for($x=0;$x<10;$x++)       {        for($y=0;$y<3;$y++)          {           last if($x==3);           print("$x ");          }        print("\n");       }    } [/align] [align=left]  会打印出 0 0 0 1 1 1 2 2 2,这里当 $x==3 的条件满足时,就会跳出标有 there 的循环。 [/align] [align=left]  redo 是一个很好玩的东西,这个家伙居然会让当前的一圈循环重新进行一次。但是我到现在都没有发现这个东西有什么用。下面的例子说明了 redo 的用法。[/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $x;    for($x=0;$x<5;)      {       $x++;       redo if($x==4);       print "$x ";      }    } [/align] [align=left]  会打印 1 2 3 5,呵呵,这个结果是很有趣的啊。当 $x==3 的时候,$x++ 结果是 4,然后发生了 redo,结果 4 就没打印出来。然后下一次循环开始了。这个时候又发生了一次 $x++; 结果 $x 变成 5 了,然后打印出来。然后条件检测不通过,退出循环。 [/align] [align=left]  如果把上面的循环改成 [/align] [align=left]    for($x=0;$x<5;$x++)
         {       redo if($x==4);       print "$x ";      } [/align] [align=left]  则在我的机器上面发生了死循环,呵呵。 明天我们就开始使用 cgi 模块写 cgi 程序了,高兴啊,关于程序控制方面的东西以后会一步步补全的。[/align]

  • Perl 编程入门 at 2008年10月30日

    一种编程语言中的控制结构是控制程序流程走向的语句和语法,今天先来学学最基本的三个控制 If、Unless、Until,呵呵,其实跟其他编程语言中的对应语句的用法没有大的区别,我们就通过几个例子来看一看吧。 [align=left]  if 是各种语言中都有的结构,但是 perl 的 if 似乎有点……那个,可称之为 “定语后置”。 具体来说就是这个样子的 [/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $a=3;    print "thank god!" if($a==3);    } [/align] [align=left]  当然这是一个很无聊的程序了,但给大家演示了 perl 中定语是如何后置的。其他地方 if 的用法同其他语言就没什么区别了。又例如下面的例子 [/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $a;    for($a=0;$a<10;$a++)      {       if($a>5) print "haha\n";      }    } [/align] [align=left]  有了 if 就一定会有 else,else 也没有什么特别的。用法如下: [/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $a;    for($a=0;$a<10;$a++)      {       if($a>5) print "haha\n";       else print "lala\n";      }    } [/align] [align=left]  perl 里面有一个特别的控制语句叫做 “elsif” 的,注意,不是 “elseif”,而是 “elsif”,这个语句的作用同 else if 是一样的。使用可以看下面的例子。 [/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $a;    for($a=0;$a<10;$a++)      {       if($a>5) print "haha\n";       elsif($a>3) print "lala\n";       else print "gee!\n";      }    } [/align] [align=left]   Unless 是 If 的反义词,这个关键字的用法和 if 完全一样,但是相当于加上一个!(取非),用一个例子来说:[/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $a;    for($a=0;$a<0;$a++)      {       print "$a\n" if( [b]!$a>5[/b] );
         }    } [/align] [align=left]  和 [/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $a;    for($a=0;$a<0;$a++)      {       print "$a\n" unless( [b]$a>5[/b] );
         }    } [/align] [align=left]  是一样的。 我一直不太明白这个关键字有什么用。 [/align] [align=left]  Until 是 While 的反义词,就是说不执行后面的语句一直到满足条件为止。如下面的例子 [/align] [align=left]    #!/usr/bin/perl -w    use strict;    {    my $a;    for($a=0;$a<0;$a++)      {       until($a==3)        { print "$a\n" unless($a>5);         $a++;        }      }    } [/align] [align=left]  这一段程序打印出 3,好像很无聊是吧?但是有时候会有用的。这里有一个需要注意的是在 until 里面有一个 $a++。没有这个就会……555,死循环了。[/align]

  • Perl 编程入门 at 2008年10月30日

     先来看看 Perl 中的循环结构吧。 [align=left]  1:while 结构 [/align] [align=left]   while 结构在 perl 中有三种形式。 第一种形式是这样的:[/align] [align=left]    #!/user/bin/perl -w    use strict;    {    my $a=0;    while(3>$a)      {       print $a++;       print "\n";      }    } [/align] [align=left]  第二种是定语后置式。呵呵,英文好的觉得很正常了。 [/align] [align=left]    #!/user/bin/perl -w    use strict;    {    my $a=0;    print $a++."\n" while(3>$a);    } [/align] [align=left]  第三种是这个样子的,很古怪,真的很古怪。这种用法就是加上一个 continue:[/align] [align=left]    #!/user/bin/perl -w    use strict;    {    my $a=0;    while(3>$a)      {       print "$a\n";      }    continue      {       if($a++>1) print "hello\n";      }    } [/align] [align=left]  这种结构会在每个 while 运行了一圈之后运行一遍 continue 的部分,然后继续进行 while 循环。 [/align] [align=left]  2:for 结构 [/align] [align=left]  for 结构是各种语言中都有的。perl 中的 for 结构和 c 语言中的非常相近。下面是一个例子。 [/align] [align=left]    #!/user/bin/perl -w    use strict;    {    my $a;    for($a=0;$a<10;$a++)      {       print "$a\n";      }    } [/align] [align=left]  对于数组我们可以这样访问。 [/align] [align=left]    #!/user/bin/perl -w    use strict;    {    my @a=(1..10);    my $counter;    for($counter=0;$counter$a($thiskey)\n";      }    } [/align] [align=left]  将可以把 hash 中所有的 key 和 value 打印出来。呵呵,很好玩吧?[/align]

  • Perl 编程入门 at 2008年10月30日

    数组是 perl 里面一种非常有用的东西。我们可以通过下面的方式定义数组: [align=left][color=#cc0099]   @a=("hello","great","cipher");
       @b=(1,2,3,4,5,6,7); [/align] [align=left]  @b的定义方式还可以写成下面的形式: [/align] [align=left][color=#cc0099]   @b=(1..7); # 这种方式对于需要 1 到 10000 的初始值得数组真实太重要了。       @b=("a".."z"); [/align] [align=left]  也是可以的,但是我想不出来对中国人有什么用。定义一个空数组可以用下面的方式:[/align] [align=left][color=#cc0099]   @c=(); [/align] [align=left]  访问数组通过下面的方式(下标和 c 语言一模一样,从 0 开始,basic 的用户要注意了): [/align] [align=left][color=#cc0099]   $b[0]=10000; [/align] [align=left]  注意这里引导符变成了 $ 不是 @。通过这个变化表示这时正在访问一个单独的数据。而不是一组数据。还可以使用多个下标,但是这时就要使用 @ 引导符了。例如:[/align] [align=left][color=#cc0099]   @b[5,7,9]=(45,56,67); [/align] [align=left]  这种情况下,print $b[8];将会在使用了 perl -w 得到一个使用未定义变量的错误,其他情况下什么都不会发生。[/align] [align=left]  数组之间相互拷贝,可以用下面的方式: [/align] [align=left][color=#cc0099]   @d=@c; [/align] [align=left]  这样要比 c 语言简单多了。同 c 语言不同,perl 的数组是可以动态改变大小的。因此我们可以追加,删除数组内的元素。追加一个元素可以使用这种方式:[/align] [align=left][color=#cc0099]   @c=(@c,"hello"); [/align] [align=left]  perl 里面有一个专门的函数用来惊醒追加操作叫做 push,push 的使用方法如下:[/align] [align=left][color=#cc0099]   push(@c,"hello");
       push(@c,("hello","halloha"));    push(@c,@a); [/align] [align=left]  这里可以看到,可以给数组追加一个元素,一组元素甚至另外一个数组。另外,在 perl 的数组中可以放不同类型的标量。这一点在 c 程序员的眼中可能有点怪异,但是如 果记住 perl 里面的一切都是引用就可以了。或者理解成这是一个 void 类型的指针的数组。有了 push,就一定有 pop。pop 就是从数组的最后取出一个元素。用法为:[/align] [align=left][color=#cc0099]   pop(@a); [/align] [align=left]  既然可以从数组的末尾加入元素,那么一定也可以从数组的开头加入元素。那么这个功能是由 unshift 函数提供的。用法为:[/align] [align=left][color=#cc0099]   unshift(@c,"hello");
       unshift(@c,("hello","halloha"));    unshift(@c,@a); [/align] [align=left]  有了 unshif 就一定会有 shift 了。shift 的功能是从数组的开头取出一个元素。用法为:[/align] [align=left][color=#cc0099]   unshift( @a); [/align] [align=left]  有了操作数组两端的函数那么一定也会有操作数组中间部分的函数,这个函数就是 splice,splice 函数有三个作用。第一个作用是向数组中间的一部分插入内容。例如:[/align] [align=left][color=#cc0099]   @d=(1..9);    my @e=("a".."f");    splice(@d,2,2,@e); [/align] [align=left]  将会得到 12abcdef56789,注意这里是从第二个开始插入,不是从下标为 2 的元素开始插入的。splice 的第二个功能是删除,例如在刚才的代码上面再加上:[/align] [align=left][color=#cc0099]   splice(@d,2,6); [/align] [align=left]  将可以得到 1256789;splice 的第三个功能就是删除到末尾。语法为:[/align] [align=left][color=#cc0099]   splice(@d,2); [/align] [align=left]  就是从第二个开始,删除到末尾。我们还应该有一个可以把整个数组合并成一个标量的函数。这个函数就是 join,join 有两个参数,第一个参数是合并时放在元素之间的分割符,第二个是进行操作的数组。 例如:[/align] [align=left][color=#cc0099]   my @g=(1,2,3);    join(" ",@g); [/align] [align=left]  将可以得到 “1 2 3”,还有三个函数我们昨天已经见过了,就是 undef,chop 和 chomp。undef(@a); 的作用是把@a的内容清空。chop(@a); 的作用是把数组内每个元素的末尾去一个字符。而 chomp(@a); 的作用则是把数组内的每一个元素的末尾的换行符去掉。我们还应该介绍一个函数就是 scalar,这个函数取得数组的长度。例如:[/align] [align=left][color=#cc0099]   my @h=(1,2,3);    scalar(@h); [/align] [align=left]  将可以得到 3。但是我们经常不这么用,因为在将数组向标量转换时就会返回数组的长度,例如下面的操作就可以。[/align] [align=left][color=#cc0099]   my @i=(1,2,3,4);    print @i."\n"; [/align] [align=left]  将会打印出 4。 好了,今天就到这里吧,最后是一个概括了今天大部分内容的程序。我写的。中间会输出很多错误信息。呵呵。[/align] [align=left][color=#cc0099]   #!/user/bin/perl -w    use strict;    { $|=" ";    my @a;    @a=(1,2,3);    @a[4,6]=(23,34);    #print $a[5];    #quoted because it would cause error    my @b;    @b=("because","haul");    push(@b,"grand");    print @b;    print "\n";    push(@b,("puppy","kitty"));    print @b;    print "\n";    push(@b,@a);    print @b;    print "\n";    push(@a,@b);    print @a;    print "\n";    my @c;    @c=(1,2,3,"hello");    print @c;    print "\n";    pop(@a);    print @a;    print "\n";    my @d;    @d=(1..9);    print @d;    print "\n";    my @e=("a".."f");    splice(@d,2,2,@e);    print @d;    print "\n";    splice(@d,2,6);    print @d;    print "\n";    } [/align] [align=left]  嘻嘻,程序很长,不过试着运行一下,全是上面所讲的内容的应用,加深一下你的印象吗。[/align]

  • Perl 编程入门 at 2008年10月30日

    今天来看看标量的操作符,标量可以分为两类:一类是数字,另一类是字符串。在 perl 中这两类数据可以相互转化,但是操作还是有区别的。 [align=left]  下面先介绍数字类型的操作符: [/align] [align=left]  数字类型的运算操作符有一下几种:
      +(加),-(减),(乘),/(除),-(取反)。   不会的举手,好没有。[/align] [align=left]  下面讲一些难的。
      第一个是 “%”(取余)。嗯,会 C 语言的可以退场。这个操作符的使用方法和 “/” 差不多,但是结果是除之后的余数。例如: [color=#cc33cc]   $a=6%5;这时 $a 的值为 1;    $b=5%6; 这时 $b 的值为 5。   如果在进行求余运算时不是整数,那么四舍五入后进行运算,不可以对 0 求余噢![/align] [align=left]  第二个是幂运算(
    )。
      $c=2
    3; 这时 $c 的值为 8。相信我,我写了一个程序实验过的,程序如下: [color=#cc33cc]   #!/user/bin/perl -w
       use strict; {    my $a=2
    3;    print $a;    } [/align] [align=left]   还有两种我们应该知道的运算符是 “++” 和 “--”。“++” 在自身基础上面加一,“--” 在自身基础上减一。这种运算在 c 里面经常用的。[/align] [align=left]  数字的比较运算符有下面几个: “<”,“>”,“<=”,“>=” 我想这几个我就不用解释了。再有一个就是 “==” 这个运算符用来对比两个数字是否相等。然后就是 “!=” 表示两个数字不等。   还有一个好玩的比较运算符是 “<=>”,这个运算符当左边的数字小于右边的时返回-1,相等时返回 0,当左边的大于右边的时返回 1。[/align] [align=left]  另外就是位操作符了,和 c 一摸一样。   位与:& 位或:| 位非:~ 位异或:^ 左移:$x << 1 右移:$x >> 2   注:不要将&用于负整数,因为 PERL 将会把它们转化为无符号数。[/align] [align=left]  然后要讲一讲的是赋值操作符,最基本的赋值操作符是 “=”,(废话!)然后一种是 “+=” 表示在自身基础上面增加。例如:[color=#cc33cc]    $d=3; $d+=3; 这时 $d 就等于 6 了。
      相应的还有 “-=”,“
    =”,“/=”,“*=”,“^=”,“&=”,“|=”,“~=”。 数字的操作符大致就有这些了。[/align] [align=left]  下面是关于字符串的操作符的介绍。两个字符串相加 (连接) 用 “.” 进行。例如: [color=#cc33cc]   $e="hello "."all";   这时 $e 的值为 “hello all” 相应的也就有 “.=” 运算了。   另外还有一个运算符是 x,没错,就是它。用来表示……只可意会,不可言传。 [color=#3333ff][color=#cc33cc]   $f="f"x5;       此时 $f 的值为"fffff",明白了吧?   字符串的比较用以下的操作符进行: [color=#cc33cc]   “lt” 意为 “小于,less than”;    “gt” 意为 “大于,greater than”;    “eq” 意为 “等于,equal”;    “le” 意为 “小于等于,less than or equal”;    “ge” 意为 “大于等于,greater or equal”;    “ne” 意为 “不等于, not equal”;    “cmp” 意为 “比较,返回 1, 0, or -1,compare”。   可以看出来字符串的操作和数字的操作是相对的。   另外对字符串可以进行 “++” 运算,这时将会把字符串的 ascii 码加一。但是"z"++ 却是"a","Z"++ 是"A","9"++ 是 0,"ab99"++ 将会得到"ac00"。呵呵,很好玩吧?字符串是没有-,,/等运算的。如果我们对字符串进行这些运算则表示我们要把字符串转换成数字然后进行计算。如果这个字符串是"111"还好说,如果我们强制 perl 把例如"aaaaa"一类的字符串进行数字运算,perl 会把这些字符串转换成 0。因此"aaa"--将会得到-1。很好玩是不是?呵呵,perl 还有很多好玩的东西。[/align] [align=left]  对标量进行操作还可以使用下面的函数。   第一个是 length(),这个函数可以返回变量打印出来的长度。例如: [color=#3333ff][color=#cc33cc]   length(23),将会返回 2;    length("hahaha"),将会返回 6;    length(1) 将返回 1。
      在 perl5 中 length("你好"),将会返回 4,听说在 perl5.6 中将不会。我没有实验过,不好说什么。   第二个函数是 chop()。这个函数将会节掉字符串中的最后一个字符,例如: [color=#3333ff][color=#cc33cc]   $g="aaa";
       chop($g);
      这时 $g 中的值是"aa";同时 chop 会返回它所截下来的字符。试一试 $g="你好"; chop($g); 会发生什么?   第三个函数是 chomp(),这个函数仅仅将字符串末尾的换行符裁掉。   第四个函数是 substr() 这个函数可以从一个字符串中截取一段长度的字符串并将其返回。例如: [color=#cc33cc]   $h="hello all";    $i=substr($h,3,5)
      将会从 “hello all” 中截取长度为 5 的字符串,就是"lo al"。试一试这样呢? [color=#cc33cc]    $h="你们好吗?";    $i=substr($h,3,5);   第五个很有用的函数就是 defined(),这个函数用来判断一个数据是否已经定义。在 perl 中,一个数据如果没有定义,那么他将会是一个叫做 undef 的特殊值。 defined() 是一个非常有用的函数。至少我经常用。有其是在判断 cgi 输入的时候。[/align] [align=left]  ok,今天就这么多了。两天就睡了三个小时,明天再继续吧![/align]

  • Perl 编程入门 at 2008年10月30日

    perl 语言中的变量有以下五种:   标量,指针,数组,哈希表(hash)和句柄。 一、标量   我们先来看看标量,标量是 perl 语言中最简单的一种数据类型。这种数据类型的变量可以是数字,字符串,浮点数,不作严格的区分。在使用时在变量的名字前面加上一个 “$”,表示是标量,相当于 scalar 中的第一个 S。

      使用以下格式进行定义:    $myfirst= 123;           # 数字 123      $mysecond="123";          # 字符串 123        $mythird= "$myfirst,$mysecond";   # 字符串 123,123    $myforth= '$myfirst,$mysecond';   # 字符串 $myfirst,$mysecond   数字类型的标量可以使用 0 开头代表是 8 进制,用 0x 开头代表是 16 进制。例如:    $var1= 017;             # 十进制的 15    $var2= 0xf;             # 十进制的 15   还可以使用下面的格式:    $var3= 123_456_7;          # 1234567   浮点数可以使用以下定义方式:    $var4= 3.4;    $var5= 4.3e+21;    $var6= 234E345;

      perl 中的字符串使用一个标量来表示,定义方式和 c 很像,但是在 perl 里面字符串不是用 0 来表示结束的。而且使用双引号和单引号定义的字符串是不一样的。使用双引号定义的字符串里面出现的变量名会进行替换,而且可以出现 “\n\r\t” 等控制字符。而用单引号定义的就不可以了使用反斜杠引导的控制命令了(当然还可以使用反斜杠引道单引号和反斜杠),文本会按照字符串原来的样子保存。   但是用单引号定义可以使用多行文本,如下所示:    $var7='这是一个使用    多行字符串文本    的例子';    $var8= '\'\';    # 字符串'\

    二、数组   在 Perl 中数组使用 “@” 引导,“@” 的意义应该是相当于 array 中的第一个 a 吧 (嘻嘻,猜的)。数组初始化使用()。我们可以采用如下方法初始化数组:    @var9=(1,2,3,4,5);   而当引用数组中的元素时则使用下面的格式:    $var10=$var9[1];   数组前面的引导字符变成了 “$”,表示这里是引用数组中的元素。   如果使用 “@” 作引导字符,那么刚才的例子就会返回数组的长度。例如:    $length=@var9;       # 则 $length 会返回数组长度也就是数组的元素个数 5

    三、哈希表(hash)   哈希表是一种很特别的数据结构,我在学习数据结构时见过,叫做散列(Set),在使用 perl 之前,我在 borland C++ 中见过一种类似的 class,也叫做 Set。在 JavaScript 中也提供了相似的数据结构,叫做关连数组 Associated Array。

      哈希表用 “%” 引导。定义方法如下:    %var11=("hello"=>"哈罗","nihao"=>"你好");

      使用方法如下:    print $var11{"hello"};  # 输出 哈罗 $var11{"nihao"}="你好";   还可以使用下面的方法定义:    %var12= ("hello","哈罗","nihao","你好");   这个方法的结果与上面的结果相同,但是我还是喜欢第一种方法,而且建议你也使用第一种方法。

    四、句柄

      句柄是一种特殊的数据,用来保存系统资源的指针,例如文件,目录,管道,socket 等等。在最新的 perl 中,实际上可以不使用这种数据。句柄类型没有引导字符。一般情况下大家习惯使用大写字母来标明句柄类型。例如下面的例子打开一个文件,读出一行,然后关闭。    open(FILEHANDLE,"test.htm");    $templine=;    close(FILEHANDLE);   这里<>起从句柄中读出一行的作用。

    五、指针   perl 里面的指针分为两种类型,一种成为软指针,另一种称为硬指针。下面将主要介绍一下硬指针。在 perl 里面使用 “\” 来生成指针。如下面的例子:    $vavr13="hello";    $pointerto=\$var13;   这时 $pointerto 就是一个指向 $var13 的指针了。访问指针指向的数据可以使用下面的方法。print $$pointerto; 也就是加上一个 $ 就可以了。perl 里面的指针与 c 里面的不同,perl 里面的指针是有引用计数的。也就是说,如果一个数据可以记住自己被几个指针引用,当没有指针引用时这个数据会自动释放内存。

  • CPAN 常见问题集 at 2008年10月30日

    You can fix this with the following steps;

    1. Open "My Computer" or Windows NT Explorer.
    2. Select the "View" menu.
    3. Select "Options".
    4. Click the "File Types" tab.
    5. Scroll through the "Registered file types" until you reach "WorldView VRMLViewer Object" and select it.
    6. Click "Remove".
    7. Answer "Yes". (I've never seen these VRML files WorldView claims to be caring about: if you have and you do care, please tell me how to make WorldView stop caring about the .gz and application/x-gzip)
    8. Quit and restart your browser for the change to take effect.
    9. The next time you try open a file ending in .gz Windows will ask you which application to use to open that file. Scroll down to WinZiP (winzip32), and remember to check the box asking whether to always use this application to open this type of file unless, of course, you plan on regularly using the VRML viewer.

    我从哪里可以找到 GDBM_FILE/DB_FILE 模块呢?

    GDBM_FILE 是随着标准 PERL 5 而发布的。

    你所遇到的问题可能是因为你的系统上没有 LIBGDBM 或 GNU DBM 这个库文件,GDBM_FILE 依赖于这些文件,这个和你的 perl 是没有什么关系的,你可以从这里得到帮助 http://www.gnu.org/

    如果你在找 DB_FILE 的话,他也需要这个叫 libdb 的库文件,你可以从发布该库文件的地方得到帮助http://www.sleepycat.com/。 如果我使用 search.cpan.org 时有问题,我该联系谁呢?

    如果你使用 search.cpan.org 时因为网络或服务器而不能正常使用的话,请联系 webmaster@search.cpan.org。

    How do I search for anything on CPAN?

    By using a CPAN search engine.

     

    * http://www.perldoc.com/ * http://search.cpan.org/ - Graham Barr's search engine which can search for modules, distributions or authors in all of CPAN. * http://kobesearch.cpan.org/ - Randy Kobes' search engine that can also search all of CPAN for modules, documentation, etc. * http://wait.cpan.org/ - full text search of pods on PAUSE.

    How do I search for module/script documentation? (also known as "How do I use ..."?)

    In general modules and scripts come with their own documentation which should have been installed along with your module/script. (Thanks to Perl's pod-style documentation, "it is very hard to misplace your documentation".)

     

    * perldoc Module::Name * perldoc scriptname * http://www.perldoc.com/ * http://search.cpan.org/ * http://wait.cpan.org/ * http://theoryx5.uwinnipeg.ca/CPAN/

    我可以从哪儿查找资料 (不仅仅是 perl 的)?

    * http://www.google.com/ * http://ragingsearch.altavista.com/ * http://www.altavista.com/ * http://hotbot.lycos.com/ * http://www.lycos.com/ * http://www.yahoo.com/

    我从哪里可以找到 Ralph Nader?

    找错地方了,你应该到这里来看看 http://www.cspan.org/。 我要如何上传模块到 CPAN 上去?

    如果你愿意学习 PAUSE 并且你也愿意发布你的模块的话,请参考 PAUSE FAQ(http://www.cpan.org/modules/04pause.html,这篇文章会告诉你如何得到 PAUSE) ID 以及如何上传你的模块。另外你还可以参考 perldoc perlmodlib 和 perldoc perlmod 这两个文档。 CPAN 上允许上传共享软件或者其他的收费软件吗?

    否。所有的在 CPAN 上的东西都是免费的。之所以这样的原因是因为 CPAN 是由成百上千的人们付出时间和其他资源而建立起来的 perl 社区,如果你想要发布共享软件请到其他的地方去!!!

    我如何才可以上传我的脚本到 CPAN 上去?

    CPAN 有一个脚本的收集地点http://www.cpan.org/scripts/,而如果你想要上传脚本的话, http://www.cpan.org/scripts/submitting.html也会给你很多帮助的!! 我要如何在 CPAN 上发布文档?

    如果你的文档是基于某个模块的,请将文档发送给作者。而如果是通用文档的话,请发到 Perl5Porters 邮件列表上!!

    How do I report/fix a bug in Perl and/or its documentation?

    Always remember to make your bug reports as detailed as possible. "Perl doesn't work." is not a bug report.

    Please note that problems concerning modules that are installed separately from the Perl distribution (such as Tk) are reported differently.

    Here is a checklist from perlbug, a bug reporting tool included in your Perl distribution. It is a bit on the long side, but please read it carefully as the better your bug report is, the more likely the issue will be addressed.

    * What version of Perl you are running?

    Try perl -v at the command line to find out. * Are you running the latest released version of perl?

    Look at http://www.perl.com/ to find out. If it is not the latest released version, get that one and see whether your bug has been fixed. Note that bug reports about old versions of Perl, especially those prior to the 5.0 release, are less likely to be incorporated into the source as Perl1 through Perl4 are largely unmaintained. * Are you sure what you have is a bug?

    A significant number of the bug reports we get turn out to be documented features in Perl. Make sure the behavior you are witnessing doesn't fall under that category, by glancing through the documentation that comes with Perl (we'll admit this is no small task, given the sheer volume of it all, but at least have a look at the sections that seem relevant).

    Be aware of the familiar traps that perl programmers of various hues fall into. See the perltrap documentation.

    Check in perldiag to see what any Perl error message(s) mean. If message isn't in perldiag, it probably isn't generated by Perl. Consult your operating system documentation instead.

    If you are on a non-UNIX platform check also perlport documentation, some features may not be implemented or work differently.

    Try to study the problem under the Perl debugger,if necessary. See the perldebug documentation. * Do you have a proper test case?

    The easier it is to reproduce your bug, the more likely it will be fixed, because if no one can duplicate the problem, no one can fix it. A good test case has most of these attributes: fewest possible number of lines; few dependencies on external commands, modules, or libraries; runs on most platforms unimpeded; and is self-documenting.

    A good test case is almost always a good candidate to be on the perl test suite. If you have the time, consider making your test case so that it will readily fit into the standard test suite.

    Remember also to include all the exact error messages, if any. "Perl complained something" is not an exact error message.

    If you get a core dump (or equivalent), you may use a debugger (dbx, gdb, etc) to produce a stack trace to include in the bug report. NOTE: unless your Perl has been compiled with debug info (often -g), the stack trace is likely to be somewhat hard to use because it will most probably contain only the function names and not their arguments. If possible, recompile your Perl with debug info and reproduce the dump and the stack trace. * Can you describe the bug in plain English?

    The easier it is to understand a reproducible bug, the more likely it will be fixed. Anything you can provide by way of insight into the problem helps a great deal. In other words, try to analyze the problem (to the extent you can) and report your discoveries. * Can you fix the bug yourself?

    A bug report which includes a patch to fix it will almost definitely be fixed. Use the diff program to generate your patches (diff is being maintained by the GNU folks as part of the diffutils package, so you should be able to get it from any of the GNU software repositories). If you do submit a patch, the cool-dude counter at perlbug@perl.com will register you as a savior of the world. Your patch may be returned with requests for changes, or requests for more detailed explanations about your fix.

    Here are some clues for creating quality patches: Use the -c or -u switches to the diff program (to create a so-called context or unified diff). Make sure the patch is not reversed (the first argument to diff is typically the original file, the second argument your changed file). Make sure you test your patch by applying it with the patch program before you send it on its way. Try to follow the same style as the code you are trying to patch. Make sure your patch really does work (make test, if the thing you're patching supports it). * Can you use perlbug to submit the report?

    perlbug will, amongst other things, ensure your report includes crucial information about your version of perl. If perlbug is unable to mail your report after you have typed it in, you may have to compose the message yourself, add the output produced by perlbug -d and email it to perlbug@perl.com. If, for some reason, you cannot run perlbug at all on your system, be sure to include the entire output produced by running perl -V (note the uppercase V).

    Whether you use perlbug or send the email manually, please make your Subject line informative. "a bug" is not informative. Neither is "perl crashes" nor "HELP!!!" These don't help. A compact description of what's wrong is fine.

    Having done your bit, please be prepared to wait, to be told the bug is in your code, or even to get no reply at all. The Perl maintainers are busy folks, so if your problem is a small one or if it is difficult to understand or already known, they may not respond with a personal reply. If it is important to you that your bug be fixed, do monitor the Changes file in any development releases since the time you submitted the bug, and encourage the maintainers with kind words (but never any flames!). Feel free to resend your bug report if the next released version of perl comes out and your bug is still present.

    How do I report/fix a bug in a module/script?

    Use http://rt.cpan.org/ to open a bug ticket.

    Please contact the author of the module/script. The documentation of the module/script should contain a contact address or you can try CPANID@perl.org where CPANID is the authors CPANID.

    Most of the checklist in reporting bugs in Perl above applies for modules as well. Make your bug report as good as possible if you really want the bug fixed. If the module is included with the Perl distribution you should also follow the Perl bug reporting tips.

    我要如何报告/修复在模块/脚本中的 bug 呢?

    使用http://rt.cpan.org/BUG。去报告

    How do I go about maintaining a module when the author is unresponsive?

    Sometimes a module goes unmaintained for a while due to the author pursuing other interests, being busy, etc. and another person needs changes applied to that module and may become frustrated when their email goes unanswered. CPAN does not mediate or dictate a policy in this situation and rely on the respective authors to work out the details. If you treat other authors as you would like to be treated in the same situation the manner in which you go about dealing with such problems should be obvious.

    * Be courteous. * Be considerate. * Make an earnest attempt to contact the author. * Give it time. If you need changes made immediately, consider applying your patches to the current module, changing the version and requiring that version for your application. Eventually the author will turn up and apply your patches, offer you maintenance of the module or, if the author doesn't respond in a year, you may get maintenance by having interest. * If you need changes in order for another module or application to work, consider making the needed changes and bundling the new version with your own distribution and noting the change well in the documentation. Do not upload the new version under the same namespace to CPAN until the matter has been resolved with the author or CPAN.

    Simply keep in mind that you are dealing with a person who invested time and care into something. A little respect and courtesy go a long way.

    Is there a site for module bug reports/tests?

    Yes, through the diligence of Paul Schinder and a few others, we have CPAN Testers which is a collection of test results for modules on a number of different platforms. This information is also available when viewing module information on CPAN search.

    There is also http://rt.cpan.org/ where you might search for a module bug already reported and/or report a bug.

    Does CPAN provide download statistics for authors?

    No we don't. http://xxx.lanl.gov/help/faq/statfaq sums up our thoughts on the matter quite well.

    How do I mirror CPAN?

    Either an FTP or rsync client will do. Scantily clad virgins and pale moonlight are optional and are not included in the sales price.

    What do I need to mirror CPAN?

     

    * "Good" Internet connectivity, e.g. better than a 14.4 modem but not so much as an OC3. * Around 1GB of storage space. http://www.cpan.org/indices/du-k.gz tells you the current size of the CPAN. * An FTP or rsync client.

      o For FTP there is a Perl script named mirror (which assumes a command line FTP client): http://sunsite.org.uk/packages/mirror/

    The FTP address for the CPAN master site is: ftp://ftp.funet.fi/pub/languages/perl/CPAN/

      o and for rsync: http://rsync.samba.org/

    A few mirrors who have rsync addresses available for CPAN are: cpan.mirror.smartworker.org::CPAN theoryx5.uwinnipeg.ca::CPAN ftp.shellhung.org::CPAN ftp.funet.fi::CPAN ftp.gwdg.de::FTP/languages/perl/CPAN/ ftp.leo.org::CPAN CPAN.piksi.itb.ac.id::CPAN ftp.iglu.org.il::CPAN gusp.dyndns.org::cpan ftp.kddlabs.co.jp::cpan cpan.teleglobe.net::CPAN ftp.sedl.org::cpan archive.progeny.com::CPAN mirrors.kernel.org::mirrors/CPAN mirrors.phenominet.com::CPAN mirror.csit.fsu.edu::CPAN csociety-ftp.ecn.purdue.edu::CPAN  

    Once you have the rsync client installed on your system and the disk space mapped out, you may then add an entry to your crontab [ if using UNIX, AT if using Windows NT ] like the following example:

    0 20 * * * /usr/local/bin/rsync -av --delete ftp.funet.fi::CPAN /project/CPAN/ >/dev/null 2>&1

    AT 20:00 /every:M,T,W,Th,F,S,Su "C:\Program Files\Rsync\rsync -av --delete ftp.funet.fi::CPAN /project/CPAN/ >/dev/null 2>&1"

    I have Windows 2000/NT/98/95, how can I mirror CPAN?

    By using rsync for NT.

    Which CPAN site should I mirror?

    The one that gives the best bandwidth (where your mirror finishes quickest) and which is most up-to-date. Most up-to-date is, by definition, the CPAN master site ftp.funet.fi. Note that it lives in the GMT+2 time zone so please try not to mirror during working hours: 0600 to 1400 GMT/UTC. If you want to mirror from somewhere else, check the list at http://www.cpan.org/SITES.html or at http://mirror.cpan.org/.

    Please organize the mirroring with the corresponding FTP maintainer (their email addresses from the file http://www.cpan.org/MIRRORED.BY or http://mirror.cpan.org/) so that you will not overload their site and that your mirror starts just after theirs has finished.

    A few tips to keep in mind:

    * For your mirror site to be useful to your users you should mirror daily. * You can also provide a HTTP interface in addition to an FTP interface to CPAN if you wish to do so. * Consider also giving rsync access to your mirror. Many people like rsync because it's very bandwidth-friendly. * Remember to tell cpan@perl.org about all the access methods you provide to your mirror: ftp, http, or rsync (or any other methods).

    How do I register my mirror to make it a public resource?

    If you want to publicize your CPAN mirror (meaning that your mirror is publicly available), please use the on-line form at http://mirror.cpan.org/mirror.cgi or fill in the following template which can be found from the top of the file http://www.cpan.org/MIRRORED.BY:

    我要如何注册我的镜像站点以便公众可以访问呢?

    hostname.of.the.CPAN.mirroring.site: frequency = "daily/bidaily/.../weekly" dst_ftp = "ftp://the.same.host.name:/CPAN/mirror/directory/" dst_http = "http://the.same.host.name:/CPAN/mirror/directory/" dst_rsync = "the.same.host.name::CPAN" dst_location = "city, (area?, ) country, continent (lat long)" dst_organisation = "full organisation name" dst_timezone = "GMT[+-] n" dst_bandwidth = "Approximate connection speed,e.g. T1, E3, etc." dst_contact = "email.address.to.contact@for.this.mirror" dst_src = "host.that.you.mirror.from" dst_loadbal = "Y" or "N" Join the load balancing pool for ftp.cpan.org dst_notes = "(optional field) access restrictions, for example?"  

    There are plenty of examples of how to fill in the template file. When your template is ready, please send it to cpan@perl.org and you will be registered.

  • CPAN 常见问题集 at 2008年10月30日

    我如何知道某个模块是否可以安装在我的系统上

    http://testers.cpan.org上查看那些模块可以安装哪些系统上,哪些又不能安装!!

    CPAN testers 是由 Graham Barr 和 Chris Nandor 发起的测试所有的 CPAN 上的模块在各个平台上是否可用的一个组织,从那上面你可以得到很详细的关于某个模块在某个平台上是否可用的信息,你可以从它的主页上得到详细的信息!!同时如果你愿意为了 perl 尽一份力的话,你也可以加入进来! 我要如何手工安装模块到非标准的目录中去呢?

    首先你需要在运行 Makefile.PL 时制定安装的 prefix 和 lib。lib 是将模块文件安装的地方而 prefix 则是其他文件的安装地。例如

    yifeng@lab1213$ perl Makefile.PL LIB=/home/yifeng/mylib PREFIX=/home/yifeng/mylib

    其他相关的资料请参考 ExtUtils::MakeMaker 文档。 我要如何使用一个安装在非标准目录下面的模块?

    这儿有以下几种方法可以使用:

    * yifeng@lab1213 $ setenv PERL5LIB /path/to/module 来设置环境变量 PERL5LIB。 * 在每个使用那些模块的头部加上 use lib qw(/path/to/module); * yifeng@lab1213 $ perl -I/path/to/module 这个是在编译时使用的方法。

    所有的这些方法都会添加/path/to/module 到@INC这个环境变量当中去。同时请记住,使用非标准目录的话对程序的可移植性有影响。 我要如何才能找到最近上传的模块呢?

    这里每天都有如此多的模块上传上来以至于很难完全的跟上模块的更新,不过还是有以下几种方法可以使用的

    * http://search.cpan.org/recent * http://theoryx5.uwinnipeg.ca/mod_perl/cpan-search?request=recent * http://use.perl.org/

    这三个站点可以让你每天查看最新的上传模块。 我在哪儿可以发现用于 Windows 的模块呢?

    http://aspn.activestate.com/ASPN/Products/ActivePerl-5.6/faq/ActivePerl-faq2.html 有一个关于它的包管理器的 FAQ,http://www.northbound-train.com/perlwin32.htmlwindows 的资源。也有一系列包括模块在内的可以用于 从哪儿我可以得到 perl 的二进制包或者 perl 模块的二进制包呢?

    http://www.cpan.org/ports/index.htmlURL。我们不做任何可用的保证,也不会将他们放到 CPAN 上来因为我们的空间有限。有目前我们知道的所有可用的二进制包。如果你有基于某个平台的二进制包,请发给我们

    perl 模块的用于 ActivePerl 的二进制包可以从这里得到http://www.activestate.com/PPMPackages/. perl 以及 CPAN 是如何授权的?

    绝大多数 (不是全部) 在 CPAN 上的模块是基于 GPL 授权的或者作者自己会在模块当中声明。如果版权没有在模块中声明,你可以写信给模块作者以便弄清楚版权问题。

    Open Source 组织有一个官方的版权声明,你可以在这儿找到:http://www.opensource.org/licenses/index.html.

    CPAN 和 PAUSE 并不拥有任何的版权,我们强烈要求作者在模块中声明版权问题,如果你需要版权方面的帮助,我们建议你寻找相关的律师

    一般版权应该声明在模块根目录下面的'README'文件中,如下:

    Perl Kit, Version 5.0

    Copyright 1989-1999, Larry Wall All rights reserved.

    This program is free software; you can redistribute it and/or modify it under the terms of either:

    a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" which comes with this Kit.

    This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details.

    You should have received a copy of the Artistic License with this Kit, in the file named "Artistic". If not, I'll be glad to provide one.

    You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA or visit their web page on the internet at http://www.gnu.org/copyleft/gpl.html.

    For those of you that choose to use the GNU General Public License, my interpretation of the GNU General Public License is that no Perl script falls under the terms of the GPL unless you explicitly put said script under the terms of the GPL yourself. Furthermore, any object code linked with perl does not automatically fall under the terms of the GPL, provided such object code only adds definitions of subroutines and variables, and does not otherwise impair the resulting interpreter from executing any standard Perl script. I consider linking in C subroutines in this manner to be the moral equivalent of defining subroutines in the Perl language itself. You may sell such an object file as proprietary provided that you provide or offer to provide the Perl source, as specified by the GNU General Public License. (This is merely an alternate way of specifying input to the program.) You may also sell a binary produced by the dumping of a running Perl script that belongs to you, provided that you provide or offer to provide the Perl source as specified by the GPL. (The fact that a Perl interpreter and your code are in the same binary file is, in this case, a form of mere aggregation.) This is my interpretation of the GPL. If you still have concerns or difficulties understanding my intent, feel free to contact me. Of course, the Artistic License spells all this out for your protection, so you may prefer to use that.   编准 perl 源文件中包括模块吗?

    当然了,perl 发布版本中包括一系列有用的模块,并且他们可以从 perlmodlib 文件中找到

    * http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlmodlib.html * perldoc perlmodlib

    有哪些模块是平台相关的?

    一些平台相关的 perl 模块已经"bundle"了许多平台相关的模块,其他的你可以从下面找到 (下面的太多,也没有什么用,我就不翻译了)

    IBM OS/2

    The following modules come with standard Perl.

    OS2::DLL Access to DLLs with REXX calling convention and REXX runtime. OS2::ExtAttr Access to extended attributes. OS2::PrfDB Access to the OS/2 setting database. OS2::Process Constants for \tool{system}(2) call on OS/2. OS2::REXX Access to DLLs with REXX calling convention and REXX runtime.

    DEC (Open) VMS

    The following modules come with standard Perl.

    VMS::DCLsym Perl extension to manipulate DCL symbols. VMS::Filespec Converts between VMS and Unix file specification syntax. VMS::Stdio Standard I/O functions via VMS extensions. VMS::XSSymSet Keeps sets of symbol names palatable to the VMS linker.

    Microsoft Windows (32 bit)

    The following modules come with ActiveState Perl.

    Win32::ChangeNotify Monitors events related to files and directories. Win32::Console Uses Win32 Console and Character Mode Functions. Win32::Event Uses Win32 event objects. Win32::EventLog Processes Win32 Event Logs. Win32::File Manages file attributes. Win32::FileSecurity Manages FileSecurity Discretionary Access Control Lists. Win32::IPC Loads base class for Win32 synchronization objects. Win32::Internet Accesses WININET.DLL functions. Win32::Mutex Uses Win32 mutex objects. Win32::NetAdmin Manages network groups and users. Win32::NetResource Manages network resources. Win32::ODBC Uses ODBC Extension for Win32. Win32::OLE Uses OLE Automation extensions. Win32::OLE::Const Extracts constant definitions from TypeLib. Win32::OLE::Enum Uses OLE Automation Collection Objects. Win32::OLE::NLS Uses OLE National Language Support. Win32::OLE::Variant Creates and modifies OLE VARIANT variables. Win32::PerfLib Accesses the Windows NT Performance Counter. Win32::Process Creates and manipulates processes. Win32::Semaphore Uses Win32 semaphore objects. Win32::Service Manages system services. Win32::Sound Plays with Windows sounds. Win32::TieRegistry Mungs the registry. Win32API::File Accesses low-level Win32 system API calls for files and directories. Win32API::Net Manages Windows NT LanManager accounts. Win32API::Registry Accesses low-level Win32 system API calls from WINREG.H.

    从哪儿我可以找到 perl 脚本呢?

    * http://www.cpan.org/scripts/index.html * http://www.perlarchive.com/ * http://freshmeat.net/ * 其他的也有 perl 脚本的地方 (废话:<)

    从哪儿我可以得到 perl FAQ?

    perl FAQ 是包括在 perl 发行版本里面的,你可以使用"perldoc perlfaq"得到,当然你也可以到这儿来看看http://perlfaq.cpan.org/ 从哪儿我可以得到 perl 的文档呢?

    * http://www.cpan.org/doc/index.html * http://perldoc.cpan.org/ * 在你的系统上敲入 perldoc perldoc 就可以了 * http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlfaq2/Perl_Books.html 如果你还想要看看更多的文章而又有钱去买的话。

    从哪儿我可以找到 perl 模块的文档

    * http://search.cpan.org/, * http://wait.cpan.org/ * perldoc Foo::Bar 如果模块已经安装了的话,Foo::Bar 使你安装了的模块。

    我从哪儿可以找到 perl 的 DBI/DBD/database 文档?

    * http://dbi.symbolstone.org/ - 权威的 DBI 说明 * http://www.savebaseball.com/mysql/DBD_3.21.X.php3 -Mysql 的 perl 接口说明书 * http://theoryx5.uwinnipeg.ca/CPAN/data/DBI/DBI.html - DBI 的帮助文档 * 运行 perldoc DBI

    从哪儿我可以找 perl 的邮件列表?

    这儿有几个 perl 的邮件列表,你可以看看:

    * http://lists.perl.org/ * http://www.perl.com/pub/language/info/mailing-lists.html, * http://www.perl.org/support/mailing_lists.html * http://www.mail-archive.com/

    大多数的邮件列表都是公开的,你可以加入。如果你没有发现感兴趣的邮件列表而想要创建一个的话,你可以写信给 lists@perl.org 区要求建立一个邮件列表。 从哪儿我可以找到关于 perl 的杂志呢?

    * http://www.tpj.com/ - 发行的关于 perl 的传统杂志 * http://www.perlmonth.com/ - 一个在线的关于 perl 的杂志 * http://www.unixreview.com/ * http://www.stonehenge.com/merlyn/WebTechniques/ - Randal Schwartz' Web Techniques Columns. * http://www.usenix.org/publications/login/login.html - ;login, the publication of USENIX. * http://www.samag.com/ - System Admin Magazine has occasional Perl articles.

    从哪儿我可以找到关于 perl 培训/学习的资料?

    培训

    * http://training.perl.com/ * http://www.perltraining.org/ * http://www.perl.org/phbs/training.html

     

    在线教程

    * http://www.ebb.org/PickingUpPerl/ * http://www.speech.cs.cmu.edu/~sburke/pub/perl.html * http://www.comp.leeds.ac.uk/Perl/start.html * http://www.cpan.org/doc/FMTEYEWTK/index.html * http://www.cclabs.missouri.edu/things/instruction/perl/perlcourse.html * http://www.perltraining.com/idiom.pdf

    我如何才能找到并加入一个 perl 用户小组?

    perl 用户小组又被称为"Perl Mongers",现在在世界各地都有活跃的 perl 小组。你可以在http://www.pm.org/groups.shtmlhttp://www.pm.org/start.shtml 创建一个加入一个小组。或者你也可以在这里 我从哪儿可以找到 perl 的老版本和 perl 的发展历史?

    一个关于 perl 的老版本发布史的资料可以从这两个地方找到,一是 perldoc perlhist,二是从这里http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlhist.html找到。

    更多更详细的关于 perl 历史的资料可以从这里找到http://history.perl.org/。 当我下载模块时出现问题,我该怎么办?

    当你遇到问题想要联系我们时请先查看以下各个问题,我们每天都检查各个镜像站点以保证他们可用,但还是会有各种各样的问题会发生,请确保你查看了以下问题:

    * 你用什么工具下载? web 浏览器? ftp 工具? * 你是使用的哪一个服务器? 请注意:对大多数的请求,我们的智能导航仪都将会把你带到离你最近的服务器上,如果你是使用的 web 浏览器的话,请注意查看一下 URL 地址。

    你也可以先回到http://www.perl.com/CPANhttp://www.perl.com/CPAN 上去。上然后选择一个镜像站点,以后你就会默认的被指向到该站点,如果想要改变的话,也请到 * 具体的出错信息! 我们需要你的详细的出错信息,请将它们发送给我们 (如果可能的话) * 你重新试过了吗? 服务器可能当时正忙,你可能稍后重试的时候就好了!!

    我下载了的模块/脚本/文件有问题,该怎么办?

    许多的 CPAN 上的文件以.tar.gz 结尾,但不幸的是有一些程序会改变他们的名字 (例如:把他们改成_tar.tar),因此你的解压缩没有办法识别并且解开它,你可以试试将后缀名改为.tgz 或者换一个浏览器,看看是否可以。如果可以的话,你可以使用 FTP 下载,绝大多数的站点都是支持 FTP 下载的,你可以从这里找到镜像站点的列表 http://www.cpan.org/SITES.htmlhttp://mirror.cpan.org/。

    如果你是用 FTP 下载的话,请打开 BINARY 模式,不要使用 TEXT 模式。

    如果你对如何正确的解开包有疑问的话,你可以到这里看看http://www.cpan.org/ENDINGS

    如果还是有问题的话,你可以试试换一个服务器下载,如果还是不行的话,请写信给我们,同时请附上文件名以及路径和服务器名。 我要如何使用 Foo::Bar 这个模块,可以帮帮我吗?

    对不起,我们不提供这样的服务,只有与 CPAN 相关的问题我们才给予解答。我们也不会替你查看你的程序代码。

    如果你有什么这方面的问题的话,请先查看帮助文档,如果还不行的话,请到 comp.lang.per.modules 上去寻求帮助。

    When downloading a module a strange VRML viewer started up and I got an error, what should I do?

    You saw an error window "VRML Console" saying "Compilation error: Unrecognized header string". The reason the VRML viewer starts is that there is a type of compressed VRML file with a .gz extension, using (theoretically) the standard gzip compression. The VRML folk used .gz as a means of cutting down the download time on the old wrl files. Most VRML browsers come with a mini gunzip program. See also the VRML FAQ which also covers this problem.

  • CPAN 常见问题集 at 2008年10月30日

    我怎样才能知道安装了哪些模块在我的机子上呢?

     

    * perldoc perllocal

    每当你安装了一个模块,它就会在一个叫 perllocal.pod 的文件中添加如下所示的信息。而该文件所在地依赖于你所定义的 PATH 路径,PATH 路径可以使用 perl -V 显示出来。

    下面是添加在 perllocal.pod 中的文件

    =head2 Wed May 12 13:42:53 1999: C LData::Dumper

    =over 4

    =item *

    C

    =item *

    C

    =item *

    C

    =item *

    C

    =back  

    每个条目包括模块名字,安装日期和时间,安装到哪儿,链接形式 (动态还是静态),版本号以及是否可执行,以及其他相关的一些信息! * 使用 ExtUtils::Installed 模块

    ExtUtils::Installed 提供了一个用来寻找已安装模块的标准方法。他从.packlist,一个安装模块时创建的文件中得到所需的信息,另外它还提供将安装文件分类的能力和从".packlist"文件中读取目录信息的能力。

    例子如下: #!/usr/local/bin/perl

    use ExtUtils::Installed; my $instmod = ExtUtils::Installed->new(); foreach my $module ($instmod->modules()) {

    my $version = $instmod->version($module) || "???";  

    print "$module -- $version\n"; }  

    运行后输出内容如下:

    Apache::DBI -- 0.87 Apache::DBILogConfig -- 0.01 Apache::DBILogger -- 0.93 AppConfig -- 1.52 Archive::Tar -- 0.22 BerkeleyDB -- 0.06 CGI -- 2.74 CPAN -- 1.59 CPAN::WAIT -- 0.27 Catalog -- 1.00 Compress::Zlib -- 1.11 Config::IniFiles -- 2.14 Convert::BER -- 1.26 Coy -- ??? Crypt::Rot13 -- 0.04 Crypt::SSLeay -- 0.16 DBI -- 1.14 [.....]  

    * ActivePerl 使用 PPM 工具包,方法如下;

    C:>ppm query Archive-Tar [0.072 ] module for manipulation of tar archives. Compress-Zlib [1.03 ] Interface to zlib compression library DBI [1.13 ] Database independent interface for Perl GD [1.25 ] Interface to Gd Graphics Library HTML-Parser [2.23 ] SGML parser class MIME-Base64 [2.11 ] Encoding and decoding of base64 strings PPM [1.1.4 ] Perl Package Manager: locate, install, upgrade software  

      * pmtools 工具包是由 Tom Christiansen 写了用来浏览和管理模块的工具,可以从这儿的到它 [url=http://language.perl.com/misc/pmtools-1.00.tar.gzhttp://language.perl.com/misc/pmtools-1.00.tar.gz[/url]] ,它的一部分帮助文档:

    pmtools --一套用来帮助管理模块的小程序。里面的每一个程序都只做一件事情,其中包括一下小程序 o pmpath - 显示模块的绝对路径 o pmvers - 显示模块版本号 o pmdesc - 得到关于模块的概述 o pmall - 显示所有已安装模块的 pmdesc 描述 o pmdirs - 分行显示 perl 模块的路径 o plxload - 显示程序运行时加载了什么文件 o pmload - 显示模个模块编译时加载了什么文件 o pmexp - 显示模块的接口 o pminst - 查找安装了哪些模块 o pmeth - 列出一个类的所有方法 o pmls - 详细列出模块路径 o pmcat - 显示模块源码 o pman - 显示模块的 pod 文档 o pmfunc - 显示一个模块中函数的源码 o podgrep - 在 pod 文档中查找 o pfcat - show pods from perlfunc o podtoc - list table of contents of a podpage o podpath - 显示 pod 文件的绝对路径 o pods - 列出所有标准 pod 以及模块 pod o sitepods - list only pods in site_perl directories o basepods - list only normal "man-page" style pods o faqpods - list only faq pods o modpods - all module pods, including site_perl ones o stdpods - list standard pods, not site_perl ones

    什么是"bundle",我要如何制作一个"bundle"或我要如何使用从 CPAN 上获得的"bundle"呢?

    第三版的"Programming Perl"将"bundle"定义为 “一组在 CPAN 上的相关联的模块”,这个定义十分明确但它没有告诉你如何去制作一个 “bundle”。一个"bundle"可以是任何一组的模块,可以相关也可以不相关。"bundle"是给 CPAN.pm 用来快速的安装一组模块的。

    一个"bundle"就是一个位于 Bundle::名字空间的模块,但她与其他模块不一样,他里面没有一个模块用来安装,只有一个列表列出需要安装的模块。有不少的现成的"bundle"你可以去参考,然后你可以自己依样做出一个来。

    你可以从 search.cpan.org 得到一个"bundle"的列表,如果你在 CPAN.pm 下面敲入 ‘b’ 的话,也可以得到一个当前允许的"bundle"列表。 如下;

    cpan> b Bundle Bundle::ABH (A/AB/ABH/Bundle-ABH-1.04.tar.gz) Bundle Bundle::AO::Base (I/IX/IX/AO-0.32.tar.gz) Bundle Bundle::AO::Standard (I/IX/IX/AO-0.32.tar.gz) Bundle Bundle::Apache (D/DO/DOUGM/mod_perl-1.25.tar.gz) Bundle Bundle::Apache::ASP (C/CH/CHAMAS/Apache-ASP-2.09.tar.gz) Bundle Bundle::Apache::Roaming (J/JW/JWIED/Apache-Roaming-0.1003.tar.gz) Bundle Bundle::BioPerl (C/CR/CRAFFI/Bundle-BioPerl-1.00.tar.gz) Bundle Bundle::Bonsai (Z/ZL/ZLIPTON/Bundle-Bonsai-0.02.tar.gz) [....]  

    如果你在'b'后面加上模块参数,它可以列出关于这个模块的详细信息。

    cpan> b Bundle::DBI Bundle id = Bundle::DBI CPAN_USERID TIMB (Tim Bunce ) CPAN_VERSION 1.03 CPAN_FILE T/TI/TIMB/DBI-1.15.tar.gz MANPAGE Bundle::DBI - A bundle to install DBI and required modules. CONTAINS Storable Net::Daemon RPC: IlServer Getopt::ong DBI INST_FILE /usr/local/lib/perl5/site_perl/5.005/sun4-solaris/Bundle/DBI.pm INST_VERSION 1.03

    制作一个"bundle"需要以下两步;

    1. 使用 CPAN.pm 的自动生成"bundle"功能 如果你没有使用参数的运行"autobundle"的话,它就会自动的将所有系统上的系统打包制作一个系统级的"bundle",如果你只是想要加入一部分模块到"bundle"里面的话,只需要给出想要加入的模块列表,如下:

       

      foo@bar /home/chaos/monkey> perl -MCPAN -eshell

      cpan> autobundle CGI Crypt::Rot13 Date::Christmas Date::Manip

      Going to read /home/chaos/monkey/.cpan/sources/authors/01mailrc.txt.gz CPAN: Compress::Zlib loaded ok Going to read /home/chaos/monkey/.cpan/sources/modules/02packages.details.txt.gz Going to read /home/chaos/monkey/.cpan/sources/modules/03modlist.data.gz

      Package namespace installed latest in CPAN file CGI 2.74 2.753 L/LD/LDS/CGI.pm-2.753.tar.gz Crypt::Rot13 0.04 0.04 A/AY/AYRNIEU/Crypt-Rot13-0.04.tar.gz Date::Christmas 1.01 1.02 H/HF/HFB/Date-Christmas-1.02.tar.gz Date::Manip 5.39 5.39 S/SB/SBECK/DateManip-5.39.tar.gz

      Wrote bundle file /home/chaos/monkey/.cpan/Bundle/Snapshot_2001_05_09_01.pm

      "Snapshot_2001_05_09_01.pm"这个文件就可以用来安装了,如下 perl -MCPAN -e 'install Bundle::Snapshot_2001_05_09_01' 如果找不到 snapshot 的话,请检查你的 CPAN.pm 配置是否正确。

      接下来就要将配置文件输出了,如下: cpan> o conf cpan_home cpan_home /home/chaos/monkey/.cpan

      如果你是系统管理员或者你想要将你想要发布你的模块到大量的机器上面去的话,那么你就会知道这个小工具是多么的棒,如果你有兴趣的话,还可以研究一下它。

    2. 制作发布到 CPAN 上去的"bundle"版本

    * "bundle"制作先创建一个框架,像这个样子: foo@bar /home/chaos/monkey> h2xs -AXcfn Bundle::MyBundle Writing Bundle/MyBundle/MyBundle.pm Writing Bundle/MyBundle/Makefile.PL Writing Bundle/MyBundle/test.pl Writing Bundle/MyBundle/Changes Writing Bundle/MyBundle/MANIFEST * 然后编辑 MyBundle.pm 文件 o 删除所有在模块中的申明,版本号 o 编辑名字并添加'-descriptive info'在名字中 o 添加 C到 synopsis 中去。 o 添加"=head1 CONTENTS",在他下面加入所有包括在"bundle"中的模块。 ModuleName [ optional version ] [ - comment or description ] 其中在 comment 前面的'-'是必须的。 o 添加总体概述 o 添加作者和版权信息

    具体例子如下:

    package Bundle::MyBundle;

    $VERSION = '0.01';

    1; END

    =head1 NAME

    Bundle::MyBundle - Bundle of my very favourite modules

    =head1 SYNOPSIS

    C

    =head1 CONTENTS

    CGI 2.74 - CGI is groovy baby Crypt::Rot13 - This would make for some interesting web pages Date::Christmas - defies description Date::Manip

    =head1 DESCRIPTION

    These modules rock, especially when installed together!

    =head1 AUTHOR

    Ima Bundle [email=ima@bundle.com] ima@bundle.com[/email]

    =head1 LINCENSE

    Steal this code!

    =head1 SEE ALSO

    perl(1).

    =cut

     

      o 移除目录中所有不再需要的文件,例如'Changes'和'test.pl' ,添加一个 README 文件,写入一些简短的描述,加入"bundle"中所包括的模块名称。更新 MANIFEST 文件使它与"bundle"中所包含的文件相吻合 。 o 使用'perl Makefile.pl'然后'make dist’,那么 Bundle-MyBundle-0.01.tar.gz 就构造好了。如下:

     

    foo@bar monkey/Bundle/MyBundle> perl Makefile.PL

    Checking if your kit is complete... Looks good Writing Makefile for Bundle::MyBundle

    foo@bar monkey/Bundle/MyBundle> make dist rm -rf Bundle-MyBundle-0.01 /usr/bin/perl -I/usr/local/lib/perl5/5.00503/sun4-solaris -I/usr/local/lib/perl5/5.00503 \ -MExtUtils::Manifest=manicopy,maniread -e "manicopy(maniread(),'Bundle-MyBundle-0.01', 'best');" mkdir Bundle-MyBundle-0.01 tar cvf Bundle-MyBundle-0.01.tar Bundle-MyBundle-0.01 a Bundle-MyBundle-0.01/ 0K a Bundle-MyBundle-0.01/Makefile.PL 1K a Bundle-MyBundle-0.01/MyBundle.pm 1K a Bundle-MyBundle-0.01/README 1K a Bundle-MyBundle-0.01/MANIFEST 1K rm -rf Bundle-MyBundle-0.01 gzip --best Bundle-MyBundle-0.01.tar  

    以上就是所有的工作了,好好利用它你回受益无穷。

    [[i] 本帖最后由 scmroad 于 2008-10-30 15:10 编辑 ]

  • 配置管理员职责有哪些? at 2008年10月29日

    you are most welcome

  • 结束语

    我希望您觉得本文有趣而且实用。尽您所能去利用它——我已经用了多年的时间来完善我的设置,它应该会为您带来好处。

    多次分步骤转换到这个模式,不要被吓倒。您可以轻松地用几天时间来重新编写您的配置——所以逐步来完成,您将从这个过程中得到乐趣。

    您将看到的最大的好处是自动更新功能。在您的任何机器上,您可以提交一个文件,然后下次 maintain.pl 运行时它就会出现于所有其他机器上。即使您不赞同那个目录结构,也应该考虑自动更新的能力以及它们会如何给您带来帮助。

    您获得的第二个好处是配置存档。您的配置的每个版本都将在版本控制系统中! 如果您犯了错误,可以恢复到一个较早的版本。如果您失去了整个机器,比如,出现了硬盘错误——您可以在几分钟之内恢复花了很多时间为其编写的所有配置文件。

    不要尝试将所有内容转换到这一模式。只转换您希望保存或重用的内容。二进制文件不适于使用 CVS——至少,不具备 CVS 为文本文件所提供的 diff 能力。此外,重命名目录时 CVS 会有问题,尽管当然有可能您也重命名了仓库中的目录。

    最后,为您的 CVSROOT 仓库做好备份,不管是在哪里。希望您永远不要用到它们

    参考资料

    * 您可以参阅本文在 developerWorks 全球站点上的 英文原文.

    * 下载本文中用到的 maintain.pl 脚本和 maintain.conf 配置文件。

    * 阅读 功能丰富的 Perl 专栏中 Ted 的所有 Perl 文章。

    * CVS home 中有很多 CVS 相关的链接。免费的软件版本系统包括 Subversion 和 GNU arch(也称为 GNU tla)。商用的产品包括 Rational ClearCase。

    * Jennifer Vesperman 的 Essential CVS(O'Reilly & Associates, 2003)是一个很好的 CVS 概述,Gregor Purdy 的 CVS Pocket Reference, 2nd edition(O'Reilly & Associates, 2003)是一个极好的 CVS 快速参考——我极力推荐它。

    * Karl Fogel 和 Moshe Bar 的 Open Source Development with CVS, 3rd Edition(Paraglyph Press, 2003)是一本免费的在线图书;您也可以 在书店购买一本。

    * Version Control with Subversion(O'Reilly & Associates, 2004)是一本有趣的读物。

    * 要学习 C shell、bash、Emacs 以及很多别的 Linux 和 UNIX 程序的配置, dotfiles.com 是一个极好的参考资料。它是被极力推荐的;当您把整个周末用于浏览这个站点时,不要抱怨我们。

    * OpenSSH 是对 SSH 协议的一个标准的、免费的、非常好的实现。 CVS Pserver 对匿名 CVS 访问来说很好,但不安全。

    * 在 Daniel Robbins 的 OpenSSH 密钥管理(developerWorks,2001 年 7 月)这一由三部分组成的系列文章描述了如何在 ssh-agent 的帮助下进行非交互登录。

    * AppConfig 是一个用于解析命令行选项和配置文件的 CPAN 模块。在 功能丰富的 Perl:用 Perl 进行应用程序配置(developerWorks,2000 年 10 月)中,Ted 演示了 AppConfig 模块可以怎样为 Perl 程序处理本地配置存储,以及这种配置可以怎样存储在数据库中以使得可以自网络上的任何机器进行访问。

    * 您可能还希望阅读 理解 Linux 配置文件(developerWorks,2001 年 12 月),它解释了 Linux 系统中控制用户权限、系统应用程序、后台程序、服务和其他管理任务的那些配置文件。

    * 同时, 调试 configure(developerWorks,2003 年 12 月)讨论了当配置文件损坏和自动配置脚本不生效时应该如何去做。给用户和开发者的提示帮您将失败减到最少。

    * 在 developerWorks Linux 专区 可以找到更多为 Linux 开发者准备的参考资料。

    * 在 Developer Bookstore Linux 区中定购 打折出售的 Linux 书籍。

    * 从 developerWorks 的 Speed-start your Linux app 专区下载可以运行于 Linux 之上的经过挑选的 developerWorks Subscription 产品免费测试版本,包括 WebSphere Studio Site Developer、WebSphere SDK for Web services、WebSphere Application Server、DB2 Universal Database Personal Developers Edition、Tivoli Access Manager 和 Lotus Domino Server。要更快速地开始上手,请参阅针对各个产品的 how-to 文章和技术支持。

    关于作者

    Teodor Zlatanov

    Teodor Zlatanov 于 1999 年从美国波士顿大学(Boston University)毕业,获得计算机工程硕士学位。他从 1992 年起就从事程序员的工作,使用过 Perl、Java ?、C 和 C++。他的兴趣是文本解析、三层客户机 - 服务器数据库体系结构、UNIX 系统管理、CORBA 和项目管理方面的开放源码工作。可以通过 tzz@bu.edu 与 Ted 联系。

    http://www.ibm.com/developerworks/cn/linux/

  • 人生本无忌 谈笑色影间 at 2008年10月28日

    而在无形的方面,摄影带给你的收获那就更丰厚、更弥足珍贵了。 因为摄影,通过影像作品,你认识了亚当斯、布列松、寇德卡、李元……等中外 [url=http://www.xitek.com/forum/showthread.php?threadid=253621/url];通过文字理念,你认识了巴特、桑塔格、本雅明、阮忠义……等 [url=http://www.xitek.com/forum/showthread.php?threadid=53026] 摄影理论 [/url] 学家;通过 [url=http://www.xitek.com/forum/showthread.php?threadid=240572] 网络论坛 [/url],你认识了 “Xitek”、“135F2DC”、“G2”、“shishamo”……等 [url=http://www.xitek.com/forum/showthread.php?threadid=241340] 摄影发烧友的 ID[/url]。] 摄影大师 [

    因为摄影,你看到 [url=http://forum.xitek.com/showthread.php?threadid=189335/url],尽管你不认识他们,但你依然感到欣慰快乐。因为摄影,你看到 [url=http://www.cameraunion.net/forum/showthread.php?threadid=172454] 朋友的逝去 [/url],尽管你也不认识他,但你依然感到唏嘘悲伤。因为摄影,你看到 [url=http://forum.xitek.com/showthread.php?threadid=148286] 携手到白头的爱 [/url],因为摄影,你看到 [url=http://forum.xitek.com/showthread.php?threadid=204133] 援手在无声世界里的爱 [/url]。] 别人的爱情 [ [b] 摄影就是爱 [/b]。

    因为摄影,你看到 [url=http://www.xitek.com/forum/showthread.php?threadid=177770/url]、[url=http://forum.cameraunion.net/showthread.php?threadid=133071] 老 [/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=241127] 病 [/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=254105] 死 [/url] 生 [] ……因为摄影,你躲进 [url=http://www.xitek.com/forum/showthread.php?threadid=234572/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=82628] 鸟 [/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=216285] 鱼 [/url]、[url=http://forum.xitek.com/showthread.php?threadid=34844] 虫 [/url] 中,借以忘忧:[url=http://www.xitek.com/forum/showthread.php?threadid=258090] 品品黑白的味道 [/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=219643] 探探色彩的本质 [/url]。] 花 [ [b] 摄影就是避难所 [/b]。

    因为摄影,你 [url=http://www.xitek.com/forum/showthread.php?threadid=187413/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=99060] 穿越西藏 [/url];因为摄影,你前往 [url=http://forum.cameraunion.net/showthread.php?threadid=229044] 动物王国:肯尼亚 [/url],你去过 [url=http://article.xitek.com/showarticle.php?id=518] 行色天堂:尼泊尔 [/url];因为摄影,你曾 [url=http://www.xitek.com/forum/showthread.php?threadid=264405] 七年间,行走秦岭,远山苍茫 [/url];因为摄影,你也曾 [url=http://forum.xitek.com/showthread.php?threadid=263325] 蜜月里,面朝大海,春暖花开 [/url];因为摄影,你见证了 [url=http://forum.xitek.com/showthread.php?threadid=219835] 在珠峰 [/url],人类力量的伟大;因为摄影,你也见证了 [url=http://www.xitek.com/forum/showthread.php?threadid=212766] 在巴以 [/url],人类力量的可怕。] 走过欧洲 [ [b] 摄影就是在场 [/b]。

    因为摄影,你 [url=http://www.xitek.com/forum/showthread.php?threadid=201945/url];因为摄影,你 [url=http://forum.xitek.com/showthread.php?threadid=190544] 寻访历史 [/url];因为摄影,你记录下 [url=http://forum.xitek.com/showthread.php?threadid=190974] 西方的飞扬青春 [/url];也记录下 [url=http://www.xitek.com/forum/showthread.php?threadid=129194] 东方的年少意气 [/url];因为摄影,你伤感于 [url=http://www.cameraunion.net/forum/showthread.php?threadid=179954] 即将消失的风景线 [/url] 和 [url=http://www.xitek.com/forum/showthread.php?threadid=155089] 古老的部落文明 [/url];因为摄影,你记录下 [url=http://www.xitek.com/forum/showthread.php?threadid=168767] 浪漫温馨 [/url] 的 [url=http://www.xitek.com/forum/showthread.php?threadid=190514] 魅力瞬间 [/url];也记录了 [url=http://www.xitek.com/forum/showthread.php?threadid=172579] 模糊感觉 [/url] 的 [url=http://www.xitek.com/forum/showthread.php?threadid=239047] 记忆碎片 [/url]。也因为摄影,你得以发泄快感,你走向你生活的 [url=http://forum.xitek.com/showthread.php?threadid=242805] 城市 [/url] 街头进行 [url=http://forum.cameraunion.net/showthread.php?threadid=207985]“扫街”[/url],[url=http://www.xitek.com/forum/showthread.php?threadid=254661] 无所谓 [/url] 主流 [url=http://www.xitek.com/forum/showthread.php?threadid=246943] 非主流 [/url] 体验时尚 [] ,[url=http://forum.xitek.com/showthread.php?threadid=225986&pagenumber=1/url]?!] 管它什么啊是什么 [ [b] 摄影就是当下 [/b]。

    尽管你已习惯了 [url=http://forum.xitek.com/showthread.php?threadid=197748/url],尽管你也拍下了 [url=http://forum.xitek.com/showthread.php?threadid=232182] 一些景,一些人 [/url]。但你突然发现,[b] 用图片小结你的历程 [] 摄影让你真正看到的,并不是镜头前的这个世界,而是相机后的你自己。一张反映真实的记录照片或一组充满善意的人文照片或一幅极具精美的风光照片,其实只取决于拍摄者你自己的心灵是否真、善、美。“照片上拍下的是别人,留下的却是你自己”。你拍下的不是外面的风景,而是你的内心,At the heartof the Image——[url=http://forum.xitek.com/showthread.php?threadid=199664/url] 相由心生 [] [/b]

    [b] 或许摄影真的并非生活的全部,然而,或许你生活的全部本身就是一次摄影 [/b]。你发现,你才是这个世界上最完美的相机:[b] 对这个世界睁一只眼闭一只眼的态度就是你的 “取景器”;对于 “底片” 的要求,也是对于你的胸怀的要求:宽容、细腻;你的心就是 “光圈”:越是细心,看到越多。放开心灵,就要难得糊涂;而 “快门速度” 则是你一辈子的时间;真、善、美就是构图时的对焦主体;活在当下的每一刹那,就是摁下快门时的 “决定性的瞬间” [/b]……

    于是,有时你放下相机,[url=http://www.xitek.com/forum/showthread.php?threadid=137572/url],[url=http://www.xitek.com/forum/showthread.php?threadid=87466] 听听音乐 [/url],[url=http://www.xitek.com/forum/showthread.php?threadid=70051] 看看电影 [/url]……[url=http://www.xitek.com/forum/showthread.php?threadid=254483] 煮一杯咖啡 [/url],思考思考 [url=http://www.xitek.com/forum/showthread.php?threadid=103724] 宇宙是什么 [/url];[url=http://www.xitek.com/forum/showthread.php?threadid=188280] 沏一壶茶 [/url],研究研究 [url=http://forum.xitek.com/showthread.php?threadid=243907] 中医的真谛 [/url]。] 读读书 [ 于是,你放下一切,一心念 [url=http://forum.xitek.com/showthread.php?threadid=232998/url]:[url=http://www.cameraunion.net/forum/showthread.php?threadid=143632] 阿弥陀佛 [/url]、[url=http://www.cameraunion.net/forum/showthread.php?threadid=196684] 阿弥陀佛 [/url]、[url=http://www.cameraunion.net/forum/showthread.php?threadid=199143] 阿弥陀佛 [/url]、[url=http://www.cameraunion.net/forum/showthread.php?threadid=152408] 阿弥陀佛 [/url]、[url=http://www.cameraunion.net/forum/showthread.php?threadid=149574] 阿弥陀佛 [/url]……] 佛 [

    午夜,你从梦中醒来,怀着感恩之情。你拿出相机,里面没有胶卷,你闭上眼,摁下快门,[b] “咔嚓” 一声,怦然心动 [/b]……

    [b] ----"形而下者谓之器" [/b]

    [b] ----"形而上者谓之神" [/b]

    (全文完)

    [i][color=#0000ff] 个人视角观点,难免有失偏颇,游戏灌水文字,不必认真对错

    http://forum.xitek.com/showthread.php?threadid=258936&pagenumber=1

  • 人生本无忌 谈笑色影间 at 2008年10月28日

    然而,就是那位给你 LEICA M 选择建议的” 沧桑”,又对你说:[url=http://www.cameraunion.net/forum/showthread.php?threadid=158241Leica 的朋友,推荐你一种新选择——Contax]” 想升级到 645”[/url].于是,你又发现了一片新天地:[url=http://www.cameraunion.net/forum/showthread.php?threadid=52288/url]。你开始中了 [url=http://forum.cameraunion.net/showthread.php?threadid=159234] 中画幅的毒 [/url]。当你看到一个人 [url=http://www.cameraunion.net/info/showarticle.php?id=1795] 用哈苏拍的美景 [/url],一个人 [url=http://forum.cameraunion.net/showthread.php?threadid=156291] 用禄来拍的美人 [/url] 后。你决定,中画幅你的首选非哈苏即禄莱。于是,你一三五把自己关进 [url=http://forum.cameraunion.net/showthread.php?threadid=127553] 哈苏集中营 [/url],二四六再加入到 [url=http://forum.cameraunion.net/showthread.php?threadid=203485] 禄来 6008 协会 [/url]。你明白了 [b] 中画幅相机 [] 卡尔 - 蔡司真正的魅力其实是体现在中画幅的领域中的 [/b]。最后,在建构一整套中画幅系统工程前,你决定拿下一台 [url=http://forum.cameraunion.net/showthread.php?threadid=216921/url] 玩玩先。] 禄来双反 [ 你喜欢上一手玩哈苏 X-PAN,一手玩禄来双反的 “HR” 双修的感觉:一宽一方两种画幅,正暗合了张弛有道一放一收两种心境。 当你参观 [url=http://www.xitek.com/forum/showthread.php?threadid=245476612&617&624 俱乐部 [/url] 后,你决定要好好研究一下 [url=http://forum.cameraunion.net/showthread.php?threadid=221227] 617 产品的现状与发展 [/url]。然后,你计划用宽大的重器:[url=http://www.cameraunion.net/forum/showthread.php?threadid=93050] LINHOF] 中画幅 617[/url] 和重磅的利器:[url=http://www.xitek.com/forum/showthread.php?threadid=126563HASSELBLAD] 503CW[/url] 分别作为哈苏 X-PAN 和禄来双反的升级版。

    出来混,迟早要还的。[b] 就如同 135 的宿命是 LEICA [/b],很快,你发现,对你而言,[b] 120 的宿命就是——[url=http://article.cameraunion.net/showarticle.php?id=1933ALPA[/url、[url=http://forum.xitek.com/showthread.php?threadid=258485ALPA[/url、[url=http://forum.xitek.com/showthread.php?threadid=227630ALPA[/url]] 、[url=http://forum.xitek.com/showthread.php?threadid=248157ALPA[/url]] 、[url=http://forum.xitek.com/showthread.php?threadid=176051ALPA[/url]] [/b]……

    或许,从某种意义上讲,ALPA 是 MF(中画幅)的终点,同时,又是 LF(大画幅)的起点。因为,你从 ALPA 的广告上看到这样一句话:“THINGS ARE SIMPLE AT THE TOP”,大道至简! 随着对画幅的追求,很快,你便关注起 [url=http://forum.cameraunion.net/showthread.php?threadid=33707/url] 和 [url=http://forum.cameraunion.net/showthread.php?threadid=222313] 大画幅镜头 [/url]。你开始垂涎 [url=http://www.xitek.com/forum/showthread.php?threadid=147984] 4*5[/url] 的:[url=http://www.cameraunion.net/forum/showthread.php?threadid=140403] Linhof] 大画幅相机 [ Master Technika 2000[/url] 了。当然,也保不定你什么时候还会去迷恋 [url=http://www.xitek.com/forum/showthread.php?threadid=1547498*10[/url]]......

    事实上,你发现,[b] 大画相机最最吸引你的不仅是因胶片面积变大而使得画质的提升,而更是,它带给你迥然不同于 135、120 的摄影理念。从某种意义上讲,120 只不过是放大的 135。135 如果是汉堡包中间的一块 beef,那 120 就是法国大餐里红酒牛排,而大画幅则是:冬天里的一碗热粥。 [/b] 当初,你刚踏上摄影之路,拿起 135SLR 时,初学构图、曝光之术。你领悟了 [b] 摄影的根本是光影 [/b]。你追求的是 MTF、是 Bokeh,你知道了 [url=http://article.xitek.com/showarticle.php?id=2072/url] 的重要性,镜头是相机的灵魂。你知道了摄影是减法,你喜欢用大光圈,你喜欢用长焦镜。你想 [b] 选购镜头 [] 把你看到的东西以最美的方式表现出来 [/b]; 而后你玩上了 135RF 的时候,又 [b] 体验到把人的行为凝固下来的那一刹那间的快乐。 [/b] 你苛求的是快门时滞和快门声响。同时你又喜欢上广角镜,你用超焦距,你用盲拍,你颠覆了摄影是减法的理念。你开始学习摄影语言,你要表达的是关系,画面里各元素的关系、摄者与被摄者的关系。你开始想 [b] 通过相机来走进这个人类社会; [/b] 自从你尝试使用了超越 135 画幅的相机后,你开始 [b] 迷恋起细节的展现 [/b]。你颠覆了镜头是相机的灵魂的理念,[b] 底片大小才是画质好坏最根本的分水岭 [/b],你开始关注的是胶片的面积和画幅的长宽。你开始明白了量变到质变的飞跃,一个微小的细节在 135 极限的尺寸内或许只是一点瑕玼,而把它放大到中画幅相机所能展现的尺寸内就变成了点睛之笔。你 [b] 拿起中画幅相机走进大自然中去,你见山不是山,见水不是水。 [/b] 而大画幅相机,它则让你回到摄影根本,它让你回味摄影本身。它让你走进自己的内心。 摄影是看的艺术,相机是摄影的工具。而 [b] 大画幅相机让你体悟到摄影对于你的真谛:让你的心静下来。止,而后能观。 [/b]

    于此时,你突然发现,你对照相机发烧的道路方向却恰恰是逆反于照相机发展的方向。为了与时俱进,你开始关注起数码浪潮了。于是,你有点迷茫了,是 [url=http://www.xitek.com/info/showarticle.php?id=959Olympus] 4/3 系统 [/url] 呢?还是 [url=http://www3.xitek.com/digital/foveon/foveon.htmSIGMA] SD 运用 Foveon 的 X3 技术 [/url] 比较好?又或者是 [url=http://www.xitek.com/info/showarticle.php?id=1866Super] 富士的 CCD[/url]?作为已入 N 门的你不可能不对 [url=http://www.xitek.com/info/showarticle.php?id=955NIKON 的 LBCAST[/url 表示关注;[url=http://forum.xitek.com/showthread.php?threadid=198099NIKON 的 D70[/url 可能是目前最有人缘、最具 “亲切感” 的 DSLR 了;而在高端,使用 COMS 的 [url=http://www.xitek.com/info/showarticle.php?id=2059EOS-1Ds] Mark Ⅱ[/url] 在目前独持牛耳。同时,你又从 [url=http://www.xitek.com/info/showarticle.php?id=2030Leica] Digital-Modul-R[/url] 中看到某种希望,而这种希望很难说不会从 [url=http://article.cameraunion.net/showarticle.php?id=1986Nikon] F6[/url] 上得以实现。相似的,在旁轴领域, [url=http://www.xitek.com/info/showarticle.php?id=2028Zeiss] Ikon[/url] 给人以经典旁轴的数码化遐想。另外,你又十分垂涎 [url=http://www.xitek.com/info/showarticle.php?id=2092Konica-Minolta 的防抖 (AS) 系统 [/url,而 [url=http://www.xitek.com/info/showarticle.php?id=2025Olympus 所特有的超声波除尘系统 [/url,你也认为是 DSLR 所不能或缺的一个功能。你相信 [url=http://www.xitek.com/info/showarticle.php?id=2059EOS-1Ds] Mark Ⅱ[/url] 和 [url=http://www.xitek.com/info/showarticle.php?id=1616DSC] 柯达的 Pro SLR/c[/url]、[url=http://www.xitek.com/info/showarticle.php?id=1557DCS] Pro SLR/n[/url] 已对传统的 120 系统产生了极大的冲击,但 [url=http://www.xitek.com/info/showarticle.php?id=2036Mamiya] ZD[/url] 以及哈苏和易迈康的联姻下的 [url=http://www.xitek.com/info/showarticle.php?id=2039H1D[/url,又让你看到了 120 相机的反击……] [b] 数码真让人感到浮躁 [/b]。 最后,你决定你的数码化道路将分成两条路走。一条路是数码相机的道路,买一台 [url=http://forum.xitek.com/showthread.php?threadid=209382LC-1[/url 或 [url=http://forum.xitek.com/showthread.php?threadid=212142Pro] 1[/url],体验一把不计成本胡乱拍拍先的感觉,走走 [url=http://forum.xitek.com/showthread.php?threadid=234719LOMO 道路 [/url],或走进 [url=http://forum.xitek.com/showthread.php?threadid=234034] 非 LOMO 的反摄影联盟 [/url]。[url=http://forum.xitek.com/showthread.php?threadid=250363] 小 DC[/url] 权当作口袋机用,玩厌了就送给家人。] 发现自我的 而对于认认真真拍的 PP,你觉得暂时还是先玩玩胶片机,你总觉得目前还没一台可换镜头的数码相机,能有 [url=http://article.cameraunion.net/showarticle.php?id=1986Nikon] F6[/url]、[url=http://www.xitek.com/product/showproduct.php?productid=3405Leica] MP[/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=126563HASSELBLAD] V 系列 [/url] 等那么成熟,反正是自娱自乐嘛,不以此技讨生活。对你,数码化不是为了方便出片,而只不过是为了方便交流。于是,另一条数码化道路就是底片数码化的道路。先拿下 [url=http://www.xitek.com/forum/showthread.php?threadid=222248Nikon] 5000 ED 或 Nikon 9000 ED[/url], 再配个 [url=http://forum.cameraunion.net/showthread.php?threadid=197127Epson] Perfection 4870[/url] 以备 NIKON 底扫不方便扫的场合使用。当然,作为数码的观片工具,[url=http://www.cameraunion.net/forum/showthread.php?threadid=219635/url] 马虎不得,还得要个 [url=http://www.xitek.com/forum/showthread.php?threadid=218534] 色彩校准仪 [/url] 折腾折腾 [url=http://www.xitek.com/forum/showthread.php?threadid=179245] GAMMA[/url]……而 [url=http://www3.xitek.com/topic/print/printf.html] 数码打印机 [/url],你也观望起来先。] 显示器 [ 其实,你知道,玩数码唯一绕不开的是 [url=http://xitek.travel.sohu.com/forum/showthread.php?threadid=123013PHOTOSHOP[/url。[b]] 无论你是想从 [url=http://article.cameraunion.net/showarticle.php?id=1635DSLR 上得到漂亮的片子 [/url,还是想 [url=http://www.cameraunion.net/info/showarticle.php?id=1178 通过 SCANNER 得到一张通透的图片 [/url,[url=http://www.xitek.com/forum/showthread.php?threadid=215474Photoshop(数码处理)[/url 才是数码图片的竞技场] [/b]:[url=http://www.xitek.com/forum/showthread.php?threadid=180971/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=150512] 调调直方图 [/url]、[url=http://forum.xitek.com/showthread.php?threadid=251973] 锐化 [/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=209824] 磨皮 [/url]......你开始 [url=http://www.xitek.com/forum/showthread.php?threadid=212907] 循序渐进地学习 [/url] PS 的 [url=http://www.xitek.com/forum/showthread.php?threadid=115994] 基础知识 [/url]。] 管理管理色彩 [

    你知道,[url=http://www.cameraunion.net/forum/showthread.php?threadid=153029/url] 是潮流所趋,玩 [url=http://forum.xitek.com/showthread.php?threadid=130025] NIKON] 从传统走向数码 [ D100 的 “听蓝” 资深 [/url]、使 [url=http://forum.xitek.com/showthread.php?threadid=208896S2/S3 的 “元素” 编辑 [/url]、用 [url=http://forum.xitek.com/showthread.php?threadid=204512] SIGMA] 富士 SD9/SD10 的马帮帮主 “猪猪”[/url],他们的作品让你中毒不浅。何况 [url=http://www.xitek.com/forum/showthread.php?threadid=233377/url]。[b] 数码变量本身就被称作第八种武器 [] 其实无论数码还是胶片,从你的内心深处知道:[url=http://www.cameraunion.net/forum/showthread.php?threadid=122229/url] 没有什么可以改变摄影的本质![] [/b]

    你看看你先后业已收藏了一屋子的 [url=http://www.xitek.com/forum/showthread.php?threadid=174266/url]、[url=http://forum.xitek.com/showthread.php?threadid=184699] 铭器 [/url],突然产生了:“[url=http://forum.xitek.com/showthread.php?threadid=259903] Minolta] 大炮 [ TC-1 + Leica CM[/url],[url=http://forum.xitek.com/showthread.php?threadid=160305/url]” 的念头。你问自己成为摄影发烧友以来,到底是什么带给了你快乐?] 人生足矣 [

    是那些借以 [url=http://forum.xitek.com/showthread.php?threadid=220281/url] 的器材吗?] 亮骚 [ 有一点。 你把所有的器材 [url=http://www.cameraunion.net/forum/showthread.php?threadid=106195/url] 后放在 [url=http://forum.xitek.com/showthread.php?threadid=73093] 防潮柜 [/url] 里,慢慢欣赏器材本身的各种造型,你有一种 “此物只应天上有” 的感觉,管它 [url=http://forum.xitek.com/showthread.php?threadid=244340] 来自火星,还是来自水星 [/url],而幸福感油然而生。] 保养 [

    是那些 [url=http://www.cameraunion.net/forum/showthread.php?threadid=109260/url] 的掌握吗?] 摄影技术、技巧 [ 也有一点。 学习本身就是一种快乐,这种快乐出现在你苦学 [url=http://www.cameraunion.net/forum/showthread.php?threadid=59403/url] 的时候;这种快乐出现在你钻研 [url=http://article.xitek.com/showarticle.php?id=1982] 动态范围和宽容度 [/url] 的时候;这种快乐出现在你解决 [url=http://www.xitek.com/forum/showthread.php?threadid=258741] 构图错误 [/url] 的时候;这种快乐出现在你克服 [url=http://www.xitek.com/forum/showthread.php?threadid=201205]“在大街上拍摄时产生的心理障碍”[/url] 的时候] 区域测光法 [......

    是那些通过相机而得到的精美的 [url=http://www3.xitek.com/4years/4years.htm/url] 吗?] 摄影作品 [ 更有一点。 看看 [url=http://forum.xitek.com/showthread.php?threadid=180181/url],瞅瞅 [url=http://www.xitek.com/forum/showthread.php?threadid=254470] 时尚 MM[/url],糖水养眼啊。] 四季美景 [

    然而,[b] 摄影并非生活的全部。摄影带给你的快乐,更多的是在 [url=http://www.xitek.com/forum/showthread.php?threadid=146222/url]。] 摄影之外 [ [/b] 在硬件方面,因为玩过相机,让你对器物的精良、工具的精密产生了迷恋。 和镜头一样,大家都是玻璃,于是你对 [url=http://www.cameraunion.net/forum/showthread.php?threadid=45963/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=251966] 眼镜 [/url] 产生了兴趣。和照相机一样,大家都是视觉艺术的工具,那么 [url=http://www.xitek.com/forum/showthread.php?threadid=260007] DV[/url] 也是要玩的。] 望远镜 [ 所谓 [b] “三代始知 [url=http://www.xitek.com/forum/showthread.php?threadid=126368/url][url=http://www.xitek.com/forum/showthread.php?threadid=15662] 吃饭 [/url]”] 穿衣 [ [/b],玩色彩,玩层次,视觉上有了追求,其它 [url=http://www.xitek.com/forum/showthread.php?threadid=184663/url] 听觉 [] 上、[url=http://www.xitek.com/forum/showthread.php?threadid=189263/url] 味觉 [] 上、[url=http://forum.xitek.com/showthread.php?threadid=186544/url] 上……也是要讲究的。] 嗅觉 [ 通过相机,你算开了眼了。有句话说:“穷玩 [url=http://www.xitek.com/forum/showthread.php?threadid=213921/url],富玩 [url=http://www.xitek.com/forum/showthread.php?threadid=112021] 表 [/url]”。大到 [url=http://www.xitek.com/forum/showthread.php?threadid=221700] 买房装修 [/url],小到 [url=http://forum.xitek.com/showthread.php?threadid=256395] 厨方刀具 [/url],大俗到 [url=http://forum.xitek.com/showthread.php?threadid=185800] 酱油 [/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=133049] 芝士 [/url],大雅到 [url=http://www.xitek.com/forum/showthread.php?threadid=150943] 文物 [/url]、[url=http://www.xitek.com/forum/showthread.php?threadid=183820] 书画 [/url],都是学问啊![i][color=#0000ff] 车 []

  • 用 PuTTy 连接就可以,没有出现这个问题。

    但是如果用 SSH Secure Shell Client 连接 Solaris 就会有这个问题。怪异:(

  • 配置管理员职责有哪些? at 2008年10月28日

    简单的说下管理的目标: 1.能重复搭建出开发人员的工作环境(有的时候这块不用 CM 管) 这一块我们主要用来保证所有开发人员的工作环境都是一样的。其次,我们要能保证 N 多年以后,如果想搭建同样的 开发环境,我们是可以做到的。那么从上边就能知道,我们应当管一些什么。

    1. 版本管理,这块都说烂了,文档,代码,配置文件,构建脚本。。。。。
    2. 构建机器(就是说,当我们要 release 一个版本的时候,我们都要在这台机子上去做 build,那么这台机子的软件版本,硬件设置都是要记录下来的。同时要给这个机子做好 Ghost,做好备份)
    3. 软件,无论是开发人员的机器上的软件还是构建机子上的软件最好都是放到公司文件服务器上,即便有了新版本也不要删掉老版本。说不定哪个时候你还需要。
  • perforce 疑问 at 2008年10月27日

    At 4:38 PM -0800 3/13/00, Rajul Vora wrote:

    I was wondering how other deal with Unicode files or files in other encodings. Let's say I have a java file which has some string constants. I add the file to perforce as text (accepting Perforce's guess).

    I then add some string constants in UTF-8 encoding. Now, I have a problem. If I just submit it, the text file-type may mess up my file (truncation, cr/lf translation, etc). If I change the file-type to binary, I loose the ability to do 3-way merges and diff, etc.

    How do others deal with this?

    For Unicode, you have two options. If you use UCS-2 (either little endian or big endian), you would obviously want to store them as binary files. This is not difficult, nor is there any problems storing text that way. An additional drawback is that binary files do not use the reverse delta storage. If you need to use a diff/merge tool, you could convert the files to UTF-8 first, and then do the operation, and then convert back to UCS-2. We store a small number of our files in UCS-2 format.

    We avoid the inconvenience of UCS-2 and store our files as UTF-8 (Perforce "text" type). Basically, it just works. It has the advantage that it is still Unicode. We are using this cross-platform on Mac, Windows, and Linux with no problems. We do not use UTF-8 file names, however.

    We see no truncation. Perforce leaves the lines alone. If you're seeing lines being truncated, then something else must be going on.

    Line endings will be different on different platforms, but we find it does exactly what we expect. On Windows, the line termination character is 0x0D/0x0A; on Mac it is 0x0D, and on Linux it is 0x0A. This is identical to what you see with non-UTF-8 text files. Note that ASCII control codes (and all of the ASCII/ISO-636 7-bit character range) are identical in both ASCII and UTF-8 character sets so no translation of those codes occurs.

    The Perforce client and server leave the high-bit characters alone. We submit, we sync, and UTF-8 text works fine.

    The only suggestion I have is that you make a note in your text file what encoding you're using, for instance add an explicit comment that says "THIS FILE IS ENCODED AS UTF-8". People who are not familiar with UTF-8 may assume that the characters in constant strings are incorrect because they won't look right in any text editor that is not aware of the encoding. Consequently, editing text strings would result in broken UTF-8 characters. Many editors will not let you modify the non-ASCII UTF-8 characters as single codes, but you find a few on the internet which do the trick. My personal favorite is "SC Unipad": [url]http://www.sharmahd.com/unipad//url][

    -Lawrence

  • 1.2.2 流程自动化 简单的日构建流程包括:下拉源代码->编译代码->运行测试。 复杂一点的日构建流程可能包括:

    1. 下拉工件 从版本管理工具获得源代码、参与运行的资源文件(图标和图片)、配置、元数据等。
    2. 工件统计 (Statistic)/审计 (Audit) 统计代码的有效行数以衡量生产率,个人工作量。 审计则可能包括审计工件命名风格,命名规范,多语言处理,异常处理等等。自动审计功能配合合适的管理制度,有助于帮助企业实现开发的规范化。
    3. 编译或加工 编译很容易理解,这里的加工指对源代码进行某种事先处理,比如根据源代码生成配置文件和部署描述文件。另外,还可能包括特殊目的的代码替换和测试覆盖插入([b] Source Code Instrumentation[/b][b])[/b]。
    4. 部署、配置 让一个软件运行起来可能需要进行配置和部署。比较典型的是 j2ee 的程序,需要配置客户端和在应用服务器部署 EJB 描述符。
    5. 运行 让软件按照特定的要求运行起来。(比如按照单元测试的要求,或者按照性能测试的要求)
    6. 测试 日构建中可以引入各种测试。比较常见的是单元测试,实际上能够够自动化验证的集成测试和性能测试也可以加入进来。
    7. 测试统计和审计 测试过后可能留下许多测试数据,比如单元测试的成功比例,每个单元测试执行的时间,性能测试留下的分析数据等等,这些数据可以在这一步充分利用起来,通过分析得出某种结论。
    8. 发布报告和邮件通知 日构建过后,除了输出各种工作组件,重要的还要发布日构建报告。日构建报告最好以网页的形式在一个固定的地方公布,内容可以保罗万象,比如模块的责任人、编译成功与否、部署成功与否、单元测试的个数、单元测试的成功率、代码覆盖率、工件统计等等。为了便于大家察看,可以附带简要的邮件通知。

    根据经验,流程自动化会涉及到几个难点: 第一, 如何解决编译的粒度和循环依赖问题 对于一个小项目来说,整个项目参与构建的工件可以作为一个整体一起拉下来,然后编译。如果编译未过,则日构建整体不成功。典型的例子是建立一个 src 目录,不同开发人员共享,所有的原代码都放在该目录中。 对于大项目而言(尤其是产品),由于有上百人参与开发,可能需要按照项目模块来组织开发,这个时候会存在多个 src 目录。在日构建中可以处理成把所有的 src 下拉后重定位到一个 src 目录进行编译。这种方案称之为 [b] 大编译 [/b]。但是这种方案有个问题,就是一旦某个模块的代码编译不能通过,整个大项目的编译也不能通过,除非这个编译问题能够立即解决,否则这将影响那些正常模块的日构建输出和功能验证。尽管大家会认为,编译问题自然要立即解决。但是这也就成为了影响日构建自动化的一个障碍因素。实际上,编译只是影响成功构建并达到可测试状态的其中一个影响因素,比如还可能存在元数据发布不成功,EJB 部署不成功等。有些因素一旦发生,可能在某种特殊情形都无法短时间解决,这个时候就凸现了下面一种方案的价值。 这种方案的基本原则是每个模块单独编译,元数据单独发布。但是这种方案要面临如何解决模块之间编译存在依赖链,并且这个链还可能成为环状的问题。这里与大家分享的一种做法是先执行前面提到的大编译,然后再把大编译的输出作为其它各项目编译的输入。这样可以解决编译次序和循环依赖问题,同时可以真实判断出哪些模块成功,那些模块存在问题,为针对单个模块的报告提供依据。 实践中,曾经把一个三百号人同时开发的项目分成了 60 个模块。在项目的初期,一般情况都会存在个别模块在当日日构建无法编译通过,并且可能出现特殊因素无法立即解决。但是采用上述方案,这个有问题的模块并不会在编译期间过大制约其它多数模块的正常编译通过。

    第二, 对于大型项目如何控制个别子模块不成功对全局的影响 一般来说,模块之间存在依赖关系,比如 Module C 依赖 Module B,Module B 又依赖 Module A ,那么是否只要 Module A 出现了编译问题,Module B 和 Module C 在当日日构建就都不输出呢?这是个局部影响全局的问题。作者建议的做法是,ModuleA 本次提交如果出现了问题,立即进行修复,特殊情况不能修复,由日构建系统自动根据编译结果判断启用 Module A 历史上最近一次成功版本。 有人可能会问,这种做法是否存在潜在的问题呢?的确存在,但是这个问题并不会想象的那么可怕。只要不是接口变更,一般来说 ModuleA 的问题只会影响 ModuleA 的内部,而不会殃及依赖 ModuleA 的其它模块。如果 ModuleA 在今日日构建做了一个接口的变更,而且这个变更也通知了依赖它的 Module B,并让 Module B 做修改,那么启用 ModuleA 的最近历史版本的确会存在运行时接口对不上的错误。对于这样的情况,可以不予处理,等待这个问题下一次日构建再解决。最好的办法是管理上要求当日必须解决 ModuleA 的编译问题。 上面提到的方法在几百人协同开发, 需求验证和测试并行的场景中经过检验,值得推广。

    第三, 复杂环境的部署 可能很多人会认为解决了编译问题就解决了日构建的主要问题。其实不然,日构建的目的是产生一个最新的、可供测试的输出。为了达成可供测试的输出,首先日构建就要尽可能进行自测,以期在把工作产品传递到测试服务器、测试人员那里之前发现尽可能多问题。比如整个产品是否可以稳定的在应用服务器中加载?系统的登陆模块是否可以正常工作?菜单项是否可以正常读取? 基于上述目的,日构建自身要配置出可以运行的实际环境以便运行验证测试程序。比如 BVT(Build Verification Test)。对于 J2EE 的应用,大家都知道,视产品部署模型的复杂程度这项任务可以变得非常复杂。 环境部署问题没有可供借鉴的统一模式。以笔者个人的经验,在日构建系统设计上如果能够做到与开发人员、测试服务器的部署模型和部署位置保持一致,就会大大减少环境的复杂性,这个时候可能需要人为制造一种统一环境。 1.2.3 报告机制 日构建在某种程度相当于对项目的一次 “体检”,体检的结果自然需要公而告之。公告的目的,是以实际数据来说明问题,并让项目中的所有成员对项目的现状达成一致的理解,并且这种理解是充满说服力的。日构建的报告可以做得很简单,也可以做得很复杂。形式可以采用 web 发布,也可以采用邮件通知。从项目管理的意义上,建议在这方面投入尽可能的精力和资源。 以本人参与设计的一个日构建系统为例,其日构建报告为 web 形式,左右结构框架。左边显示日期,点击该日期后在右边显示具体的报告。其内容包括:

    1. 按模块进行报告,报告中显示该模块的责任人(一般是负责该模块的项目经理)
    2. 每个模块的编译情况。通过或者未通过。未通过则显示编译出错信息。
    3. 每个模块的部署情况。成功或者失败。失败则显示失败的信息。
    4. 每个模块的单元测试数目,单元测试的时间,成功率,代码测试覆盖统计。
    5. 每个模块的代码行数,EJB 数目,各种元数据的分类统计
    6. 每个模块代码的风格审计,异常处理审计,命名规范审计,多语言处理审计等等 1.2.4 为日构建定制的管理制度专门的日构建设备 必须为项目安排专门的日构建机器,而且要求机器的处理性能较高,内存容量较大。以目前 PC 机的处理性能,150 人以下的项目,实践证明足以胜任。 日构建的时间管理 日构建并非每日仅构建一次。从持续构建的意义来看,日构建可以根据需要每日进行很多次。什么时候进行日构建?每日进行几次日构建最佳?没有最佳答案。但是根据经验,在项目的初期,由于功能大批量加入,测试还未全面开展,每日进行一次构建就可以了。随着、项目的推进,系统功能逐渐丰满、稳定,测试和需求验证也逐渐铺开,这时每日可以进行两次或者更多次构建。 日构建的时机一般放在下午为佳,如果个别模块发生问题,相关人员可以利用晚上的时间留守解决。微软的日构建发生在凌晨,并且自动调度执行。开发人员次日来了关心的头一件事就是自己负责的模块是否在日构建中进行得顺利。 午餐休息时间也是进行日构建的另一种选择。对于不大的项目,一个小时一般可以产生出日构建报告,这样开发人员中餐回来后可以直接对问题进行处理。而测试人员和需求人员也可以对上午的工作产品进行验证和测试。

    日构建轮值 尽管完善的日构建是通过调度自动运行,但是对于应付一些突发的事件,比如产品临时检查,开发人员对发现的重大 bug 的立即修复等,可能需要人为调度日构建运行。原则上建议为日构建设立一位管理员。由于事物处理并非持续,这个管理员兼职即可。 建议采取管理员在各部门或者项目组轮值的方式。这样有利于加强各方对日构建的重要性和处理过程形成共同的认识,同时也可以避免出现关键人物依赖。 接口变更管理 不同模块之间可能存在接口的依赖,这里的接口并非专指程序语言中的 Interface,而是包括所有在编译和运行期间依赖的部件。接口的变更管理是开发管理过程中的一个难点,尽管从软件设计角度,我们可以采取一些方法来尽量避免这种依赖,比如接口倒置,接口分离;但是在现实中,这个问题难以回避。持续集成的一个主要目的就是解决这个问题。 接口的变更原则上要求变更方主动通知接口依赖方,并且要求在日构建之前提前通知,以便接口依赖方有时间在集成编译之前能够调整原来调用老接口的代码。很多时候,这需要借助管理来保证。实际情况中,无法避免接口依赖方没有收到接口变更通知、或者来不及调整接口的情况,这种情况一旦发生,便导致接口依赖方的代码编译无法通过,问题就出来了。问题需要尽量避免,但是其产生并不可怕,这正体现了持续集成的作用——让问题尽早暴露。

    日构建中的行为规范 日构建是一天中所有工作产品的一次集中验证,并且输出的组件要影响第二天的所有工作,为了保证其正确进行,需要规范参与者的行为。这种行为规范包括开发人员在日构建前的准备工作,日构建后的响应和处理。为了便于大家理解,这里以举例的形式介绍给大家。比如:

    1. 开发人员在日构建前 15 分钟必须提交代码,以保证处理流程可以下拉正确的代码。