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
26 This module contains highly experimental code. If you want to load
27 modules from ".par" files using PAR and then access their shared
28 directory using File::ShareDir, you probably have no choice but to use
29 it. But beware, here be dragons.
30
32 "File::ShareDir::PAR" provides the same functionality as File::ShareDir
33 but tries hard to be compatible with PAR packaged applications.
34
35 The problem is, that the concept of having a distribution or module
36 specific share directory becomes a little hazy when you're loading
37 everything from a single file. PAR uses an @INC hook to intercept any
38 attempt to load a module. File::ShareDir uses the directory structure
39 that is typically found in the directories that are listed in @INC for
40 storing the shared data. In a "PAR" enviroment, this is not necessarily
41 possible.
42
43 When you call one of the functions that this module provides, it will
44 take care to search in any of the currently loaded ".par" files before
45 scanning @INC. This is the same order of preference you get for loading
46 modules when PAR is in effect. If the path or file you are asking for
47 is found in one of the loaded ".par" files, that containing ".par" file
48 is extracted and the path returned will point to the extracted copy on
49 disk.
50
51 Depending on how you're using PAR, the files that are extracted this
52 way are either cleaned up after program termination or cached for
53 further executions. Either way, you're safe if you use the shared data
54 as read-only data. If you write to it, your changes may be lost after
55 the program ends.
56
57 For any further usage information, including the list of exportable
58 functions, please refer to the documentation of File::ShareDir.
59
61 Bugs should always be submitted via the CPAN bug tracker
62
63 http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-ShareDir-PAR
64 <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-ShareDir-PAR>
65
66 For other issues, contact the PAR mailing list: <par@perl.org>
67
69 Steffen Mueller <smueller@cpan.org>
70
71 The code was adapted from Adam Kennedy's work on "File::ShareDir"
72
74 File::ShareDir, File::HomeDir, Module::Install, Module::Install::Share
75
77 Copyright (c) 2008-2009 Steffen Mueller This program is free software;
78 you can redistribute it and/or modify it under the same terms as Perl
79 itself.
80
81 The portions of code that were copied from "File::ShareDir" are:
82
83 Copyright (c) 2005, 2006 Adam Kennedy. 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 full text of the license can be found in the LICENSE file included
88 with this module.
89
90
91
92perl v5.12.0 2009-03-20 File::ShareDir::PAR(3)