1File::ShareDir::PAR(3)User Contributed Perl DocumentationFile::ShareDir::PAR(3)
2
3
4
6 File::ShareDir::PAR - File::ShareDir with PAR support
7
9 use File::SharedDir::PAR ':ALL';
10 # exact same interface as the normal File::ShareDir:
11
12 # Where are distribution-level shared data files kept
13 $dir = dist_dir('File-ShareDir');
14
15 # Where are module-level shared data files kept
16 $dir = module_dir('File::ShareDir');
17
18 # Find a specific file in our dist/module shared dir
19 $file = dist_file( 'File-ShareDir', 'file/name.txt');
20 $file = module_file('File::ShareDir', 'file/name.txt');
21
22 # Like module_file, but search up the inheritance tree
23 $file = class_file( 'Foo::Bar', 'file/name.txt' );
24
25 You may choose to install the "File::ShareDir::PAR" functions into
26 "File::ShareDir" so that they become available globally. In that case,
27 you must do the following before anybody can import functions from
28 "File::ShareDir":
29
30 use File::ShareDir::PAR 'global';
31
33 This module contains highly experimental code. If you want to load
34 modules from ".par" files using PAR and then access their shared
35 directory using "File::ShareDir", you probably have no choice but to
36 use it. But beware, here be dragons.
37
39 "File::ShareDir::PAR" provides the same functionality as File::ShareDir
40 but tries hard to be compatible with PAR packaged applications.
41
42 The problem is, that the concept of having a distribution or module
43 specific share directory becomes a little hazy when you're loading
44 everything from a single file. PAR uses an @INC hook to intercept any
45 attempt to load a module. File::ShareDir uses the directory structure
46 that is typically found in the directories that are listed in @INC for
47 storing the shared data. In a "PAR" enviroment, this is not necessarily
48 possible.
49
50 When you call one of the functions that this module provides, it will
51 take care to search in any of the currently loaded ".par" files before
52 scanning @INC. This is the same order of preference you get for loading
53 modules when PAR is in effect. If the path or file you are asking for
54 is found in one of the loaded ".par" files, that containing ".par" file
55 is extracted and the path returned will point to the extracted copy on
56 disk.
57
58 Depending on how you're using PAR, the files that are extracted this
59 way are either cleaned up after program termination or cached for
60 further executions. Either way, you're safe if you use the shared data
61 as read-only data. If you write to it, your changes may be lost after
62 the program ends.
63
64 For any further usage information, including the list of exportable
65 functions, please refer to the documentation of File::ShareDir.
66
68 Bugs should always be submitted via the CPAN bug tracker
69
70 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-ShareDir-PAR>
71
72 For other issues, contact the PAR mailing list: <par@perl.org>
73
75 Steffen Mueller <smueller@cpan.org>
76
77 The code was adapted from Adam Kennedy's work on "File::ShareDir"
78
80 File::ShareDir, File::HomeDir, Module::Install, Module::Install::Share
81
83 Copyright (c) 2008-2010 Steffen Mueller This program is free software;
84 you can redistribute it and/or modify it under the same terms as Perl
85 itself.
86
87 The portions of code that were copied from "File::ShareDir" are:
88
89 Copyright (c) 2005, 2006 Adam Kennedy. This program is free software;
90 you can redistribute it and/or modify it under the same terms as Perl
91 itself.
92
93 The full text of the license can be found in the LICENSE file included
94 with this module.
95
96
97
98perl v5.36.0 2022-07-22 File::ShareDir::PAR(3)