1Sys::Path(3)          User Contributed Perl Documentation         Sys::Path(3)
2
3
4

NAME

6       Sys::Path - supply autoconf style installation directories
7

SYNOPSIS

9       Paths for basic Unix installation 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 folder /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

DESCRIPTION

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 installation. For now there is only Module::Build
57       based Module::Build::SysPath that uses Sys::Path.
58

BUILD TIME CONFIGURATION

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

NOTE

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 things may change. For
69       these purposes there is a mailing list
70       <http://lists.meon.sk/mailman/listinfo/sys-path>.
71
72   WHY?
73       The filesystem standard has been designed to be used by Unix
74       distribution developers, package developers, and system implementors.
75       However, it is primarily intended to be a reference and is not a
76       tutorial on how to manage a Unix filesystem or directory hierarchy.
77
78       Sys::Path follows this standard when it is possible. Or when Perl
79       follows.  Perl can be installed in many places. Most Linux
80       distributions place Perl in /usr/bin/perl where FHS suggest. In this
81       case the FHS folders are suggested in prompt when doing `"perl
82       Build.PL"`. In other cases for other folders or home-folder Perl
83       distributions Sys::Path will suggest folders under Perl install prefix.
84       (ex. c:\strawerry\ for the ones using Windows).
85
86   PATHS
87       Here is the list of paths. First the default FHS path, then (to
88       compare) a suggested path when Perl is not installed in /usr.
89
90       prefix
91
92       /usr - $Config::Config{'prefix'}
93
94       Is a helper function and should not be used directly.
95
96       localstatedir
97
98       /var - $Config::Config{'prefix'}
99
100       Is a helper function and should not be used directly.
101
102       sysconfdir
103
104       /etc - $prefix/etc
105
106       The /etc hierarchy contains configuration files.  See
107       <http://www.pathname.com/fhs/pub/fhs-2.3.html#ETCHOSTSPECIFICSYSTEMCONFIGURATION>.
108
109       datadir
110
111       /usr/share - $prefix/share
112
113       The /usr/share hierarchy is for all read-only architecture independent
114       data files.  See
115       <http://www.pathname.com/fhs/pub/fhs-2.3.html#USRSHAREARCHITECTUREINDEPENDENTDATA>.
116
117       docdir
118
119       /usr/share/doc - $prefix/share/doc
120
121       See "datadir"
122
123       localedir
124
125       /usr/share/locale - $prefix/share/locale
126
127       See "datadir"
128
129       cachedir
130
131       /var/cache - $localstatedir/cache
132
133       /var/cache is intended for cached data from applications.  See
134       <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARCACHEAPPLICATIONCACHEDATA>.
135
136       logdir
137
138       /var/log - $localstatedir/logdir
139
140       This directory contains miscellaneous log files. Most logs must be
141       written to this directory or an appropriate subdirectory.  See
142       <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOGLOGFILESANDDIRECTORIES>.
143
144       spooldir
145
146       /var/spool - $localstatedir/spool
147
148       Contains data which is awaiting some kind of later processing.  See
149       <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARSPOOLAPPLICATIONSPOOLDATA>.
150
151       rundir
152
153       /var/run - $localstatedir/rundir
154
155       This directory contains system information data describing the system
156       since it was booted.  See
157       <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARRUNRUNTIMEVARIABLEDATA>.
158
159       lockdir
160
161       /var/lock - $localstatedir/lock
162
163       Lock files folder.  See
164       <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLOCKLOCKFILES>.
165
166       sharedstatedir
167
168       /var/lib - $localstatedir/lib
169
170       The directory for installing modifiable architecture-independent data.
171       See
172       <http://www.pathname.com/fhs/pub/fhs-2.3.html#VARLIBVARIABLESTATEINFORMATION>.
173
174       srvdir
175
176       /srv - $prefix/srv
177
178       Data for services provided by system.  See
179       <http://www.pathname.com/fhs/pub/fhs-2.3.html#SRVDATAFORSERVICESPROVIDEDBYSYSTEM>.
180
181       webdir
182
183       /var/www - $localstatedir/www
184
185       Directory where distribution put static web files.
186
187   HOW IT WORKS
188       The heart of Sys::Path is just:
189
190           use Config;
191           if ($Config::Config{'prefix'} eq '/usr') { ... do stuff ... }
192
193       The idea is that if the Perl was installed to /usr it is FHS type
194       installation and all path defaults are made based on FHS. For the rest
195       of the installations "prefix" and "localstatedir" is set exactly to
196       $Config::Config{'prefix'} which is the prefix of Perl that was used to
197       install. In this case "sysconfdir" is set to "prefix+'etc'".  See
198       Sys::Path::SPc for the implementation.
199

METHODS

201           prefix
202           localstatedir
203           sysconfdir
204           datadir
205           docdir
206           localedir
207           cachedir
208           logdir
209           spooldir
210           rundir
211           lockdir
212           sharedstatedir
213           webdir
214           srvdir
215

BUILDERS/INSTALLERS helper methods

217   find_distribution_root(__PACKAGE__)
218       Find the root folder of a modules distribution by going up the folder
219       structure.
220
221   prompt_cfg_file_changed($src_file, $dst_file, $prompt_function)
222       Will prompt if to overwrite $dst_file with $src_file. Returns true for
223       "yes" and false for "no".
224
225   changed_since_install($dest_file, $file)
226       Return if $dest_file changed since install. If optional $file is set
227       then this one is compared against install $dest_file checksum.
228
229   install_checksums(%filenames_with_checksums)
230       Getter and setter for files checksums recording.
231

SEE ALSO

233       Module::Build::SysPath
234

AUTHOR

236       Jozef Kutej, "<jkutej at cpan.org>"
237

CONTRIBUTORS

239       The following people have contributed to the Sys::Path by committing
240       their code, sending patches, reporting bugs, asking questions,
241       suggesting useful advises, nitpicking, chatting on IRC or commenting on
242       my blog (in no particular order):
243
244           Lars DXXXXXX XXX
245           Emmanuel Rodriguez
246           Salve J. Nilsen
247           Daniel Perrett
248           Jose Luis Perez Diez
249           Petr PisaX
250           Mohammad S Anwar
251
253       Copyright 2009 Jozef Kutej, all rights reserved.
254
255       This program is free software; you can redistribute it and/or modify it
256       under the same terms as Perl itself.
257
258
259
260perl v5.30.1                      2020-01-30                      Sys::Path(3)
Impressum