1LaTeXML::Util::PathnameU(s3e)r Contributed Perl DocumentaLtaiToenXML::Util::Pathname(3)
2
3
4
6 "LaTeXML::Util::Pathname" - portable pathname and file-system
7 utilities
8
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 "$rel = pathname_is_contained($path,$base);"
51 Checks whether $path is underneath the directory $base; if so it
52 returns the pathname $path relative to $base; otherwise returns
53 undef.
54
55 "$path = pathname_relative($path,$base);"
56 If $path is an absolute, non-URL pathname, returns the pathname
57 relative to the directory $base, otherwise simply returns the
58 canonical form of $path.
59
60 "$path = pathname_absolute($path,$base);"
61 Returns the absolute pathname resulting from interpretting $path
62 relative to the directory $base. If $path is already absolute, it
63 is returned unchanged.
64
65 File System Operations
66 "$modtime = pathname_timestamp($path);"
67 Returns the modification time of the file named by $path, or undef
68 if the file does not exist.
69
70 "$path = pathname_cwd();"
71 Returns the current working directory.
72
73 "$dir = pathname_mkdir($dir);"
74 Creates the directory $dir and all missing ancestors. It returns
75 $dir if successful, else undef.
76
77 "$dest = pathname_copy($source,$dest);"
78 Copies the file $source to $dest if needed; ie. if $dest is missing
79 or older than $source. It preserves the timestamp of $source.
80
81 "$path = pathname_find($name,%options);"
82 Finds the first file named $name that exists and that matches the
83 specification in the keywords %options. An absolute pathname is
84 returned.
85
86 If $name is not already an absolute pathname, then the option
87 "paths" determines directories to recursively search. It should be
88 a list of pathnames, any relative paths are interpreted relative to
89 the current directory. If "paths" is omitted, then the current
90 directory is searched.
91
92 If the option "installation_subdir" is given, it indicates, in
93 addition to the above, a directory relative to the LaTeXML
94 installation directory to search. This allows files included with
95 the distribution to be found.
96
97 The "types" option specifies a list of filetypes to search for. If
98 not supplied, then the filename must match exactly. The type "*"
99 matches any extension.
100
101 "@paths = pathname_findall($name,%options);"
102 Like "pathname_find", but returns all matching (absolute) paths
103 that exist.
104
106 Bruce Miller <bruce.miller@nist.gov>
107
109 Public domain software, produced as part of work done by the United
110 States Government & not subject to copyright in the US.
111
112
113
114perl v5.30.0 2019-10-13 LaTeXML::Util::Pathname(3)