.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "LaTeXML::Util::Pathname 3pm" .TH LaTeXML::Util::Pathname 3pm 2024-02-27 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME "LaTeXML::Util::Pathname" \- portable pathname and file\-system utilities .SH DESCRIPTION .IX Header "DESCRIPTION" This module combines the functionality File::Spec and File::Basename to give a consistent set of filename utilities for LaTeXML. A pathname is represented by a simple string. .SS "Pathname Manipulations" .IX Subsection "Pathname Manipulations" .ie n .IP """$path = pathname_make(%peices);""" 4 .el .IP "\f(CW$path = pathname_make(%peices);\fR" 4 .IX Item "$path = pathname_make(%peices);" Constructs a pathname from the keywords in pieces dir : directory name : the filename (possibly with extension) type : the filename extension .ie n .IP """($dir,$name,$type) = pathname_split($path);""" 4 .el .IP "\f(CW($dir,$name,$type) = pathname_split($path);\fR" 4 .IX Item "($dir,$name,$type) = pathname_split($path);" Splits the pathname \f(CW$path\fR into the components: directory, name and type. .ie n .IP """$path = pathname_canonical($path);""" 4 .el .IP "\f(CW$path = pathname_canonical($path);\fR" 4 .IX Item "$path = pathname_canonical($path);" Canonicallizes the pathname \f(CW$path\fR by simplifying repeated slashes, dots representing the current or parent directory, etc. .ie n .IP """$dir = pathname_directory($path);""" 4 .el .IP "\f(CW$dir = pathname_directory($path);\fR" 4 .IX Item "$dir = pathname_directory($path);" Returns the directory component of the pathname \f(CW$path\fR. .ie n .IP """$name = pathname_name($path);""" 4 .el .IP "\f(CW$name = pathname_name($path);\fR" 4 .IX Item "$name = pathname_name($path);" Returns the name component of the pathname \f(CW$path\fR. .ie n .IP """$type = pathname_type($path);""" 4 .el .IP "\f(CW$type = pathname_type($path);\fR" 4 .IX Item "$type = pathname_type($path);" Returns the type component of the pathname \f(CW$path\fR. .ie n .IP """$path = pathname_concat($dir,$file);""" 4 .el .IP "\f(CW$path = pathname_concat($dir,$file);\fR" 4 .IX Item "$path = pathname_concat($dir,$file);" Returns the pathname resulting from concatenating the directory \f(CW$dir\fR and filename \f(CW$file\fR. .ie n .IP """$boole = pathname_is_absolute($path);""" 4 .el .IP "\f(CW$boole = pathname_is_absolute($path);\fR" 4 .IX Item "$boole = pathname_is_absolute($path);" Returns whether the pathname \f(CW$path\fR appears to be an absolute pathname. .ie n .IP """$boole = pathname_is_url($path);""" 4 .el .IP "\f(CW$boole = pathname_is_url($path);\fR" 4 .IX Item "$boole = pathname_is_url($path);" Returns whether the pathname \f(CW$path\fR appears to be a url, rather than local file. .ie n .IP """$boole = pathname_is_literaldata($path);""" 4 .el .IP "\f(CW$boole = pathname_is_literaldata($path);\fR" 4 .IX Item "$boole = pathname_is_literaldata($path);" Returns whether the pathname \f(CW$path\fR is actually a blob of literal data, with a leading "literal:" protocol. .ie n .IP """$boole = pathname_is_raw($path);""" 4 .el .IP "\f(CW$boole = pathname_is_raw($path);\fR" 4 .IX Item "$boole = pathname_is_raw($path);" Check if pathname indicates a raw TeX source or definition file. .ie n .IP """$rel = pathname_is_contained($path,$base);""" 4 .el .IP "\f(CW$rel = pathname_is_contained($path,$base);\fR" 4 .IX Item "$rel = pathname_is_contained($path,$base);" Checks whether \f(CW$path\fR is underneath the directory \f(CW$base\fR; if so it returns the pathname \f(CW$path\fR relative to \f(CW$base\fR; otherwise returns undef. .ie n .IP """$path = pathname_relative($path,$base);""" 4 .el .IP "\f(CW$path = pathname_relative($path,$base);\fR" 4 .IX Item "$path = pathname_relative($path,$base);" If \f(CW$path\fR is an absolute, non-URL pathname, returns the pathname relative to the directory \f(CW$base\fR, otherwise simply returns the canonical form of \f(CW$path\fR. .ie n .IP """$path = pathname_absolute($path,$base);""" 4 .el .IP "\f(CW$path = pathname_absolute($path,$base);\fR" 4 .IX Item "$path = pathname_absolute($path,$base);" Returns the absolute pathname resulting from interpretting \&\f(CW$path\fR relative to the directory \f(CW$base\fR. If \f(CW$path\fR is already absolute, it is returned unchanged. .ie n .IP """$relative_url = pathname_to_url($path);""" 4 .el .IP "\f(CW$relative_url = pathname_to_url($path);\fR" 4 .IX Item "$relative_url = pathname_to_url($path);" Creates a local, relative URL for a given pathname, also ensuring proper path separators on non-Unix systems. .SS "File System Operations" .IX Subsection "File System Operations" .ie n .IP """$modtime = pathname_timestamp($path);""" 4 .el .IP "\f(CW$modtime = pathname_timestamp($path);\fR" 4 .IX Item "$modtime = pathname_timestamp($path);" Returns the modification time of the file named by \f(CW$path\fR, or undef if the file does not exist. .ie n .IP """$path = pathname_cwd();""" 4 .el .IP "\f(CW$path = pathname_cwd();\fR" 4 .IX Item "$path = pathname_cwd();" Returns the current working directory. .ie n .IP """$dir = pathname_mkdir($dir);""" 4 .el .IP "\f(CW$dir = pathname_mkdir($dir);\fR" 4 .IX Item "$dir = pathname_mkdir($dir);" Creates the directory \f(CW$dir\fR and all missing ancestors. It returns \f(CW$dir\fR if successful, else undef. .ie n .IP """$dest = pathname_copy($source,$dest);""" 4 .el .IP "\f(CW$dest = pathname_copy($source,$dest);\fR" 4 .IX Item "$dest = pathname_copy($source,$dest);" Copies the file \f(CW$source\fR to \f(CW$dest\fR if needed; ie. if \f(CW$dest\fR is missing or older than \f(CW$source\fR. It preserves the timestamp of \f(CW$source\fR. .ie n .IP """$path = pathname_find($name,%options);""" 4 .el .IP "\f(CW$path = pathname_find($name,%options);\fR" 4 .IX Item "$path = pathname_find($name,%options);" Finds the first file named \f(CW$name\fR that exists and that matches the specification in the keywords \f(CW%options\fR. An absolute pathname is returned. .Sp If \f(CW$name\fR is not already an absolute pathname, then the option \f(CW\*(C`paths\*(C'\fR determines directories to recursively search. It should be a list of pathnames, any relative paths are interpreted relative to the current directory. If \f(CW\*(C`paths\*(C'\fR is omitted, then the current directory is searched. .Sp If the option \f(CW\*(C`installation_subdir\*(C'\fR is given, it indicates, in addition to the above, a directory relative to the LaTeXML installation directory to search. This allows files included with the distribution to be found. .Sp The \f(CW\*(C`types\*(C'\fR option specifies a list of filetypes to search for. If not supplied, then the filename must match exactly. The type \f(CW\*(C`*\*(C'\fR matches any extension. .ie n .IP """@paths = pathname_findall($name,%options);""" 4 .el .IP "\f(CW@paths = pathname_findall($name,%options);\fR" 4 .IX Item "@paths = pathname_findall($name,%options);" Like \f(CW\*(C`pathname_find\*(C'\fR, but returns \fIall\fR matching (absolute) paths that exist. .ie n .IP """$path = pathname_kpsewhich(@names);""" 4 .el .IP "\f(CW$path = pathname_kpsewhich(@names);\fR" 4 .IX Item "$path = pathname_kpsewhich(@names);" Attempt to find a candidate name via the external \f(CW\*(C`kpsewhich\*(C'\fR capability of the system's TeX toolchain. If \f(CW\*(C`kpsewhich\*(C'\fR is not available, or the file is not found, returns a Perl undefined value. .SH AUTHOR .IX Header "AUTHOR" Bruce Miller .SH COPYRIGHT .IX Header "COPYRIGHT" Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.