LaTeXML...Pathname(3)
πΈ NAME πΈ
okay bestie, meet LaTeXML::Util::Pathname β portable pathname and file-system utilities π
. It's part of the User Contributed Perl Documentation crew, and it's here to make path stuff feel a little less chaotic β¨
π DESCRIPTION π
lowkey iconic: 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. periodt π«Ά
π§ Pathname Manipulations π§
$path = pathname_make(%peices);β constructs a pathname from the keywords in pieces π:dir: directoryname: the filename (possibly with extension)type: the filename extension
($dir,$name,$type) = pathname_split($path);β splits pathname$pathinto the components: directory, name and type. clean split, no crumbs β¨$path = pathname_canonical($path);β canonicalizes pathname$pathby simplifying repeated slashes, dots representing current or parent directory, etc. so tidy π$dir = pathname_directory($path);β returns the directory component of pathname$path. that folder bit π$name = pathname_name($path);β returns the name component of pathname$path. that filename bit π·οΈ$type = pathname_type($path);β returns the type component of pathname$path. that extension bit π$path = pathname_concat($dir,$file);β returns the pathname resulting from concatenating directory$dirand filename$file. glue those bits together π«Ά$boole = pathname_is_absolute($path);β returns whether pathname$pathappears to be an absolute pathname. absolute vibes check β$boole = pathname_is_url($path);β returns whether pathname$pathappears to be a url, rather than local file. url or local? iykyk π$boole = pathname_is_literaldata($path);β returns whether pathname$pathis actually a blob of literal data, with a leading"literal:"protocol. literal data moment π§$boole = pathname_is_raw($path);β check if pathname indicates a raw TeX source or definition file. raw TeX realness π₯$rel = pathname_is_contained($path,$base);β checks whether$pathis underneath the directory$base; if so it returns the pathname$pathrelative to$base; otherwise returnsundef. contained or not contained, that is the question π¦$path = pathname_relative($path,$base);β if$pathis an absolute, non-URL pathname, returns the pathname relative to the directory$base, otherwise simply returns the canonical form of$path. relative realness π$path = pathname_absolute($path,$base);β returns the absolute pathname resulting from interpreting$pathrelative to the directory$base. If$pathis already absolute, it is returned unchanged. absolute and unbothered π$relative_url = pathname_to_url($path);β creates a local, relative URL for a given pathname, also ensuring proper path separators on non-Unix systems. url-ify it, bestie π
π¦ File System Operations π¦
$modtime = pathname_timestamp($path);β returns the modification time of the file named by$path, orundefif the file does not exist. timestamp check β°$path = pathname_cwd();β returns the current working directory. where are we? iconic π$dir = pathname_mkdir($dir);β creates the directory$dirand all missing ancestors. It returns$dirif successful, elseundef. make the whole directory tree happen π±$dest = pathname_copy($source,$dest);β copies the file$sourceto$destif needed; ie. if$destis missing or older than$source. It preserves the timestamp of$source. copy with timestamp preservation π$path = pathname_find($name,%options);β finds the first file named$namethat exists and that matches the specification in the keywords%options. An absolute pathname is returned. the search begins π- If
$nameis not already an absolute pathname, then the optionpathsdetermines directories to recursively search. It should be a list of pathnames, any relative paths are interpreted relative to the current directory. Ifpathsis omitted, then the current directory is searched. - If the option
installation_subdiris 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. - The
typesoption specifies a list of filetypes to search for. If not supplied, then the filename must match exactly. The type*matches any extension.
- If
@paths = pathname_findall($name,%options);β likepathname_find, but returns all matching (absolute) paths that exist. collect all the matches, no crumbs left behind π$path = pathname_kpsewhich(@names);β attempt to find a candidate name via the externalkpsewhichcapability of the system's TeX toolchain. Ifkpsewhichis not available, or the file is not found, returns a Perl undefined value. kpsewhich said what it said π§
π AUTHOR π
Bruce Miller β bruce.miller@nist.gov π
π COPYRIGHT π
Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.
π thatβs the tea, bestie β this page comes from perl v5.42.3, dated 2024-02-26, under the page tag LaTeXML...Pathname(3). go forth and pathname slay π
β¨
π¦ where this page comes from
- nixos 26.05: perl5.42.3-LaTeXML 0.8.8
- nixpkgs unstable: perl5.42.3-LaTeXML 0.8.8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms