Journal(2005) | Blog(2006) | RandomLink | WhoAmI | LiveBookmark | HomePage

<<Previous: Share the URLs (December 2005)  >>Next: HTML::Parser 简单解释

用 IE 来浏览 perldoc

Category: Script   Keywords: perldoc

perldoc 黑忽忽的界面浏览起来不是很方便。我一向习惯用浏览器来浏览 perldoc, 但当我安装了很多模块的时候,perldoc 的 TOC/Table Of Content 将变得很长,找一个想要的模块将要拉很长的浏览器,比较不方便。
于是写了一个简单的文件用 IE 浏览器打开模块 html 文件。
#!/usr/bin/perl
use strict;
use Config;
use File::Spec;

my ($module) = @ARGV;

die 'not a module' unless ($module =~ /^[\w\:]+$/);

# determine it weather it is in /lib or /site/lib
my $file = File::Spec->catfile($Config{installhtmldir}, 'lib', split(/\:+/, $module)) . '.html';
$file = File::Spec->catfile($Config{installhtmldir}, 'site', 'lib', split(/\:+/, $module)) . '.html' unless (-e $file);
# if not in /lib and site/lib, check the lib/Pod, for such as perlfunc
$file = File::Spec->catfile($Config{installhtmldir}, 'lib', 'Pod', split(/\:+/, $module)) . '.html' unless (-e $file);
# and /bin
$file = File::Spec->catfile($Config{installhtmldir}, 'bin', split(/\:+/, $module)) . '.html' unless (-e $file);
die 'no such html' unless (-e $file);

`"C:/Program Files/Internet Explorer/IEXPLORE.EXE" $file`;

再用 pl2bat 将其转化为 bat 文件
pl2bat pd.pl
最后将这个 bat 文件拖进某 PATH 目录下就可以了。
这下我们可以用
pd Module::Build
来打开 Module::Build 的 html 文件。

<<Previous: Share the URLs (December 2005)  >>Next: HTML::Parser 简单解释

Options: +Del.icio.us

Related items Created on 2005-12-28 13:53:02, Last modified on 2005-12-28 13:54:00
Copyright 2004-2005 All Rights Reserved. Powered by Eplanet && Catalyst 5.62.