📄 htmlhelp.pm
字号:
<a href="./lib/pod/perlfaq6.html" alt="Regexps"> perlfaq6 </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl frequently asked questions">
<a href="./lib/pod/perlfaq7.html" alt="General Perl Language Issues"> perlfaq7
</a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl frequently asked questions">
<a href="./lib/pod/perlfaq8.html" alt="System Interaction"> perlfaq8 </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl frequently asked questions">
<a href="./lib/pod/perlfaq9.html" alt="Networking"> perlfaq9 </a><br>
<img id="Foldergif_63" src="folder.gif" alt="Standard Distribution Documentation">
<b><a name="CorePerlDocs">Core Perl Docs</a><BR>
</b> <img id="Pagegif_63" src="page.gif"> <a href="./lib/pod/perl.html">
Introduction</a><BR>
<img id="Pagegif_63" src="page.gif" alt="Perl internal IO abstraction interface">
<a href="./lib/pod/perlapio.html"> perlapio </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl book information">
<a href="./lib/pod/perlbook.html"> perlbook </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl OO tricks and examples">
<a href="./lib/pod/perlbot.html"> perlbot </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl calling conventions from C">
<a href="./lib/pod/perlcall.html"> perlcall </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl Data Structures">
<a href="./lib/pod/perldata.html"> perldata </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl debugging">
<a href="./lib/pod/perldebug.html"> perldebug </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl changes since previous version">
<a href="./lib/pod/perldelta.html"> perldelta </a><BR>
<img id="Pagegif_63" src="page.gif" alt="Perl diagnostic messages">
<a href="./lib/pod/perldiag.html"> perldiag </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl data structures intro">
<a href="./lib/pod/perldsc.html"> perldsc </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl ways to embed perl in your C or C++ application">
<a href="./lib/pod/perlembed.html"> perlembed </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl formats">
<a href="./lib/pod/perlform.html"> perlform </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl builtin functions">
<a href="./lib/pod/perlfunc.html"> perlfunc </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl internal functions for those doing extensions">
<a href="./lib/pod/perlguts.html"> perlguts </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl history records">
<a href="./lib/pod/perlhist.html"> perlhist </a><br>
<b> </b> <img id="Pagegif_63" src="page.gif" alt="Perl interprocess communication">
<a href="./lib/pod/perlipc.html"> perlipc </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl locale support">
<a href="./lib/pod/perllocale.html"> perllocale </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl data structures: lists of lists">
<a href="./lib/pod/perllol.html"> perllol </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl modules: how they work">
<a href="./lib/pod/perlmod.html"> perlmod </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl modules: hot to write and use them">
<a href="./lib/pod/perlmodlib.html"> perlmodlib </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl objects">
<a href="./lib/pod/perlobj.html"> perllobj </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl operators and precedence">
<a href="./lib/pod/perlop.html"> perlop </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl plain old documentation">
<a href="./lib/pod/perlpod.html"> perlpod </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl regular expressions">
<a href="./lib/pod/perlre.html"> perlre </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl references">
<a href="./lib/pod/perlref.html"> perlref </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl execution and options">
<a href="./lib/pod/perlrun.html"> perlrun </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl security">
<a href="./lib/pod/perlsec.html"> perlsec </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl style guide">
<a href="./lib/pod/perlstyle.html"> perlstyle </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl subroutines">
<a href="./lib/pod/perlsub.html"> perlsub </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl Syntax">
<a href="./lib/pod/perlsyn.html"> perlsyn </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl objects hidden behind simple variables">
<a href="./lib/pod/perltie.html"> perltie </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl documentation table of contents">
<a href="./lib/pod/perltoc.html" alt="Perl documentation table of contents">
perltoc </a><BR>
<img id="Pagegif_63" src="page.gif" alt="Perl OO tutorial">
<a href="./lib/pod/perltoot.html"> perltoot </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl traps for the unwary">
<a href="./lib/pod/perltrap.html"> perltrap </a><br>
<img id="Pagegif_63" src="page.gif" alt="Perl predefined variables">
<a href="./lib/pod/perlvar.html"> perlvar </a><BR>
<img id="Pagegif_63" src="page.gif" alt="Perl XS application programming interface">
<a href="./lib/pod/perlxs.html"> perlxs </a><BR>
<img id="Pagegif_63" src="page.gif" alt="Perl XS tutorial">
<a href="./lib/pod/perlxstut.html"> perlxstut </a>
</p>
<hr>
<h4><a name="ModuleDocs">Module Docs</a></h4>
END_OF_MAIN_TOC
}
#####################################################################
# FUNCTION GetHtmlFilesFromTree (recursive)
# RECEIVES Base directory to look in
# RETURNS List of html files
# SETS None
# EXPECTS None
# PURPOSE Searches an entire for html files, returns a list of
# html files found including path information
sub GetHtmlFilesFromTree {
my $basedir = shift;
my @dirs;
my @htmlfiles;
my %ret;
unless(opendir(DIR, $basedir)) {
$! = "Can't read from directory $basedir\n";
return 0;
}
@files = readdir(DIR);
closedir(DIR);
@dirs = grep {-d "$basedir\\$_" and /[^.]$/} @files;
@htmlfiles = grep {/\.html?$/i} @files;
foreach $dir (@dirs) {
unless(%ret = (%ret, GetHtmlFilesFromTree("$basedir\\$dir"))) {
return 0;
}
}
%ret = (%ret, $basedir => \@htmlfiles);
}
#####################################################################
# FUNCTION MakePerlHelp
# RECEIVES None
# RETURNS 1 | 0
# SETS None
# EXPECTS None
# PURPOSE Creates html help for the perl system. This is the
# html help core build. If MAKE_HTML_FOR_HHELP is set
# to a true vale, then it builds the help from POD,
# otherwise it depends on the pod being there already.
sub MakePerlHelp {
if($MAKE_HTML_FOR_HHELP) {
unless(MakeHelpFromPodTree($HTMLHELP, $HTMLHELP, $LIB, "$HTML\\lib")) {
return 0;
}
unless(MakeHelpFromPodTree($HTMLHELP, $HTMLHELP, $SITELIB, "$HTML\\lib\\site")) {
return 0;
}
} else {
unless(MakeHelpFromTree($HTMLHELP, $HTMLHELP, "$HTML\\lib")) {
return 0;
}
}
unless(MakePerlHelpMain) {
return 0;
}
# This handles MakePerlHtml too, since we've created all the html
unless(MakePerlHtmlIndex("$HTML\\lib", "$HTML\\perltoc.html")) {
return 0;
}
return 1;
}
#####################################################################
# FUNCTION MakePerlHelpMain;
# RECEIVES None
# RETURNS None
# SETS None
# EXPECTS None
# PURPOSE Creates the main perl helpfile from all the little
# helpfiles already created.
sub MakePerlHelpMain {
my @files;
print "Generating main library helpfile\n";
unless(opendir(DIR, $HTMLHELP)) {
$! = "Directory $HTMLHELP could not be read\n";
return 0;
}
unless(-e "$HTMLHELP/default.htm") {
copy("$HTML/libmain.html", "$HTMLHELP/default.htm");
}
@files = grep {/\.hhc/i} readdir(DIR);
closedir(DIR);
$CLEANUP=0;
$MERGE_PACKAGES = 1;
MakeHelp("libmain.chm", $HTMLHELP, $HTMLHELP, @files);
$CLEANUP = 1;
$MERGE_PACKAGES = 0;
return 1;
}
#####################################################################
# FUNCTION MakeHelpFromPodTree
# RECEIVES Working directory, Output directory, Source Diretory,
# HtmlOutput Directory
# RETURNS 0 | 1
# SETS None
# EXPECTS None
# PURPOSE Takes a tree's worth of pod and turns them first
# into html and then into htmlhelp.
sub MakeHelpFromPodTree {
my ($workdir, $outdir, $fromdir, $htmldir) = @_;
unless(MakeHtmlTree($fromdir, $htmldir)) {
return 0;
}
unless(MakeHelpFromTree($workdir, $outdir, $htmldir)) {
return 0;
}
# if(opendir(DIR, $outdir)) {
# unlink(map {"$outdir/$_"} grep {/\.hhp/i} readdir(DIR));
# closedir(DIR);
# } else {
# warn "Could not clean up project files in $outdir\n";
# }
return 1;
}
#####################################################################
# FUNCTION MakeHtmlTree
# RECEIVES Source Directory, Html Output Directory
# RETURNS 0 | 1
# SETS None
# EXPECTS None
# PURPOSE Makes a tree's worth of html from a tree's worth
# of pod.
sub MakeHtmlTree {
my ($fromdir, $htmldir) = @_;
my @files;
my @podfiles;
my @dirs;
my $podfile;
my $htmlfile;
my $dir;
# Get list of files and directories to process
if(!-d $fromdir) {
$! = "Directory $fromdir does not exist\n";
return 0;
}
unless(opendir(DIR, $fromdir)) {
$! = "Directory $fromdir couldn't be read\n";
return 0;
}
@files = readdir(DIR);
closedir(DIR);
@podfiles = map {"$fromdir\\$_"} grep {/\.pod$|\.pm$/i} @files;
@dirs = grep {-d "$fromdir\\$_" and /[^.]$/} @files;
if(@podfiles) {
# Create the copy directory
if(!-d $htmldir) {
unless(mkdir($htmldir, 0777)) {
$! = "Directory $htmldir could not be created\n";
return 0;
}
}
foreach $podfile (@podfiles) {
$htmlfile = $podfile;
$htmlfile =~ s/.*(\\|\/)(.*)/$2/;
$htmlfile =~ s/\.pod|\.pm$/.html/i;
$htmlfile = "$htmldir\\$htmlfile";
unlink($htmlfile) if(-e $htmlfile);
pod2html("--infile=$podfile", "--outfile=$htmlfile");
}
}
foreach $dir (@dirs) {
MakeHtmlTree("$fromdir\\$dir", "$htmldir\\$dir");
}
return 1;
}
#####################################################################
# FUNCTION MakeHelpFromTree
# RECEIVES Working directory, Output directory, Source directory
# RETURNS 0 | 1
# SETS None
# EXPECTS None
# PURPOSE Creates html help from a tree's worth of html
sub MakeHelpFromTree {
my ($workdir, $outdir, $fromdir) = @_;
my %files;
my $file;
my $key;
my $file_root;
unless(%files = GetHtmlFileTreeList($fromdir, $fromdir)) {
return 0;
}
$file_root = $fromdir;
$file_root =~ s/(.*)(\\|\/)$/$1/;
foreach $key (sort(keys(%files))) {
$file = $key;
$file = substr($key, length($file_root));
$file =~ s/^(\\|\/)//;
$file =~ s{\\|\/}{-}g;
$file =~ s/ //g;
if($file eq "") {
if($file_root =~ /lib$/i) {
$file = "lib";
} else {
$file = "lib-site";
}
} elsif ($file_root =~ /lib$/i) {
$file = "lib-" . $file;
} elsif ($file_root =~ /site$/i) {
$file = "lib-site-" . $file;
}
$file .= ".chm";
unless(MakeHelp("$file", $workdir, $outdir, map {"$key/$_"} @{$files{$key}})) {
return 0;
}
}
return 1;
}
#####################################################################
# FUNCTION GetHtmlFileTreeList (recursive)
# RECEIVES Original root (from first call), Root (successive)
# RETURNS Hash of files
# SETS None
# EXPECTS None
# PURPOSE Get a list of html files throughout a tree
sub GetHtmlFileTreeList {
my $origroot = shift;
my $root = shift;
my @files;
my @htmlfiles;
my @dirs;
my $dir;
my %ret;
unless(opendir(DIR, "$root")) {
$! = "Can't open directory $root\n";
return undef;
}
@files = readdir(DIR);
@dirs = grep {-d "$root/$_" and /[^.]$/} @files;
@htmlfiles = grep {/\.html?/i} @files;
closedir(DIR);
%ret = ($root => \@htmlfiles) if @htmlfiles;
foreach $dir (@dirs) {
unless(%ret = (%ret, GetHtmlFileTreeList($origroot, "$root/$dir"))) {
return undef;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -