LaTeXM...athname(3pm)

πŸ’– NAME πŸ’–

okay so bestie, this is the LaTeXM...athname(3pm) page (from the User Contributed Perl Documentation), and it's for the LaTeXML::Util::Pathname module β€” portable pathname and file-system utilities. Periodt. ✨

🌸 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 β€” no cap. Lowkey obsessed with how clean that is. Iconic. πŸ’…

πŸŽ€ Pathname Manipulations πŸŽ€

  • $path = pathname_make(%peices); β€” builds a pathname out of the keyword pieces you pass in:
    • dir: directory
    • name: the filename (possibly with extension)
    • type: the filename extension
  • ($dir,$name,$type) = pathname_split($path); β€” splits the pathname $path into its components: directory, name and type. Clean.
  • $path = pathname_canonical($path); β€” canonicalizes the pathname $path by simplifying repeated slashes, dots representing the current or parent directory, etc. It's giving cleanup era.
  • $dir = pathname_directory($path); β€” returns the directory component of the pathname $path.
  • $name = pathname_name($path); β€” returns the name component of the pathname $path.
  • $type = pathname_type($path); β€” returns the type component of the pathname $path.
  • $path = pathname_concat($dir,$file); β€” returns the pathname resulting from concatenating the directory $dir and filename $file.
  • $boole = pathname_is_absolute($path); β€” returns whether the pathname $path appears to be an absolute pathname. Vibe check: absolute or not?
  • $boole = pathname_is_url($path); β€” returns whether the pathname $path appears to be a url, rather than local file.
  • $boole = pathname_is_literaldata($path); β€” returns whether the pathname $path is actually a blob of literal data, with a leading literal: protocol. iykyk.
  • $boole = pathname_is_raw($path); β€” checks if pathname indicates a raw TeX source or definition file, fr fr.
  • $rel = pathname_is_contained($path,$base); β€” checks whether $path is underneath the directory $base; if so it returns the pathname $path relative to $base; otherwise returns undef. No cap.
  • $path = pathname_relative($path,$base); β€” if $path is an absolute, non-URL pathname, returns the pathname relative to the directory $base, otherwise simply returns the canonical form of $path.
  • $path = pathname_absolute($path,$base); β€” returns the absolute pathname resulting from interpreting $path relative to the directory $base. If $path is already absolute, it is returned unchanged. Highkey useful.
  • $relative_url = pathname_to_url($path); β€” creates a local, relative URL for a given pathname, also ensuring proper path separators on non-Unix systems.

πŸ¦‹ File System Operations πŸ¦‹

  • $modtime = pathname_timestamp($path); β€” returns the modification time of the file named by $path, or undef if the file does not exist.
  • $path = pathname_cwd(); β€” returns the current working directory. Where you at, bestie?
  • $dir = pathname_mkdir($dir); β€” creates the directory $dir and all missing ancestors. It returns $dir if successful, else undef. Make the whole tree, not just the leaf.
  • $dest = pathname_copy($source,$dest); β€” copies the file $source to $dest if needed; ie. if $dest is missing or older than $source. It preserves the timestamp of $source. Only copies when it has to.
  • $path = pathname_find($name,%options); β€” finds the first file named $name that exists and that matches the specification in the keywords %options. An absolute pathname is returned β€” you literally get an absolute pathname back.

If $name is not already an absolute pathname, then the option paths determines directories to recursively search. It should be a list of pathnames, any relative paths are interpreted relative to the current directory. If paths is omitted, then the current directory is searched.

If the option installation_subdir 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.

The types option specifies a list of filetypes to search for. If not supplied, then the filename must match exactly. The type * matches any extension. Wildcard moment.

  • @paths = pathname_findall($name,%options); β€” like pathname_find, but returns all matching (absolute) paths that exist.
  • $path = pathname_kpsewhich(@names); β€” attempt to find a candidate name via the external kpsewhich capability of the system's TeX toolchain. If kpsewhich is not available, or the file is not found, returns a Perl undefined value. Sometimes the answer is just undef, bestie. πŸ’€

πŸ‘‘ AUTHOR πŸ‘‘

Bruce Miller <bruce.miller@nist.gov>

Public domain software, produced as part of work done by the United States Government & not subject to copyright in the US.


πŸ’– That's a wrap, bestie! This page is from perl v5.40.1, dated 2025-11-16, and it's the LaTeXM...athname(3pm) manual. Now go slay those pathnames with main character energy. Periodt. ✨
πŸ“¦ where this page comes from