1Sys::Path(3) User Contributed Perl Documentation Sys::Path(3)
2
3
4
6 Sys::Path - supply autoconf style installation directories
7
9 Paths for basic Unix instalation when Perl is in /usr/bin:
10
11 use Sys::Path;
12
13 print Sys::Path->sysconfdir, "\n";
14 # /etc
15 print Sys::Path->datadir, "\n";
16 # /usr/share
17 print Sys::Path->logdir, "\n";
18 # /var/log
19 print Sys::Path->sharedstatedir, "\n";
20 # /var/lib
21
22 Paths for Unix when Perl is in home dir /home/daxim/local/bin:
23
24 print Sys::Path->sysconfdir, "\n";
25 # /home/daxim/local/etc
26 print Sys::Path->datadir, "\n";
27 # /home/daxim/local/share
28 print Sys::Path->logdir, "\n";
29 # /home/daxim/local/log
30 print Sys::Path->sharedstatedir, "\n";
31 # /home/daxim/local/lib
32
33 Paths for MS Windows Strawberry Perl when installed to C:\Strawberry\
34
35 print Sys::Path->sysconfdir, "\n";
36 # C:\Strawberry\etc
37 print Sys::Path->datadir, "\n";
38 # C:\Strawberry\share
39 print Sys::Path->logdir, "\n";
40 # C:\Strawberry\log
41 print Sys::Path->sharedstatedir, "\n";
42 # C:\Strawberry\lib
43
45 The goal is that Sys::Path provides autoconf style system paths.
46
47 The default paths for file locations are based on
48 <http://www.pathname.com/fhs/> (Filesystem Hierarchy Standard) if the
49 Perl was installed in /usr. For all other non-standard Perl
50 installations or systems the default prefix is the prefix of Perl it
51 self. Still those are just defaults and can be changed during "perl
52 Build.PL" prompting. After Sys::Path is configured and installed all
53 programs using it can just read/use the paths.
54
55 In addition Sys::Path includes some functions that are related to
56 modules build or instalation. For now there is only Module::Build based
57 Module::Build::SysPath that uses Sys::Path.
58
60 PERL_MM_USE_DEFAULT=1 perl Build.PL \
61 --sp-prefix=/usr/local \
62 --sp-sysconfdir=/usr/local/etc \
63 --sp-localstatedir=/var/local
64
66 This is an experiment and lot of questions and concerns can come out
67 about the paths configuration. Distributions build systems integration
68 and the naming. And as this is early version thinks may change. For
69 these purposes there is a mailing list
70 http://lists.meon.sk/mailman/listinfo/sys-path
71 <http://lists.meon.sk/mailman/listinfo/sys-path>.
72
73 WHY?
74 The filesystem standard has been designed to be used by Unix
75 distribution developers, package developers, and system implementors.
76 However, it is primarily intended to be a reference and is not a
77 tutorial on how to manage a Unix filesystem or directory hierarchy.
78
79 Sys::Path follows this standard when it is possible. Or when Perl
80 follows. Perl can be installed in many places. Most Linux
81 distributions place Perl in /usr/bin/perl where FHS suggest. In this
82 case the FHS folders are suggested in prompt when doing `"perl
83 Build.PL"`. In other cases for other folders or home-dir Perl
84 distributions Sys::Path will suggest folders under Perl install prefix.
85 (ex. c:\strawerry\ for the ones using Windows).
86
87 PATHS
88 Here is the list of paths. First the default FHS path, then (to
89 compare) a suggested path when Perl is not installed in /usr.
90
91 prefix
92
93 /usr - $Config::Config{'prefix'}
94
95 Is a helper function and should not be used directly.
96
97 localstatedir
98
99 /var - $Config::Config{'prefix'}
100
101 Is a helper function and should not be used directly.
102
103 sysconfdir
104
105 /etc - $prefix/etc
106
107 The /etc hierarchy contains configuration files. See
108 http://www.pathname.com/fhs/pub/fhs-2.3.html#ETCHOSTSPECIFICSYSTEMCONFIGURATION
109 <http://www.pathname.com/fhs/pub/fhs-2.3.html#ETCHOSTSPECIFICSYSTEMCONFIGURATION>.
110
111 datadir
112
113 /usr/share - $prefix/share
114
115 The /usr/share hierarchy is for all read-only architecture independent
116 data files. See
117 http://www.pathname.com/fhs/pub/fhs-2.3.html#USRSHAREARCHITECTUREINDEPENDENTDATA
118 <http://www.pathname.com/fhs/pub/fhs-2.3.html#USRSHAREARCHITECTUREINDEPENDENTDATA>.
119
120 docdir
121
122 /usr/share/doc - $prefix/share/doc
123
124 See "datadir"
125
126 localedir
127
128 /usr/share/locale - $prefix/share/locale
129
130 See "datadir"
131
132 cachedir
133
134 /var/cache - $localstatedir/cache
135
136 /var/cache is intended for cached data from applications. See
137 http://www.pathname.com/fhs/pub/fhs-2.3.html#VARCACHEAPPLICATIONCACHEDATA
138 <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARCACHEAPPLICATIONCACHEDATA>.
139
140 logdir
141
142 /var/log - $localstatedir/logdir
143
144 This directory contains miscellaneous log files. Most logs must be
145 written to this directory or an appropriate subdirectory. See
146 http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOGLOGFILESANDDIRECTORIES
147 <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOGLOGFILESANDDIRECTORIES>.
148
149 spooldir
150
151 /var/spool - $localstatedir/spool
152
153 Contains data which is awaiting some kind of later processing. See
154 http://www.pathname.com/fhs/pub/fhs-2.3.html#VARSPOOLAPPLICATIONSPOOLDATA
155 <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARSPOOLAPPLICATIONSPOOLDATA>.
156
157 rundir
158
159 /var/run - $localstatedir/rundir
160
161 This directory contains system information data describing the system
162 since it was booted. See
163 http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA
164 <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA>.
165
166 lockdir
167
168 /var/lock - $localstatedir/lock
169
170 Lock files folder. See
171 http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOCKLOCKFILES
172 <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOCKLOCKFILES>.
173
174 sharedstatedir
175
176 /var/lib - $localstatedir/lib
177
178 The directory for installing modifiable architecture-independent data.
179 See
180 http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLIBVARIABLESTATEINFORMATION
181 <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLIBVARIABLESTATEINFORMATION>.
182
183 webdir
184
185 /var/www - $localstatedir/www
186
187 Not defined by FHS but it is a place to put web page related (html, js,
188 css, ...) files.
189
190 HOW IT WORKS
191 The heart of Sys::Path is just:
192
193 use Config;
194 if ($Config::Config{'prefix'} eq '/usr') { ... do stuff ... }
195
196 The idea is that if the Perl was installed to /usr it is FHS type
197 installation and all path defaults are made based on FHS. For the rest
198 of the installations "prefix" and "localstatedir" is set exactly to
199 $Config::Config{'prefix'} which is the prefix of Perl that was used to
200 install. In this case "sysconfdir" is set to "prefix+'etc'". See
201 Sys::Path::SPc for the implementation.
202
204 prefix
205 localstatedir
206 sysconfdir
207 datadir
208 docdir
209 localedir
210 cachedir
211 logdir
212 spooldir
213 rundir
214 lockdir
215 sharedstatedir
216 webdir
217
219 find_distribution_root(__PACKAGE__)
220 Find the root folder of distribution by going up the folder structure.
221
222 prompt_cfg_file_changed($src_file, $dst_file, $prompt_function)
223 Will prompt if to overwrite $dst_file with $src_file. Returns true for
224 "yes" and false for "no".
225
226 changed_since_install($dest_file, $file)
227 Return if $dest_file changed since install. If optional $file is set
228 then this one is compared agains install $dest_file checksum.
229
230 install_checksums(%filenames_with_checksums)
231 Getter and setter for files checksums recording.
232
234 Module::Build::SysPath
235
237 Why "SPc" ?
238 1. it is short (much more than SysPatchConfig)
239
240 2. it is weird
241
242 3. it's so weird that it is uniq, so there will be no conflict.
243 (hopefully)
244
246 Jozef Kutej, "<jkutej at cpan.org>"
247
249 The following people have contributed to the Sys::Path by commiting
250 their code, sending patches, reporting bugs, asking questions,
251 suggesting useful advices, nitpicking, chatting on IRC or commenting on
252 my blog (in no particular order):
253
254 Lars DXXXXXX XXX
255 Emmanuel Rodriguez
256
258 Please report any bugs or feature requests to "bug-sys-path at
259 rt.cpan.org", or through the web interface at
260 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sys-Path
261 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sys-Path>. I will be
262 notified, and then you'll automatically be notified of progress on your
263 bug as I make changes.
264
266 Mailing list
267 http://lists.meon.sk/mailman/listinfo/sys-path
268 <http://lists.meon.sk/mailman/listinfo/sys-path>
269
270 The rest
271 You can find documentation for this module with the perldoc command.
272
273 perldoc Sys::Path
274
275 You can also look for information at:
276
277 · RT: CPAN's request tracker
278
279 http://rt.cpan.org/NoAuth/Bugs.html?Dist=Sys-Path
280 <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Sys-Path>
281
282 · AnnoCPAN: Annotated CPAN documentation
283
284 http://annocpan.org/dist/Sys-Path <http://annocpan.org/dist/Sys-
285 Path>
286
287 · CPAN Ratings
288
289 http://cpanratings.perl.org/d/Sys-Path
290 <http://cpanratings.perl.org/d/Sys-Path>
291
292 · Search CPAN
293
294 http://search.cpan.org/dist/Sys-Path
295 <http://search.cpan.org/dist/Sys-Path>
296
298 Copyright 2009 Jozef Kutej, all rights reserved.
299
300 This program is free software; you can redistribute it and/or modify it
301 under the same terms as Perl itself.
302
303
304
305perl v5.12.3 2011-06-10 Sys::Path(3)