?????????? ????????? - ??????????????? - /home/agenciai/public_html/cd38d8/Pod.zip
???????
PK �9�[V�^8 8 Functions.pmnu �[��� package Pod::Functions; use strict; =head1 NAME Pod::Functions - Group Perl's functions a la perlfunc.pod =head1 SYNOPSIS use Pod::Functions; my @misc_ops = @{ $Kinds{ 'Misc' } }; my $misc_dsc = $Type_Description{ 'Misc' }; or perl /path/to/lib/Pod/Functions.pm This will print a grouped list of Perl's functions, like the L<perlfunc/"Perl Functions by Category"> section. =head1 DESCRIPTION It exports the following variables: =over 4 =item %Kinds This holds a hash-of-lists. Each list contains the functions in the category the key denotes. =item %Type In this hash each key represents a function and the value is the category. The category can be a comma separated list. =item %Flavor In this hash each key represents a function and the value is a short description of that function. =item %Type_Description In this hash each key represents a category of functions and the value is a short description of that category. =item @Type_Order This list of categories is used to produce the same order as the L<perlfunc/"Perl Functions by Category"> section. =back =cut our $VERSION = '1.13'; require Exporter; our @ISA = qw(Exporter); our @EXPORT = qw(%Kinds %Type %Flavor %Type_Description @Type_Order); our(%Kinds, %Type, %Flavor, %Type_Description, @Type_Order); foreach ( [String => 'Functions for SCALARs or strings'], [Regexp => 'Regular expressions and pattern matching'], [Math => 'Numeric functions'], [ARRAY => 'Functions for real @ARRAYs'], [LIST => 'Functions for list data'], [HASH => 'Functions for real %HASHes'], ['I/O' => 'Input and output functions'], [Binary => 'Functions for fixed-length data or records'], [File => 'Functions for filehandles, files, or directories'], [Flow => 'Keywords related to the control flow of your Perl program'], [Namespace => 'Keywords related to scoping'], [Misc => 'Miscellaneous functions'], [Process => 'Functions for processes and process groups'], [Modules => 'Keywords related to Perl modules'], [Objects => 'Keywords related to classes and object-orientation'], [Socket => 'Low-level socket functions'], [SysV => 'System V interprocess communication functions'], [User => 'Fetching user and group info'], [Network => 'Fetching network info'], [Time => 'Time-related functions'], ) { push @Type_Order, $_->[0]; $Type_Description{$_->[0]} = $_->[1]; }; while (<DATA>) { chomp; s/^#.*//; next unless $_; my($name, @data) = split "\t", $_; $Flavor{$name} = pop @data; $Type{$name} = join ',', @data; for my $t (@data) { push @{$Kinds{$t}}, $name; } } close DATA; my( $typedesc, $list ); unless (caller) { foreach my $type ( @Type_Order ) { $list = join(", ", sort @{$Kinds{$type}}); $typedesc = $Type_Description{$type} . ":"; write; } } format = ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $typedesc ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $typedesc ~~ ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $list . 1; __DATA__ -X File a file test (-r, -x, etc) abs Math absolute value function accept Socket accept an incoming socket connect alarm Process schedule a SIGALRM atan2 Math arctangent of Y/X in the range -PI to PI bind Socket binds an address to a socket binmode I/O prepare binary files for I/O bless Objects create an object break Flow break out of a C<given> block caller Flow Namespace get context of the current subroutine call chdir File change your current working directory chmod File changes the permissions on a list of files chomp String remove a trailing record separator from a string chop String remove the last character from a string chown File change the ownership on a list of files chr String get character this number represents chroot File make directory new root for path lookups close I/O close file (or pipe or socket) handle closedir I/O close directory handle connect Socket connect to a remote socket continue Flow optional trailing block in a while or foreach cos Math cosine function crypt String one-way passwd-style encryption dbmclose I/O Objects breaks binding on a tied dbm file dbmopen I/O Objects create binding on a tied dbm file defined Misc test whether a value, variable, or function is defined delete HASH deletes a value from a hash die Flow I/O raise an exception or bail out do Flow Modules turn a BLOCK into a TERM dump Flow create an immediate core dump each ARRAY HASH retrieve the next key/value pair from a hash endgrent User be done using group file endhostent User be done using hosts file endnetent User be done using networks file endprotoent Network be done using protocols file endpwent User be done using passwd file endservent Network be done using services file eof I/O test a filehandle for its end eval Flow catch exceptions or compile and run code evalbytes Flow similar to string eval, but intend to parse a bytestream exec Process abandon this program to run another exists HASH test whether a hash key is present exit Flow terminate this program exp Math raise I<e> to a power fc String return casefolded version of a string fcntl File file control system call __FILE__ Flow the name of the current source file fileno I/O return file descriptor from filehandle flock I/O lock an entire file with an advisory lock fork Process create a new process just like this one format I/O declare a picture format with use by the write() function formline Misc internal function used for formats getc I/O get the next character from the filehandle getgrent User get next group record getgrgid User get group record given group user ID getgrnam User get group record given group name gethostbyaddr Network get host record given its address gethostbyname Network get host record given name gethostent Network get next hosts record getlogin User return who logged in at this tty getnetbyaddr Network get network record given its address getnetbyname Network get networks record given name getnetent Network get next networks record getpeername Socket find the other end of a socket connection getpgrp Process get process group getppid Process get parent process ID getpriority Process get current nice value getprotobyname Network get protocol record given name getprotobynumber Network get protocol record numeric protocol getprotoent Network get next protocols record getpwent User get next passwd record getpwnam User get passwd record given user login name getpwuid User get passwd record given user ID getservbyname Network get services record given its name getservbyport Network get services record given numeric port getservent Network get next services record getsockname Socket retrieve the sockaddr for a given socket getsockopt Socket get socket options on a given socket glob File expand filenames using wildcards gmtime Time convert UNIX time into record or string using Greenwich time goto Flow create spaghetti code grep LIST locate elements in a list test true against a given criterion hex Math String convert a hexadecimal string to a number import Modules Namespace patch a module's namespace into your own index String find a substring within a string int Math get the integer portion of a number ioctl File system-dependent device control system call join LIST join a list into a string using a separator keys ARRAY HASH retrieve list of indices from a hash kill Process send a signal to a process or process group last Flow exit a block prematurely lc String return lower-case version of a string lcfirst String return a string with just the next letter in lower case length String return the number of characters in a string __LINE__ Flow the current source line number link File create a hard link in the filesystem listen Socket register your socket as a server local Namespace create a temporary value for a global variable (dynamic scoping) localtime Time convert UNIX time into record or string using local time lock Misc get a thread lock on a variable, subroutine, or method log Math retrieve the natural logarithm for a number lstat File stat a symbolic link m// Regexp match a string with a regular expression pattern map LIST apply a change to a list to get back a new list with the changes mkdir File create a directory msgctl SysV SysV IPC message control operations msgget SysV get SysV IPC message queue msgrcv SysV receive a SysV IPC message from a message queue msgsnd SysV send a SysV IPC message to a message queue my Namespace declare and assign a local variable (lexical scoping) next Flow iterate a block prematurely no Modules unimport some module symbols or semantics at compile time oct Math String convert a string to an octal number open File open a file, pipe, or descriptor opendir File open a directory ord String find a character's numeric representation our Namespace declare and assign a package variable (lexical scoping) pack Binary String convert a list into a binary representation package Modules Namespace Objects declare a separate global namespace __PACKAGE__ Flow the current package pipe Process open a pair of connected filehandles pop ARRAY remove the last element from an array and return it pos Regexp find or set the offset for the last/next m//g search print I/O output a list to a filehandle printf I/O output a formatted list to a filehandle prototype Misc get the prototype (if any) of a subroutine push ARRAY append one or more elements to an array q/STRING/ String singly quote a string qq/STRING/ String doubly quote a string qr/STRING/ Regexp compile pattern quotemeta Regexp quote regular expression magic characters qw/STRING/ LIST quote a list of words qx/STRING/ Process backquote quote a string rand Math retrieve the next pseudorandom number read Binary I/O fixed-length buffered input from a filehandle readdir I/O get a directory from a directory handle readline I/O fetch a record from a file readlink File determine where a symbolic link is pointing readpipe Process execute a system command and collect standard output recv Socket receive a message over a Socket redo Flow start this loop iteration over again ref Objects find out the type of thing being referenced rename File change a filename require Modules load in external functions from a library at runtime reset Misc clear all variables of a given name return Flow get out of a function early reverse LIST String flip a string or a list rewinddir I/O reset directory handle rindex String right-to-left substring search rmdir File remove a directory s/// Regexp replace a pattern with a string say I/O output a list to a filehandle, appending a newline scalar Misc force a scalar context seek I/O reposition file pointer for random-access I/O seekdir I/O reposition directory pointer select File I/O reset default output or do I/O multiplexing semctl SysV SysV semaphore control operations semget SysV get set of SysV semaphores semop SysV SysV semaphore operations send Socket send a message over a socket setgrent User prepare group file for use sethostent Network prepare hosts file for use setnetent Network prepare networks file for use setpgrp Process set the process group of a process setpriority Process set a process's nice value setprotoent Network prepare protocols file for use setpwent User prepare passwd file for use setservent Network prepare services file for use setsockopt Socket set some socket options shift ARRAY remove the first element of an array, and return it shmctl SysV SysV shared memory operations shmget SysV get SysV shared memory segment identifier shmread SysV read SysV shared memory shmwrite SysV write SysV shared memory shutdown Socket close down just half of a socket connection sin Math return the sine of a number sleep Process block for some number of seconds socket Socket create a socket socketpair Socket create a pair of sockets sort LIST sort a list of values splice ARRAY add or remove elements anywhere in an array split Regexp split up a string using a regexp delimiter sprintf String formatted print into a string sqrt Math square root function srand Math seed the random number generator stat File get a file's status information state Namespace declare and assign a persistent lexical variable study Regexp no-op, formerly optimized input data for repeated searches sub Flow declare a subroutine, possibly anonymously __SUB__ Flow the current subroutine, or C<undef> if not in a subroutine substr String get or alter a portion of a string symlink File create a symbolic link to a file syscall Binary I/O execute an arbitrary system call sysopen File open a file, pipe, or descriptor sysread Binary I/O fixed-length unbuffered input from a filehandle sysseek Binary I/O position I/O pointer on handle used with sysread and syswrite system Process run a separate program syswrite Binary I/O fixed-length unbuffered output to a filehandle tell I/O get current seekpointer on a filehandle telldir I/O get current seekpointer on a directory handle tie Objects bind a variable to an object class tied Objects get a reference to the object underlying a tied variable time Time return number of seconds since 1970 times Process Time return elapsed time for self and child processes tr/// String transliterate a string truncate I/O shorten a file uc String return upper-case version of a string ucfirst String return a string with just the next letter in upper case umask File set file creation mode mask undef Misc remove a variable or function definition unlink File remove one link to a file unpack Binary LIST convert binary structure into normal perl variables unshift ARRAY prepend more elements to the beginning of a list untie Objects break a tie binding to a variable use Modules Namespace Objects load in a module at compile time and import its namespace utime File set a file's last access and modify times values ARRAY HASH return a list of the values in a hash vec Binary test or set particular bits in a string wait Process wait for any child process to die waitpid Process wait for a particular child process to die wantarray Flow get void vs scalar vs list context of current subroutine call warn I/O print debugging info write I/O print a picture record y/// String transliterate a string PK �9�[FIg' e e Html.pmnu �[��� package Pod::Html; use strict; require Exporter; our $VERSION = 1.25; our @ISA = qw(Exporter); our @EXPORT = qw(pod2html htmlify); our @EXPORT_OK = qw(anchorify relativize_url); use Carp; use Config; use Cwd; use File::Basename; use File::Spec; use File::Spec::Unix; use Getopt::Long; use Pod::Simple::Search; use Pod::Simple::SimpleTree (); use locale; # make \w work right in non-ASCII lands =head1 NAME Pod::Html - module to convert pod files to HTML =head1 SYNOPSIS use Pod::Html; pod2html([options]); =head1 DESCRIPTION Converts files from pod format (see L<perlpod>) to HTML format. It can automatically generate indexes and cross-references, and it keeps a cache of things it knows how to cross-reference. =head1 FUNCTIONS =head2 pod2html pod2html("pod2html", "--podpath=lib:ext:pod:vms", "--podroot=/usr/src/perl", "--htmlroot=/perl/nmanual", "--recurse", "--infile=foo.pod", "--outfile=/perl/nmanual/foo.html"); pod2html takes the following arguments: =over 4 =item backlink --backlink Turns every C<head1> heading into a link back to the top of the page. By default, no backlinks are generated. =item cachedir --cachedir=name Creates the directory cache in the given directory. =item css --css=stylesheet Specify the URL of a cascading style sheet. Also disables all HTML/CSS C<style> attributes that are output by default (to avoid conflicts). =item flush --flush Flushes the directory cache. =item header --header --noheader Creates header and footer blocks containing the text of the C<NAME> section. By default, no headers are generated. =item help --help Displays the usage message. =item htmldir --htmldir=name Sets the directory to which all cross references in the resulting html file will be relative. Not passing this causes all links to be absolute since this is the value that tells Pod::Html the root of the documentation tree. Do not use this and --htmlroot in the same call to pod2html; they are mutually exclusive. =item htmlroot --htmlroot=name Sets the base URL for the HTML files. When cross-references are made, the HTML root is prepended to the URL. Do not use this if relative links are desired: use --htmldir instead. Do not pass both this and --htmldir to pod2html; they are mutually exclusive. =item index --index --noindex Generate an index at the top of the HTML file. This is the default behaviour. =item infile --infile=name Specify the pod file to convert. Input is taken from STDIN if no infile is specified. =item outfile --outfile=name Specify the HTML file to create. Output goes to STDOUT if no outfile is specified. =item poderrors --poderrors --nopoderrors Include a "POD ERRORS" section in the outfile if there were any POD errors in the infile. This section is included by default. =item podpath --podpath=name:...:name Specify which subdirectories of the podroot contain pod files whose HTML converted forms can be linked to in cross references. =item podroot --podroot=name Specify the base directory for finding library pods. Default is the current working directory. =item quiet --quiet --noquiet Don't display I<mostly harmless> warning messages. These messages will be displayed by default. But this is not the same as C<verbose> mode. =item recurse --recurse --norecurse Recurse into subdirectories specified in podpath (default behaviour). =item title --title=title Specify the title of the resulting HTML file. =item verbose --verbose --noverbose Display progress messages. By default, they won't be displayed. =back =head2 htmlify htmlify($heading); Converts a pod section specification to a suitable section specification for HTML. Note that we keep spaces and special characters except C<", ?> (Netscape problem) and the hyphen (writer's problem...). =head2 anchorify anchorify(@heading); Similar to C<htmlify()>, but turns non-alphanumerics into underscores. Note that C<anchorify()> is not exported by default. =head1 ENVIRONMENT Uses C<$Config{pod2html}> to setup default options. =head1 AUTHOR Marc Green, E<lt>marcgreen@cpan.orgE<gt>. Original version by Tom Christiansen, E<lt>tchrist@perl.comE<gt>. =head1 SEE ALSO L<perlpod> =head1 COPYRIGHT This program is distributed under the Artistic License. =cut # This sub duplicates the guts of Pod::Simple::FromTree. We could have # used that module, except that it would have been a non-core dependency. sub feed_tree_to_parser { my($parser, $tree) = @_; if(ref($tree) eq "") { $parser->_handle_text($tree); } elsif(!($tree->[0] eq "X" && $parser->nix_X_codes)) { $parser->_handle_element_start($tree->[0], $tree->[1]); feed_tree_to_parser($parser, $_) foreach @{$tree}[2..$#$tree]; $parser->_handle_element_end($tree->[0]); } } my $Cachedir; my $Dircache; my($Htmlroot, $Htmldir, $Htmlfile, $Htmlfileurl); my($Podfile, @Podpath, $Podroot); my $Poderrors; my $Css; my $Recurse; my $Quiet; my $Verbose; my $Doindex; my $Backlink; my($Title, $Header); my %Pages = (); # associative array used to find the location # of pages referenced by L<> links. my $Curdir = File::Spec->curdir; init_globals(); sub init_globals { $Cachedir = "."; # The directory to which directory caches # will be written. $Dircache = "pod2htmd.tmp"; $Htmlroot = "/"; # http-server base directory from which all # relative paths in $podpath stem. $Htmldir = ""; # The directory to which the html pages # will (eventually) be written. $Htmlfile = ""; # write to stdout by default $Htmlfileurl = ""; # The url that other files would use to # refer to this file. This is only used # to make relative urls that point to # other files. $Poderrors = 1; $Podfile = ""; # read from stdin by default @Podpath = (); # list of directories containing library pods. $Podroot = $Curdir; # filesystem base directory from which all # relative paths in $podpath stem. $Css = ''; # Cascading style sheet $Recurse = 1; # recurse on subdirectories in $podpath. $Quiet = 0; # not quiet by default $Verbose = 0; # not verbose by default $Doindex = 1; # non-zero if we should generate an index $Backlink = 0; # no backlinks added by default $Header = 0; # produce block header/footer $Title = undef; # title to give the pod(s) } sub pod2html { local(@ARGV) = @_; local $_; init_globals(); parse_command_line(); # prevent '//' in urls $Htmlroot = "" if $Htmlroot eq "/"; $Htmldir =~ s#/\z##; if ( $Htmlroot eq '' && defined( $Htmldir ) && $Htmldir ne '' && substr( $Htmlfile, 0, length( $Htmldir ) ) eq $Htmldir ) { # Set the 'base' url for this file, so that we can use it # as the location from which to calculate relative links # to other files. If this is '', then absolute links will # be used throughout. #$Htmlfileurl = "$Htmldir/" . substr( $Htmlfile, length( $Htmldir ) + 1); # Is the above not just "$Htmlfileurl = $Htmlfile"? $Htmlfileurl = Pod::Html::_unixify($Htmlfile); } # load or generate/cache %Pages unless (get_cache($Dircache, \@Podpath, $Podroot, $Recurse)) { # generate %Pages my $pwd = getcwd(); chdir($Podroot) || die "$0: error changing to directory $Podroot: $!\n"; # find all pod modules/pages in podpath, store in %Pages # - callback used to remove Podroot and extension from each file # - laborious to allow '.' in dirnames (e.g., /usr/share/perl/5.14.1) Pod::Simple::Search->new->inc(0)->verbose($Verbose)->laborious(1) ->callback(\&_save_page)->recurse($Recurse)->survey(@Podpath); chdir($pwd) || die "$0: error changing to directory $pwd: $!\n"; # cache the directory list for later use warn "caching directories for later use\n" if $Verbose; open my $cache, '>', $Dircache or die "$0: error open $Dircache for writing: $!\n"; print $cache join(":", @Podpath) . "\n$Podroot\n"; my $_updirs_only = ($Podroot =~ /\.\./) && !($Podroot =~ /[^\.\\\/]/); foreach my $key (keys %Pages) { if($_updirs_only) { my $_dirlevel = $Podroot; while($_dirlevel =~ /\.\./) { $_dirlevel =~ s/\.\.//; # Assume $Pages{$key} has '/' separators (html dir separators). $Pages{$key} =~ s/^[\w\s\-\.]+\///; } } print $cache "$key $Pages{$key}\n"; } close $cache or die "error closing $Dircache: $!"; } my $input; unless (@ARGV && $ARGV[0]) { if ($Podfile and $Podfile ne '-') { $input = $Podfile; } else { $input = '-'; # XXX: make a test case for this } } else { $Podfile = $ARGV[0]; $input = *ARGV; } # set options for input parser my $parser = Pod::Simple::SimpleTree->new; $parser->codes_in_verbatim(0); $parser->accept_targets(qw(html HTML)); $parser->no_errata_section(!$Poderrors); # note the inverse warn "Converting input file $Podfile\n" if $Verbose; my $podtree = $parser->parse_file($input)->root; unless(defined $Title) { if($podtree->[0] eq "Document" && ref($podtree->[2]) eq "ARRAY" && $podtree->[2]->[0] eq "head1" && @{$podtree->[2]} == 3 && ref($podtree->[2]->[2]) eq "" && $podtree->[2]->[2] eq "NAME" && ref($podtree->[3]) eq "ARRAY" && $podtree->[3]->[0] eq "Para" && @{$podtree->[3]} >= 3 && !(grep { ref($_) ne "" } @{$podtree->[3]}[2..$#{$podtree->[3]}]) && (@$podtree == 4 || (ref($podtree->[4]) eq "ARRAY" && $podtree->[4]->[0] eq "head1"))) { $Title = join("", @{$podtree->[3]}[2..$#{$podtree->[3]}]); } } $Title //= ""; $Title = html_escape($Title); # set options for the HTML generator $parser = Pod::Simple::XHTML::LocalPodLinks->new(); $parser->codes_in_verbatim(0); $parser->anchor_items(1); # the old Pod::Html always did $parser->backlink($Backlink); # linkify =head1 directives $parser->force_title($Title); $parser->htmldir($Htmldir); $parser->htmlfileurl($Htmlfileurl); $parser->htmlroot($Htmlroot); $parser->index($Doindex); $parser->output_string(\my $output); # written to file later $parser->pages(\%Pages); $parser->quiet($Quiet); $parser->verbose($Verbose); # We need to add this ourselves because we use our own header, not # ::XHTML's header. We need to set $parser->backlink to linkify # the =head1 directives my $bodyid = $Backlink ? ' id="_podtop_"' : ''; my $csslink = ''; my $tdstyle = ' style="background-color: #cccccc; color: #000"'; if ($Css) { $csslink = qq(\n<link rel="stylesheet" href="$Css" type="text/css" />); $csslink =~ s,\\,/,g; $csslink =~ s,(/.):,$1|,; $tdstyle= ''; } # header/footer block my $block = $Header ? <<END_OF_BLOCK : ''; <table border="0" width="100%" cellspacing="0" cellpadding="3"> <tr><td class="_podblock_"$tdstyle valign="middle"> <big><strong><span class="_podblock_"> $Title</span></strong></big> </td></tr> </table> END_OF_BLOCK # create own header/footer because of --header $parser->html_header(<<"HTMLHEAD"); <?xml version="1.0" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>$Title</title>$csslink <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rev="made" href="mailto:$Config{perladmin}" /> </head> <body$bodyid> $block HTMLHEAD $parser->html_footer(<<"HTMLFOOT"); $block </body> </html> HTMLFOOT feed_tree_to_parser($parser, $podtree); # Write output to file $Htmlfile = "-" unless $Htmlfile; # stdout my $fhout; if($Htmlfile and $Htmlfile ne '-') { open $fhout, ">", $Htmlfile or die "$0: cannot open $Htmlfile file for output: $!\n"; } else { open $fhout, ">-"; } binmode $fhout, ":utf8"; print $fhout $output; close $fhout or die "Failed to close $Htmlfile: $!"; chmod 0644, $Htmlfile unless $Htmlfile eq '-'; } ############################################################################## sub usage { my $podfile = shift; warn "$0: $podfile: @_\n" if @_; die <<END_OF_USAGE; Usage: $0 --help --htmldir=<name> --htmlroot=<URL> --infile=<name> --outfile=<name> --podpath=<name>:...:<name> --podroot=<name> --cachedir=<name> --flush --recurse --norecurse --quiet --noquiet --verbose --noverbose --index --noindex --backlink --nobacklink --header --noheader --poderrors --nopoderrors --css=<URL> --title=<name> --[no]backlink - turn =head1 directives into links pointing to the top of the page (off by default). --cachedir - directory for the directory cache files. --css - stylesheet URL --flush - flushes the directory cache. --[no]header - produce block header/footer (default is no headers). --help - prints this message. --htmldir - directory for resulting HTML files. --htmlroot - http-server base directory from which all relative paths in podpath stem (default is /). --[no]index - generate an index at the top of the resulting html (default behaviour). --infile - filename for the pod to convert (input taken from stdin by default). --outfile - filename for the resulting html file (output sent to stdout by default). --[no]poderrors - include a POD ERRORS section in the output if there were any POD errors in the input (default behavior). --podpath - colon-separated list of directories containing library pods (empty by default). --podroot - filesystem base directory from which all relative paths in podpath stem (default is .). --[no]quiet - suppress some benign warning messages (default is off). --[no]recurse - recurse on those subdirectories listed in podpath (default behaviour). --title - title that will appear in resulting html file. --[no]verbose - self-explanatory (off by default). END_OF_USAGE } sub parse_command_line { my ($opt_backlink,$opt_cachedir,$opt_css,$opt_flush,$opt_header, $opt_help,$opt_htmldir,$opt_htmlroot,$opt_index,$opt_infile, $opt_outfile,$opt_poderrors,$opt_podpath,$opt_podroot, $opt_quiet,$opt_recurse,$opt_title,$opt_verbose); unshift @ARGV, split ' ', $Config{pod2html} if $Config{pod2html}; my $result = GetOptions( 'backlink!' => \$opt_backlink, 'cachedir=s' => \$opt_cachedir, 'css=s' => \$opt_css, 'flush' => \$opt_flush, 'help' => \$opt_help, 'header!' => \$opt_header, 'htmldir=s' => \$opt_htmldir, 'htmlroot=s' => \$opt_htmlroot, 'index!' => \$opt_index, 'infile=s' => \$opt_infile, 'outfile=s' => \$opt_outfile, 'poderrors!' => \$opt_poderrors, 'podpath=s' => \$opt_podpath, 'podroot=s' => \$opt_podroot, 'quiet!' => \$opt_quiet, 'recurse!' => \$opt_recurse, 'title=s' => \$opt_title, 'verbose!' => \$opt_verbose, ); usage("-", "invalid parameters") if not $result; usage("-") if defined $opt_help; # see if the user asked for help $opt_help = ""; # just to make -w shut-up. @Podpath = split(":", $opt_podpath) if defined $opt_podpath; $Backlink = $opt_backlink if defined $opt_backlink; $Cachedir = _unixify($opt_cachedir) if defined $opt_cachedir; $Css = $opt_css if defined $opt_css; $Header = $opt_header if defined $opt_header; $Htmldir = _unixify($opt_htmldir) if defined $opt_htmldir; $Htmlroot = _unixify($opt_htmlroot) if defined $opt_htmlroot; $Doindex = $opt_index if defined $opt_index; $Podfile = _unixify($opt_infile) if defined $opt_infile; $Htmlfile = _unixify($opt_outfile) if defined $opt_outfile; $Poderrors = $opt_poderrors if defined $opt_poderrors; $Podroot = _unixify($opt_podroot) if defined $opt_podroot; $Quiet = $opt_quiet if defined $opt_quiet; $Recurse = $opt_recurse if defined $opt_recurse; $Title = $opt_title if defined $opt_title; $Verbose = $opt_verbose if defined $opt_verbose; warn "Flushing directory caches\n" if $opt_verbose && defined $opt_flush; $Dircache = "$Cachedir/pod2htmd.tmp"; if (defined $opt_flush) { 1 while unlink($Dircache); } } my $Saved_Cache_Key; sub get_cache { my($dircache, $podpath, $podroot, $recurse) = @_; my @cache_key_args = @_; # A first-level cache: # Don't bother reading the cache files if they still apply # and haven't changed since we last read them. my $this_cache_key = cache_key(@cache_key_args); return 1 if $Saved_Cache_Key and $this_cache_key eq $Saved_Cache_Key; $Saved_Cache_Key = $this_cache_key; # load the cache of %Pages if possible. $tests will be # non-zero if successful. my $tests = 0; if (-f $dircache) { warn "scanning for directory cache\n" if $Verbose; $tests = load_cache($dircache, $podpath, $podroot); } return $tests; } sub cache_key { my($dircache, $podpath, $podroot, $recurse) = @_; return join('!',$dircache,$recurse,@$podpath,$podroot,stat($dircache)); } # # load_cache - tries to find if the cache stored in $dircache is a valid # cache of %Pages. if so, it loads them and returns a non-zero value. # sub load_cache { my($dircache, $podpath, $podroot) = @_; my $tests = 0; local $_; warn "scanning for directory cache\n" if $Verbose; open(my $cachefh, '<', $dircache) || die "$0: error opening $dircache for reading: $!\n"; $/ = "\n"; # is it the same podpath? $_ = <$cachefh>; chomp($_); $tests++ if (join(":", @$podpath) eq $_); # is it the same podroot? $_ = <$cachefh>; chomp($_); $tests++ if ($podroot eq $_); # load the cache if its good if ($tests != 2) { close($cachefh); return 0; } warn "loading directory cache\n" if $Verbose; while (<$cachefh>) { /(.*?) (.*)$/; $Pages{$1} = $2; } close($cachefh); return 1; } # # html_escape: make text safe for HTML # sub html_escape { my $rest = $_[0]; $rest =~ s/&/&/g; $rest =~ s/</</g; $rest =~ s/>/>/g; $rest =~ s/"/"/g; $rest =~ s/([[:^print:]])/sprintf("&#x%x;", ord($1))/aeg; return $rest; } # # htmlify - converts a pod section specification to a suitable section # specification for HTML. We adopt the mechanism used by the formatter # that we use. # sub htmlify { my( $heading) = @_; return Pod::Simple::XHTML->can("idify")->(undef, $heading, 1); } # # similar to htmlify, but turns non-alphanumerics into underscores # sub anchorify { my ($anchor) = @_; $anchor = htmlify($anchor); $anchor =~ s/\W/_/g; return $anchor; } # # store POD files in %Pages # sub _save_page { my ($modspec, $modname) = @_; # Remove Podroot from path $modspec = $Podroot eq File::Spec->curdir ? File::Spec->abs2rel($modspec) : File::Spec->abs2rel($modspec, File::Spec->canonpath($Podroot)); # Convert path to unix style path $modspec = Pod::Html::_unixify($modspec); my ($file, $dir) = fileparse($modspec, qr/\.[^.]*/); # strip .ext $Pages{$modname} = $dir.$file; } sub _unixify { my $full_path = shift; return '' unless $full_path; return $full_path if $full_path eq '/'; my ($vol, $dirs, $file) = File::Spec->splitpath($full_path); my @dirs = $dirs eq File::Spec->curdir() ? (File::Spec::Unix->curdir()) : File::Spec->splitdir($dirs); if (defined($vol) && $vol) { $vol =~ s/:$// if $^O eq 'VMS'; $vol = uc $vol if $^O eq 'MSWin32'; if( $dirs[0] ) { unshift @dirs, $vol; } else { $dirs[0] = $vol; } } unshift @dirs, '' if File::Spec->file_name_is_absolute($full_path); return $file unless scalar(@dirs); $full_path = File::Spec::Unix->catfile(File::Spec::Unix->catdir(@dirs), $file); $full_path =~ s|^\/|| if $^O eq 'MSWin32'; # C:/foo works, /C:/foo doesn't $full_path =~ s/\^\././g if $^O eq 'VMS'; # unescape dots return $full_path; } package Pod::Simple::XHTML::LocalPodLinks; use strict; use warnings; use parent 'Pod::Simple::XHTML'; use File::Spec; use File::Spec::Unix; __PACKAGE__->_accessorize( 'htmldir', 'htmlfileurl', 'htmlroot', 'pages', # Page name => relative/path/to/page from root POD dir 'quiet', 'verbose', ); sub resolve_pod_page_link { my ($self, $to, $section) = @_; return undef unless defined $to || defined $section; if (defined $section) { $section = '#' . $self->idify($section, 1); return $section unless defined $to; } else { $section = ''; } my $path; # path to $to according to %Pages unless (exists $self->pages->{$to}) { # Try to find a POD that ends with $to and use that. # e.g., given L<XHTML>, if there is no $Podpath/XHTML in %Pages, # look for $Podpath/*/XHTML in %Pages, with * being any path, # as a substitute (e.g., $Podpath/Pod/Simple/XHTML) my @matches; foreach my $modname (keys %{$self->pages}) { push @matches, $modname if $modname =~ /::\Q$to\E\z/; } # make it look like a path instead of a namespace my $modloc = File::Spec->catfile(split(/::/, $to)); if ($#matches == -1) { warn "Cannot find file \"$modloc.*\" directly under podpath, " . "cannot find suitable replacement: link remains unresolved.\n" if $self->verbose; return ''; } elsif ($#matches == 0) { $path = $self->pages->{$matches[0]}; my $matchloc = File::Spec->catfile(split(/::/, $path)); warn "Cannot find file \"$modloc.*\" directly under podpath, but ". "I did find \"$matchloc.*\", so I'll assume that is what you ". "meant to link to.\n" if $self->verbose; } else { # Use [-1] so newer (higher numbered) perl PODs are used # XXX currently, @matches isn't sorted so this is not true $path = $self->pages->{$matches[-1]}; my $matchloc = File::Spec->catfile(split(/::/, $path)); warn "Cannot find file \"$modloc.*\" directly under podpath, but ". "I did find \"$matchloc.*\" (among others), so I'll use that " . "to resolve the link.\n" if $self->verbose; } } else { $path = $self->pages->{$to}; } my $url = File::Spec::Unix->catfile(Pod::Html::_unixify($self->htmlroot), $path); if ($self->htmlfileurl ne '') { # then $self->htmlroot eq '' (by definition of htmlfileurl) so # $self->htmldir needs to be prepended to link to get the absolute path # that will be relativized $url = Pod::Html::relativize_url( File::Spec::Unix->catdir(Pod::Html::_unixify($self->htmldir), $url), $self->htmlfileurl # already unixified ); } return $url . ".html$section"; } package Pod::Html; # # relativize_url - convert an absolute URL to one relative to a base URL. # Assumes both end in a filename. # sub relativize_url { my ($dest, $source) = @_; # Remove each file from its path my ($dest_volume, $dest_directory, $dest_file) = File::Spec::Unix->splitpath( $dest ); $dest = File::Spec::Unix->catpath( $dest_volume, $dest_directory, '' ); my ($source_volume, $source_directory, $source_file) = File::Spec::Unix->splitpath( $source ); $source = File::Spec::Unix->catpath( $source_volume, $source_directory, '' ); my $rel_path = ''; if ($dest ne '') { $rel_path = File::Spec::Unix->abs2rel( $dest, $source ); } if ($rel_path ne '' && substr( $rel_path, -1 ) ne '/') { $rel_path .= "/$dest_file"; } else { $rel_path .= "$dest_file"; } return $rel_path; } 1; PK �9�[V�^8 8 Functions.pmnu �[��� PK �9�[FIg' e e Z8 Html.pmnu �[��� PK � ��
| ver. 1.6 |
Github
|
.
| PHP 8.2.30 | ??????????? ?????????: 0 |
proxy
|
phpinfo
|
???????????