1LaTeXML::Util::PathnameU(s3e)r Contributed Perl DocumentaLtaiToenXML::Util::Pathname(3)
2
3
4

NAME

6       "LaTeXML::Util::Pathname"  - portable pathname and file-system
7       utilities
8

DESCRIPTION

10       This module combines the functionality File::Spec and File::Basename to
11       give a consistent set of filename utilities for LaTeXML.  A pathname is
12       represented by a simple string.
13
14   Pathname Manipulations
15       "$path = pathname_make(%peices);"
16           Constructs a pathname from the keywords in pieces
17             dir   : directory
18             name  : the filename (possibly with extension)
19             type  : the filename extension
20
21       "($dir,$name,$type) = pathname_split($path);"
22           Splits the pathname $path into the components: directory, name and
23           type.
24
25       "$path = pathname_canonical($path);"
26           Canonicallizes the pathname $path by simplifying repeated slashes,
27           dots representing the current or parent directory, etc.
28
29       "$dir = pathname_directory($path);"
30           Returns the directory component of the pathname $path.
31
32       "$name = pathname_name($path);"
33           Returns the name component of the pathname $path.
34
35       "$type = pathname_type($path);"
36           Returns the type component of the pathname $path.
37
38       "$path = pathname_concat($dir,$file);"
39           Returns the pathname resulting from concatenating the directory
40           $dir and filename $file.
41
42       "$boole = pathname_is_absolute($path);"
43           Returns whether the pathname $path appears to be an absolute
44           pathname.
45
46       "$boole = pathname_is_url($path);"
47           Returns whether the pathname $path appears to be a url, rather than
48           local file.
49
50       "$boole = pathname_is_literaldata($path);"
51           Returns whether the pathname $path is actually a blob of literal
52           data, with a leading "literal:" protocol.
53
54       "$boole = pathname_is_raw($path);"
55           Check if pathname indicates a raw TeX source or definition file.
56
57       "$boole = pathname_is_reloadable($path);"
58           Check for pathname exceptions where the same TeX definition file
59           can be meaningfully reloaded. For example, babel.sty ".ldf" files
60
61       "$rel = pathname_is_contained($path,$base);"
62           Checks whether $path is underneath the directory $base; if so it
63           returns the pathname $path relative to $base; otherwise returns
64           undef.
65
66       "$path = pathname_relative($path,$base);"
67           If $path is an absolute, non-URL pathname, returns the pathname
68           relative to the directory $base, otherwise simply returns the
69           canonical form of $path.
70
71       "$path = pathname_absolute($path,$base);"
72           Returns the absolute pathname resulting from interpretting $path
73           relative to the directory $base.  If $path is already absolute, it
74           is returned unchanged.
75
76       "$relative_url = pathname_to_url($path);"
77           Creates a local, relative URL for a given pathname, also ensuring
78           proper path separators on non-Unix systems.
79
80   File System Operations
81       "$modtime = pathname_timestamp($path);"
82           Returns the modification time of the file named by $path, or undef
83           if the file does not exist.
84
85       "$path = pathname_cwd();"
86           Returns the current working directory.
87
88       "$dir = pathname_mkdir($dir);"
89           Creates the directory $dir and all missing ancestors.  It returns
90           $dir if successful, else undef.
91
92       "$dest = pathname_copy($source,$dest);"
93           Copies the file $source to $dest if needed; ie. if $dest is missing
94           or older than $source.  It preserves the timestamp of $source.
95
96       "$path = pathname_find($name,%options);"
97           Finds the first file named $name that exists and that matches the
98           specification in the keywords %options.  An absolute pathname is
99           returned.
100
101           If $name is not already an absolute pathname, then the option
102           "paths" determines directories to recursively search.  It should be
103           a list of pathnames, any relative paths are interpreted relative to
104           the current directory.  If "paths" is omitted, then the current
105           directory is searched.
106
107           If the option "installation_subdir" is given, it indicates, in
108           addition to the above, a directory relative to the LaTeXML
109           installation directory to search.  This allows files included with
110           the distribution to be found.
111
112           The "types" option specifies a list of filetypes to search for.  If
113           not supplied, then the filename must match exactly.  The type "*"
114           matches any extension.
115
116       "@paths = pathname_findall($name,%options);"
117           Like "pathname_find", but returns all matching (absolute) paths
118           that exist.
119
120       "$path = pathname_kpsewhich(@names);"
121           Attempt to find a candidate name via the external "kpsewhich"
122           capability of the system's TeX toolchain. If "kpsewhich" is not
123           available, or the file is not found, returns a Perl undefined
124           value.
125

AUTHOR

127       Bruce Miller <bruce.miller@nist.gov>
128
130       Public domain software, produced as part of work done by the United
131       States Government & not subject to copyright in the US.
132
133
134
135perl v5.36.0                      2023-01-22        LaTeXML::Util::Pathname(3)
Impressum